Add needless_borrowed_ref example.

This commit is contained in:
Benoît CORTIER 2017-06-29 13:46:07 +02:00 committed by Oliver Schneider
parent 2460454155
commit b1d93a595c
No known key found for this signature in database
GPG key ID: A69F8D225B3AD7D9
2 changed files with 17 additions and 0 deletions

View 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());
}

View 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