Skip to content

Commit

Permalink
Increase suggestion tests' context
Browse files Browse the repository at this point in the history
  • Loading branch information
killercup committed Jan 28, 2017
1 parent 8cbf548 commit 6760b35
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions tests/compile-fail/for_loop.rs
Expand Up @@ -294,77 +294,77 @@ 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

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

let ll: LinkedList<()> = LinkedList::new();
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()`
Expand Down

0 comments on commit 6760b35

Please sign in to comment.