Reputation: 2034
Rust newbie here. When providing a parameter and leaving it unused in a function declaration (e.g. when learning Rust...) the compiler warns about the fact that the variable is unused in the scope, and proposes to consider putting an underline before it. Doing so, the warning disappears.
warning: unused variable: `y`
--> src/main.rs:23:29
|
23 | fn another_function(x: i32, y: i32) {
| ^ help: consider using `_y` instead
|
= note: #[warn(unused_variables)] on by default
why? How is the variable treated differently then?
Upvotes: 5
Views: 2018