aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--crates/ide_assists/src/handlers/convert_iter_for_each_to_for.rs4
-rw-r--r--crates/ide_assists/src/tests/generated.rs23
2 files changed, 25 insertions, 2 deletions
diff --git a/crates/ide_assists/src/handlers/convert_iter_for_each_to_for.rs b/crates/ide_assists/src/handlers/convert_iter_for_each_to_for.rs
index 661a3fbeb..ed15f169e 100644
--- a/crates/ide_assists/src/handlers/convert_iter_for_each_to_for.rs
+++ b/crates/ide_assists/src/handlers/convert_iter_for_each_to_for.rs
@@ -10,7 +10,7 @@ use crate::{AssistContext, AssistId, AssistKind, Assists};
10// 10//
11// Converts an Iterator::for_each function into a for loop. 11// Converts an Iterator::for_each function into a for loop.
12// 12//
13// ```rust 13// ```
14// fn main() { 14// fn main() {
15// let vec = vec![(1, 2), (2, 3), (3, 4)]; 15// let vec = vec![(1, 2), (2, 3), (3, 4)];
16// x.iter().for_each(|(x, y)| { 16// x.iter().for_each(|(x, y)| {
@@ -19,7 +19,7 @@ use crate::{AssistContext, AssistId, AssistKind, Assists};
19// } 19// }
20// ``` 20// ```
21// -> 21// ->
22// ```rust 22// ```
23// fn main() { 23// fn main() {
24// let vec = vec![(1, 2), (2, 3), (3, 4)]; 24// let vec = vec![(1, 2), (2, 3), (3, 4)];
25// for (x, y) in x.iter() { 25// for (x, y) in x.iter() {
diff --git a/crates/ide_assists/src/tests/generated.rs b/crates/ide_assists/src/tests/generated.rs
index 304b5798f..af513ca22 100644
--- a/crates/ide_assists/src/tests/generated.rs
+++ b/crates/ide_assists/src/tests/generated.rs
@@ -206,6 +206,29 @@ const _: i32 = 0b1010;
206} 206}
207 207
208#[test] 208#[test]
209fn doctest_convert_iter_for_each_to_for() {
210 check_doc_test(
211 "convert_iter_for_each_to_for",
212 r#####"
213fn main() {
214 let vec = vec![(1, 2), (2, 3), (3, 4)];
215 x.iter().for_each(|(x, y)| {
216 println!("x: {}, y: {}", x, y);
217 });
218}
219"#####,
220 r#####"
221fn main() {
222 let vec = vec![(1, 2), (2, 3), (3, 4)];
223 for (x, y) in x.iter() {
224 println!("x: {}, y: {}", x, y);
225 }
226}
227"#####,
228 )
229}
230
231#[test]
209fn doctest_convert_to_guarded_return() { 232fn doctest_convert_to_guarded_return() {
210 check_doc_test( 233 check_doc_test(
211 "convert_to_guarded_return", 234 "convert_to_guarded_return",