rust/tests/ui/unboxed-closures/unboxed-closures-call-sugar-autoderef.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

14 lines
285 B
Rust

// run-pass
// Test that the call operator autoderefs when calling a bounded type parameter.
fn call_with_2<F>(x: &mut F) -> isize
where F : FnMut(isize) -> isize
{
x(2) // look ma, no `*`
}
pub fn main() {
let z = call_with_2(&mut |x| x - 22);
assert_eq!(z, -20);
}