mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-11 08:05:12 +00:00
fix: replace doc-comments with normal comments
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
This commit is contained in:
parent
f67861310c
commit
7a9230acdf
@ -6,27 +6,27 @@ use syntax::{
|
|||||||
|
|
||||||
use crate::{AssistContext, AssistId, AssistKind, Assists};
|
use crate::{AssistContext, AssistId, AssistKind, Assists};
|
||||||
|
|
||||||
/// Assist: convert_iter_for_each_to_for
|
// Assist: convert_iter_for_each_to_for
|
||||||
//
|
//
|
||||||
/// Converts an Iterator::for_each function into a for loop.
|
// Converts an Iterator::for_each function into a for loop.
|
||||||
///
|
//
|
||||||
/// ```rust
|
// ```rust
|
||||||
/// fn main() {
|
// fn main() {
|
||||||
/// let vec = vec![(1, 2), (2, 3), (3, 4)];
|
// let vec = vec![(1, 2), (2, 3), (3, 4)];
|
||||||
/// x.iter().for_each(|(x, y)| {
|
// x.iter().for_each(|(x, y)| {
|
||||||
/// println!("x: {}, y: {}", x, y);
|
// println!("x: {}, y: {}", x, y);
|
||||||
/// })
|
// });
|
||||||
/// }
|
// }
|
||||||
/// ```
|
// ```
|
||||||
/// ->
|
// ->
|
||||||
/// ```rust
|
// ```rust
|
||||||
/// fn main() {
|
// fn main() {
|
||||||
/// let vec = vec![(1, 2), (2, 3), (3, 4)];
|
// let vec = vec![(1, 2), (2, 3), (3, 4)];
|
||||||
/// for (x, y) in x.iter() {
|
// for (x, y) in x.iter() {
|
||||||
/// println!("x: {}, y: {}", x, y);
|
// println!("x: {}, y: {}", x, y);
|
||||||
/// });
|
// }
|
||||||
/// }
|
// }
|
||||||
/// ```
|
// ```
|
||||||
pub(crate) fn convert_iter_for_each_to_for(acc: &mut Assists, ctx: &AssistContext) -> Option<()> {
|
pub(crate) fn convert_iter_for_each_to_for(acc: &mut Assists, ctx: &AssistContext) -> Option<()> {
|
||||||
let method = ctx.find_node_at_offset::<ast::MethodCallExpr>()?;
|
let method = ctx.find_node_at_offset::<ast::MethodCallExpr>()?;
|
||||||
let stmt = method.syntax().parent().and_then(ast::ExprStmt::cast);
|
let stmt = method.syntax().parent().and_then(ast::ExprStmt::cast);
|
||||||
|
Loading…
Reference in New Issue
Block a user