821d50aa0c
Warn about unused expressions with closure or generator type. This follows existing precedence of must use annotations present on `FnOnce`, `FnMut`, `Fn` traits, which already indirectly apply to closures in some cases, e.g.,: ```rust fn f() -> impl FnOnce() { || {} } fn main() { // an existing warning: unused implementer of `std::ops::FnOnce` that must be used: f(); // a new warning: unused closure that must be used: || {}; } ```
20 lines
482 B
Plaintext
20 lines
482 B
Plaintext
warning: unused variable: `x`
|
|
--> $DIR/unboxed-closures-move-mutable.rs:17:17
|
|
|
|
|
LL | move || x += 1;
|
|
| ^
|
|
|
|
|
= note: `#[warn(unused_variables)]` on by default
|
|
= help: did you mean to capture by reference instead?
|
|
|
|
warning: unused variable: `x`
|
|
--> $DIR/unboxed-closures-move-mutable.rs:21:17
|
|
|
|
|
LL | move || x += 1;
|
|
| ^
|
|
|
|
|
= help: did you mean to capture by reference instead?
|
|
|
|
warning: 2 warnings emitted
|
|
|