mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-01 06:51:58 +00:00
40ae34194c
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.
26 lines
397 B
Rust
26 lines
397 B
Rust
// run-pass
|
|
|
|
fn call_f<F:FnMut()>(mut f: F) {
|
|
f();
|
|
}
|
|
|
|
fn f() {
|
|
println!("hello");
|
|
}
|
|
|
|
fn call_g<G:FnMut(String,String) -> String>(mut g: G, x: String, y: String)
|
|
-> String {
|
|
g(x, y)
|
|
}
|
|
|
|
fn g(mut x: String, y: String) -> String {
|
|
x.push_str(&y);
|
|
x
|
|
}
|
|
|
|
fn main() {
|
|
call_f(f);
|
|
assert_eq!(call_g(g, "foo".to_string(), "bar".to_string()),
|
|
"foobar");
|
|
}
|