Open
Description
What it does
Detecting if any element in a tuple variable is unused.
Advantage
- If a new element is added, other places that use this tuple may forget to update the use of new elements.
Drawbacks
- It can be a little noisy.
- It cannot be ignored by adding a prefix underscore, but only using
#[allow]
or#[expect]
.
Base on that, this lint probably should be in the pedantic
category.
Example
fn main() {
let a = (1, 2);
println!("{}", a.0);
}
Emit warning
warning: unused tuple element : `a.1`
--> src/main.rs:2:9
|
2 | let a = (1, 2);
| ^