Unnamed repository; edit this file 'description' to name the repository.
-rw-r--r--crates/ide-assists/src/handlers/convert_comment_block.rs8
-rw-r--r--crates/ide-assists/src/handlers/desugar_doc_comment.rs32
2 files changed, 20 insertions, 20 deletions
diff --git a/crates/ide-assists/src/handlers/convert_comment_block.rs b/crates/ide-assists/src/handlers/convert_comment_block.rs
index ef914cdb2c..3f478ee7d3 100644
--- a/crates/ide-assists/src/handlers/convert_comment_block.rs
+++ b/crates/ide-assists/src/handlers/convert_comment_block.rs
@@ -89,12 +89,12 @@ fn line_to_block(acc: &mut Assists, comment: ast::Comment) -> Option<()> {
// contents of each line comment when they're put into the block comment.
let indentation = IndentLevel::from_token(comment.syntax());
- let cms = comments
+ let block_comment_body = comments
.into_iter()
.map(|c| line_comment_text(indentation, c))
- .collect::<Vec<String>>();
-
- let block_comment_body = cms.into_iter().join("\n");
+ .collect::<Vec<String>>()
+ .into_iter()
+ .join("\n");
let block_prefix =
CommentKind { shape: CommentShape::Block, ..comment.kind() }.prefix();
diff --git a/crates/ide-assists/src/handlers/desugar_doc_comment.rs b/crates/ide-assists/src/handlers/desugar_doc_comment.rs
index b7919bd150..c859e98524 100644
--- a/crates/ide-assists/src/handlers/desugar_doc_comment.rs
+++ b/crates/ide-assists/src/handlers/desugar_doc_comment.rs
@@ -55,27 +55,27 @@ pub(crate) fn desugar_doc_comment(acc: &mut Assists, ctx: &AssistContext<'_>) ->
}
};
- let text = match comments {
- Either::Left(comment) => {
- let text = comment.text();
- text[comment.prefix().len()..(text.len() - "*/".len())]
- .trim()
- .lines()
- .map(|l| l.strip_prefix(&indentation).unwrap_or(l))
- .join("\n")
- }
- Either::Right(comments) => comments
- .into_iter()
- .map(|cm| line_comment_text(IndentLevel(0), cm))
- .collect::<Vec<_>>()
- .join("\n"),
- };
-
acc.add(
AssistId("desugar_doc_comment", AssistKind::RefactorRewrite),
"Desugar doc-comment to attribute macro",
target,
|edit| {
+ let text = match comments {
+ Either::Left(comment) => {
+ let text = comment.text();
+ text[comment.prefix().len()..(text.len() - "*/".len())]
+ .trim()
+ .lines()
+ .map(|l| l.strip_prefix(&indentation).unwrap_or(l))
+ .join("\n")
+ }
+ Either::Right(comments) => comments
+ .into_iter()
+ .map(|cm| line_comment_text(IndentLevel(0), cm))
+ .collect::<Vec<_>>()
+ .join("\n"),
+ };
+
let hashes = "#".repeat(required_hashes(&text));
let prefix = match placement {