rust/tests/ui/unboxed-closures/unboxed-closures-generic.rs
surechen 40ae34194c remove redundant imports
detects redundant imports that can be eliminated.

for #117772 :

In order to facilitate review and modification, split the checking code and
removing redundant imports code into two PR.
2023-12-10 10:56:22 +08:00

12 lines
225 B
Rust

// run-pass
fn call_it<F:FnMut(i32,i32)->i32>(y: i32, mut f: F) -> i32 {
f(2, y)
}
pub fn main() {
let f = |x: i32, y: i32| -> i32 { x + y };
let z = call_it(3, f);
println!("{}", z);
assert_eq!(z, 5);
}