mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-23 05:03:21 +00:00
Increase suggestion tests' context
This commit is contained in:
parent
8cbf548f7e
commit
6760b35e57
1 changed files with 12 additions and 12 deletions
|
@ -294,18 +294,18 @@ fn main() {
|
|||
for _v in vec.iter() { }
|
||||
//~^ ERROR it is more idiomatic to loop over `&vec`
|
||||
//~| HELP to write this more concisely, try looping over
|
||||
//~| SUGGESTION &vec
|
||||
//~| SUGGESTION for _v in &vec {
|
||||
|
||||
for _v in vec.iter_mut() { }
|
||||
//~^ ERROR it is more idiomatic to loop over `&mut vec`
|
||||
//~| HELP to write this more concisely, try looping over
|
||||
//~| SUGGESTION vec
|
||||
//~| SUGGESTION for _v in &mut vec {
|
||||
|
||||
let out_vec = vec![1,2,3];
|
||||
for _v in out_vec.into_iter() { }
|
||||
//~^ ERROR it is more idiomatic to loop over `out_vec` instead of `out_vec.into_iter()`
|
||||
//~| HELP to write this more concisely, try looping over
|
||||
//~| SUGGESTION out_vec
|
||||
//~| SUGGESTION for _v in out_vec {
|
||||
|
||||
for _v in &vec { } // these are fine
|
||||
for _v in &mut vec { } // these are fine
|
||||
|
@ -313,14 +313,14 @@ fn main() {
|
|||
for _v in [1, 2, 3].iter() { }
|
||||
//~^ ERROR it is more idiomatic to loop over `&[
|
||||
//~| HELP to write this more concisely, try looping over
|
||||
//~| SUGGESTION &[1, 2, 3]
|
||||
//~| SUGGESTION for _v in &[1, 2, 3] {
|
||||
|
||||
for _v in (&mut [1, 2, 3]).iter() { } // no error
|
||||
|
||||
for _v in [0; 32].iter() {}
|
||||
//~^ ERROR it is more idiomatic to loop over `&[
|
||||
//~| HELP to write this more concisely, try looping over
|
||||
//~| SUGGESTION &[0; 32]
|
||||
//~| SUGGESTION for _v in &[0; 32] {
|
||||
|
||||
for _v in [0; 33].iter() {} // no error
|
||||
|
||||
|
@ -328,43 +328,43 @@ fn main() {
|
|||
for _v in ll.iter() { }
|
||||
//~^ ERROR it is more idiomatic to loop over `&ll`
|
||||
//~| HELP to write this more concisely, try looping over
|
||||
//~| SUGGESTION &ll
|
||||
//~| SUGGESTION for _v in &ll {
|
||||
|
||||
let vd: VecDeque<()> = VecDeque::new();
|
||||
for _v in vd.iter() { }
|
||||
//~^ ERROR it is more idiomatic to loop over `&vd`
|
||||
//~| HELP to write this more concisely, try looping over
|
||||
//~| SUGGESTION &vd
|
||||
//~| SUGGESTION for _v in &vd {
|
||||
|
||||
let bh: BinaryHeap<()> = BinaryHeap::new();
|
||||
for _v in bh.iter() { }
|
||||
//~^ ERROR it is more idiomatic to loop over `&bh`
|
||||
//~| HELP to write this more concisely, try looping over
|
||||
//~| SUGGESTION &bh
|
||||
//~| SUGGESTION for _v in &bh {
|
||||
|
||||
let hm: HashMap<(), ()> = HashMap::new();
|
||||
for _v in hm.iter() { }
|
||||
//~^ ERROR it is more idiomatic to loop over `&hm`
|
||||
//~| HELP to write this more concisely, try looping over
|
||||
//~| SUGGESTION &hm
|
||||
//~| SUGGESTION for _v in &hm {
|
||||
|
||||
let bt: BTreeMap<(), ()> = BTreeMap::new();
|
||||
for _v in bt.iter() { }
|
||||
//~^ ERROR it is more idiomatic to loop over `&bt`
|
||||
//~| HELP to write this more concisely, try looping over
|
||||
//~| SUGGESTION &bt
|
||||
//~| SUGGESTION for _v in &bt {
|
||||
|
||||
let hs: HashSet<()> = HashSet::new();
|
||||
for _v in hs.iter() { }
|
||||
//~^ ERROR it is more idiomatic to loop over `&hs`
|
||||
//~| HELP to write this more concisely, try looping over
|
||||
//~| SUGGESTION &hs
|
||||
//~| SUGGESTION for _v in &hs {
|
||||
|
||||
let bs: BTreeSet<()> = BTreeSet::new();
|
||||
for _v in bs.iter() { }
|
||||
//~^ ERROR it is more idiomatic to loop over `&bs`
|
||||
//~| HELP to write this more concisely, try looping over
|
||||
//~| SUGGESTION &bs
|
||||
//~| SUGGESTION for _v in &bs {
|
||||
|
||||
|
||||
for _v in vec.iter().next() { } //~ERROR you are iterating over `Iterator::next()`
|
||||
|
|
Loading…
Reference in a new issue