github / github/codeql

[Rust] Unused variable False positive

Open
#20,256 2 comments 0 reactions 0 assignees View on GitHub
false-positive
Dominant language
CodeQL
Stars
10.1k
Forks
2.1k
Avg merge
2d 15h
Merged PRs (30d)
141

Description

**Description of the false positive**

The argument is being used in the body of the function but flagged unused.

**Code samples or links to source code**

This is one specific example https://github.com/microsoft/windows-drivers-rs/blob/main/crates/cargo-wdk/src/providers/fs.rs#L29

**URL to the alert on GitHub code scanning (optional)**
https://github.com/microsoft/windows-drivers-rs/security/code-scanning/5

However, false positives for the arguments are generated for all the methods in [this](https://github.com/microsoft/windows-drivers-rs/blob/main/crates/cargo-wdk/src/providers/fs.rs) module and other sibling modules ([exec](https://github.com/microsoft/windows-drivers-rs/blob/main/crates/cargo-wdk/src/providers/exec.rs), [metadata](https://github.com/microsoft/windows-drivers-rs/blob/main/crates/cargo-wdk/src/providers/metadata.rs) and [wdk_build](https://github.com/microsoft/windows-drivers-rs/blob/main/crates/cargo-wdk/src/providers/wdk_build.rs)).

Contributor guide

Open the contributing guide

Research direction

Start with the flagged argument at crates/cargo-wdk/src/providers/fs.rs#L29 and inspect the linked CodeQL alert. Compare the usage there with the methods in the fs, exec, metadata, and wdk_build provider modules. Done means those used arguments are no longer reported as unused by code scanning.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
security
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.