1 #[warn(clippy::needless_borrowed_reference)]
2 #[allow(unused_variables)]
4 let mut v = Vec::<String>::new();
5 let _ = v.iter_mut().filter(|&ref a| a.is_empty());
9 let thingy = Some(&var);
10 if let Some(&ref v) = thingy {
15 let thingy2 = Some(&mut var2);
16 if let Some(&mut ref mut v) = thingy2 {
17 // ^ should **not** be linted
18 // v is borrowed as mutable.
21 if let Some(&mut ref v) = thingy2 {
22 // ^ should **not** be linted
23 // here, v is borrowed as immutable.
35 #[allow(unused_variables)]
37 fn foo(a: &Animal, b: &Animal) {
39 (&Animal::Cat(v), &ref k) | (&ref k, &Animal::Cat(v)) => (), // lifetime mismatch error if there is no '&ref'
40 // ^ and ^ should **not** be linted
41 (&Animal::Dog(ref a), &Animal::Dog(_)) => (), // ^ should **not** be linted