From 6760b35e57c147fed70c693f952920c674a0eda4 Mon Sep 17 00:00:00 2001 From: Pascal Hertleif Date: Sat, 28 Jan 2017 14:12:35 +0100 Subject: [PATCH] Increase suggestion tests' context --- tests/compile-fail/for_loop.rs | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/tests/compile-fail/for_loop.rs b/tests/compile-fail/for_loop.rs index 5e13b778329..2712d4a1023 100644 --- a/tests/compile-fail/for_loop.rs +++ b/tests/compile-fail/for_loop.rs @@ -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()` -- 2.44.0