let indent_spaces = indentation.to_string();
let output = lines
- .map(|l| l.trim_start_matches(&indent_spaces))
- .map(|l| {
+ .map(|line| {
+ let line = line.trim_start_matches(&indent_spaces);
+
// Don't introduce trailing whitespace
- if l.is_empty() {
+ if line.is_empty() {
line_prefix.to_string()
} else {
- format!("{} {}", line_prefix, l.trim_start_matches(&indent_spaces))
+ format!("{line_prefix} {line}")
}
})
- .join(&format!("\n{}", indent_spaces));
+ .join(&format!("\n{indent_spaces}"));
edit.replace(target, output)
},
let block_prefix =
CommentKind { shape: CommentShape::Block, ..comment.kind() }.prefix();
- let output = format!("{}\n{}\n{}*/", block_prefix, block_comment_body, indentation);
+ let output = format!("{block_prefix}\n{block_comment_body}\n{indentation}*/");
edit.replace(target, output)
},