mirror of
https://github.com/github/codeql.git
synced 2026-04-20 22:44:52 +02:00
Rust: Clean up the existing macro cases for the unusedentities test.
This commit is contained in:
@@ -14,8 +14,8 @@
|
||||
| main.rs:284:13:284:17 | total | Variable $@ is assigned a value that is never used. | main.rs:252:13:252:17 | total | total |
|
||||
| main.rs:377:9:377:9 | x | Variable $@ is assigned a value that is never used. | main.rs:377:9:377:9 | x | x |
|
||||
| main.rs:385:17:385:17 | x | Variable $@ is assigned a value that is never used. | main.rs:385:17:385:17 | x | x |
|
||||
| main.rs:486:9:486:9 | c | Variable $@ is assigned a value that is never used. | main.rs:486:9:486:9 | c | c |
|
||||
| main.rs:519:9:519:20 | var_in_macro | Variable $@ is assigned a value that is never used. | main.rs:519:9:519:20 | var_in_macro | var_in_macro |
|
||||
| main.rs:493:9:493:20 | var_in_macro | Variable $@ is assigned a value that is never used. | main.rs:493:9:493:20 | var_in_macro | var_in_macro |
|
||||
| main.rs:502:9:502:9 | c | Variable $@ is assigned a value that is never used. | main.rs:502:9:502:9 | c | c |
|
||||
| more.rs:44:9:44:14 | a_ptr4 | Variable $@ is assigned a value that is never used. | more.rs:44:9:44:14 | a_ptr4 | a_ptr4 |
|
||||
| more.rs:59:9:59:13 | d_ptr | Variable $@ is assigned a value that is never used. | more.rs:59:9:59:13 | d_ptr | d_ptr |
|
||||
| more.rs:65:13:65:17 | f_ptr | Variable $@ is assigned a value that is never used. | more.rs:65:13:65:17 | f_ptr | f_ptr |
|
||||
|
||||
@@ -478,6 +478,22 @@ fn macros() {
|
||||
})
|
||||
)
|
||||
}
|
||||
|
||||
macro_rules! let_in_macro {
|
||||
($e:expr) => {{
|
||||
let var_in_macro = 0;
|
||||
$e
|
||||
}};
|
||||
}
|
||||
|
||||
// Our analysis does not currently respect the hygiene rules of Rust macros
|
||||
// (https://veykril.github.io/tlborm/decl-macros/minutiae/hygiene.html), because
|
||||
// all we have access to is the expanded AST
|
||||
fn hygiene_mismatch() {
|
||||
let var_in_macro = 0; // $ SPURIOUS: Alert[rust/unused-value]
|
||||
let_in_macro!(var_in_macro);
|
||||
}
|
||||
|
||||
// --- references ---
|
||||
|
||||
fn references() {
|
||||
@@ -505,21 +521,6 @@ trait MyTrait {
|
||||
fn my_func2(&self, x: i32) -> i32;
|
||||
}
|
||||
|
||||
macro_rules! let_in_macro {
|
||||
($e:expr) => {{
|
||||
let var_in_macro = 0;
|
||||
$e
|
||||
}};
|
||||
}
|
||||
|
||||
// Our analysis does not currently respect the hygiene rules of Rust macros
|
||||
// (https://veykril.github.io/tlborm/decl-macros/minutiae/hygiene.html), because
|
||||
// all we have access to is the expanded AST
|
||||
fn hygiene_mismatch() {
|
||||
let var_in_macro = 0; // $ SPURIOUS: Alert[rust/unused-value]
|
||||
let_in_macro!(var_in_macro);
|
||||
}
|
||||
|
||||
// --- main ---
|
||||
|
||||
fn main() {
|
||||
@@ -535,6 +536,7 @@ fn main() {
|
||||
func_ptrs();
|
||||
folds_and_closures();
|
||||
macros();
|
||||
hygiene_mismatch();
|
||||
references();
|
||||
|
||||
generics();
|
||||
|
||||
Reference in New Issue
Block a user