From 6d35c67b6e39fae1efc48405b49d408b86666534 Mon Sep 17 00:00:00 2001 From: Lukas Wirth Date: Fri, 12 Mar 2021 15:41:08 +0100 Subject: Fix convert_iter_for_each_to_for doctest --- crates/ide_assists/src/tests/generated.rs | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'crates/ide_assists/src/tests') diff --git a/crates/ide_assists/src/tests/generated.rs b/crates/ide_assists/src/tests/generated.rs index af513ca22..3f77edd8d 100644 --- a/crates/ide_assists/src/tests/generated.rs +++ b/crates/ide_assists/src/tests/generated.rs @@ -210,17 +210,24 @@ fn doctest_convert_iter_for_each_to_for() { check_doc_test( "convert_iter_for_each_to_for", r#####" +//- /lib.rs crate:core +pub mod iter { pub mod traits { pub mod iterator { pub trait Iterator {} } } } +pub struct SomeIter; +impl self::iter::traits::iterator::Iterator for SomeIter {} +//- /lib.rs crate:main deps:core +use core::SomeIter; fn main() { - let vec = vec![(1, 2), (2, 3), (3, 4)]; - x.iter().for_each(|(x, y)| { + let iter = SomeIter; + iter.for_each$0(|(x, y)| { println!("x: {}, y: {}", x, y); }); } "#####, r#####" +use core::SomeIter; fn main() { - let vec = vec![(1, 2), (2, 3), (3, 4)]; - for (x, y) in x.iter() { + let iter = SomeIter; + for (x, y) in iter { println!("x: {}, y: {}", x, y); } } -- cgit v1.2.3