@@ -6,27 +6,27 @@ use syntax::{
66
77use crate :: { AssistContext , AssistId , AssistKind , Assists } ;
88
9- /// Assist: convert_iter_for_each_to_for
9+ // Assist: convert_iter_for_each_to_for
1010//
11- /// Converts an Iterator::for_each function into a for loop.
12- ///
13- /// ```rust
14- /// fn main() {
15- /// let vec = vec![(1, 2), (2, 3), (3, 4)];
16- /// x.iter().for_each(|(x, y)| {
17- /// println!("x: {}, y: {}", x, y);
18- /// })
19- /// }
20- /// ```
21- /// ->
22- /// ```rust
23- /// fn main() {
24- /// let vec = vec![(1, 2), (2, 3), (3, 4)];
25- /// for (x, y) in x.iter() {
26- /// println!("x: {}, y: {}", x, y);
27- /// });
28- /// }
29- /// ```
11+ // Converts an Iterator::for_each function into a for loop.
12+ //
13+ // ```rust
14+ // fn main() {
15+ // let vec = vec![(1, 2), (2, 3), (3, 4)];
16+ // x.iter().for_each(|(x, y)| {
17+ // println!("x: {}, y: {}", x, y);
18+ // });
19+ // }
20+ // ```
21+ // ->
22+ // ```rust
23+ // fn main() {
24+ // let vec = vec![(1, 2), (2, 3), (3, 4)];
25+ // for (x, y) in x.iter() {
26+ // println!("x: {}, y: {}", x, y);
27+ // }
28+ // }
29+ // ```
3030pub ( crate ) fn convert_iter_for_each_to_for ( acc : & mut Assists , ctx : & AssistContext ) -> Option < ( ) > {
3131 let method = ctx. find_node_at_offset :: < ast:: MethodCallExpr > ( ) ?;
3232 let stmt = method. syntax ( ) . parent ( ) . and_then ( ast:: ExprStmt :: cast) ;
0 commit comments