Skip to content

Commit 20aecb3

Browse files
committed
Run recover_comment_removed() only if the text changed after format
1 parent c313fb1 commit 20aecb3

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/comment.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -826,7 +826,7 @@ pub fn recover_comment_removed(
826826
shape: Shape,
827827
) -> Option<String> {
828828
let snippet = context.snippet(span);
829-
if changed_comment_content(&snippet, &new) {
829+
if snippet != new && changed_comment_content(&snippet, &new) {
830830
// We missed some comments
831831
// Keep previous formatting if it satisfies the constrains
832832
wrap_str(snippet, context.config.max_width(), shape)

0 commit comments

Comments
 (0)