Add needless_borrowed_ref example.
This commit is contained in:
parent
2460454155
commit
b1d93a595c
9
clippy_tests/examples/needless_borrowed_ref.rs
Normal file
9
clippy_tests/examples/needless_borrowed_ref.rs
Normal file
@ -0,0 +1,9 @@
|
||||
#![feature(plugin)]
|
||||
#![plugin(clippy)]
|
||||
|
||||
#[warn(needless_borrowed_reference)]
|
||||
fn main() {
|
||||
let mut v = Vec::<String>::new();
|
||||
let _ = v.iter_mut().filter(|&ref a| a.is_empty());
|
||||
}
|
||||
|
8
clippy_tests/examples/needless_borrowed_ref.stderr
Normal file
8
clippy_tests/examples/needless_borrowed_ref.stderr
Normal file
@ -0,0 +1,8 @@
|
||||
warning: this pattern takes a reference on something that is being de-referenced
|
||||
--> needless_borrowed_ref.rs:7:35
|
||||
|
|
||||
7 | let _ = v.iter_mut().filter(|&ref a| a.is_empty());
|
||||
| ^^^^^
|
||||
|
|
||||
= note: #[warn(needless_borrowed_reference)] on by default
|
||||
= help: for further information visit https://github.com/Manishearth/rust-clippy/wiki#needless_borrowed_reference
|
Loading…
x
Reference in New Issue
Block a user