23 lines
540 B
Rust
23 lines
540 B
Rust
// non rustfixable, see redundant_closure_call_fixable.rs
|
|
|
|
#![warn(clippy::redundant_closure_call)]
|
|
|
|
fn main() {
|
|
let mut i = 1;
|
|
|
|
// don't lint here, the closure is used more than once
|
|
let closure = |i| i + 1;
|
|
i = closure(3);
|
|
i = closure(4);
|
|
|
|
// lint here
|
|
let redun_closure = || 1;
|
|
i = redun_closure();
|
|
|
|
// the lint is applicable here but the lint doesn't support redefinition
|
|
let redefined_closure = || 1;
|
|
i = redefined_closure();
|
|
let redefined_closure = || 2;
|
|
i = redefined_closure();
|
|
}
|