Skip to content
This repository was archived by the owner on Dec 29, 2022. It is now read-only.

Commit 3a0079a

Browse files
authored
Merge pull request #1742 from camelid/empty-sugg
Only show suggested code when it is non-empty
2 parents bbb8da2 + 437799e commit 3a0079a

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

rls/src/actions/diagnostics.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,11 @@ fn format_notes(children: &[AssociatedMessage], primary: &DiagnosticSpan) -> Opt
175175
} else if spans.len() == 1 && spans[0].is_within(primary) {
176176
add_message_to_notes!(message);
177177
if let Some(ref suggested) = spans[0].suggested_replacement {
178-
notes.push_str(&format!(": `{}`", suggested));
178+
if !suggested.is_empty() {
179+
// Only show the suggestion when it is non-empty.
180+
// This matches rustc's behavior.
181+
notes.push_str(&format!(": `{}`", suggested));
182+
}
179183
}
180184
}
181185
}

0 commit comments

Comments
 (0)