Skip to content

Commit 0a91a54

Browse files
committed
v4
1 parent 0863024 commit 0a91a54

File tree

2 files changed

+20
-20
lines changed

2 files changed

+20
-20
lines changed

crates/ide-assists/src/handlers/convert_comment_block.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,12 +89,12 @@ fn line_to_block(acc: &mut Assists, comment: ast::Comment) -> Option<()> {
8989
// contents of each line comment when they're put into the block comment.
9090
let indentation = IndentLevel::from_token(comment.syntax());
9191

92-
let cms = comments
92+
let block_comment_body = comments
9393
.into_iter()
9494
.map(|c| line_comment_text(indentation, c))
95-
.collect::<Vec<String>>();
96-
97-
let block_comment_body = cms.into_iter().join("\n");
95+
.collect::<Vec<String>>()
96+
.into_iter()
97+
.join("\n");
9898

9999
let block_prefix =
100100
CommentKind { shape: CommentShape::Block, ..comment.kind() }.prefix();

crates/ide-assists/src/handlers/desugar_doc_comment.rs

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -55,27 +55,27 @@ pub(crate) fn desugar_doc_comment(acc: &mut Assists, ctx: &AssistContext<'_>) ->
5555
}
5656
};
5757

58-
let text = match comments {
59-
Either::Left(comment) => {
60-
let text = comment.text();
61-
text[comment.prefix().len()..(text.len() - "*/".len())]
62-
.trim()
63-
.lines()
64-
.map(|l| l.strip_prefix(&indentation).unwrap_or(l))
65-
.join("\n")
66-
}
67-
Either::Right(comments) => comments
68-
.into_iter()
69-
.map(|cm| line_comment_text(IndentLevel(0), cm))
70-
.collect::<Vec<_>>()
71-
.join("\n"),
72-
};
73-
7458
acc.add(
7559
AssistId("desugar_doc_comment", AssistKind::RefactorRewrite),
7660
"Desugar doc-comment to attribute macro",
7761
target,
7862
|edit| {
63+
let text = match comments {
64+
Either::Left(comment) => {
65+
let text = comment.text();
66+
text[comment.prefix().len()..(text.len() - "*/".len())]
67+
.trim()
68+
.lines()
69+
.map(|l| l.strip_prefix(&indentation).unwrap_or(l))
70+
.join("\n")
71+
}
72+
Either::Right(comments) => comments
73+
.into_iter()
74+
.map(|cm| line_comment_text(IndentLevel(0), cm))
75+
.collect::<Vec<_>>()
76+
.join("\n"),
77+
};
78+
7979
let hashes = "#".repeat(required_hashes(&text));
8080

8181
let prefix = match placement {

0 commit comments

Comments
 (0)