Fix msg for verbose suggestions with confusable capitalization
When encountering a verbose/multipart suggestion that has changes that are only caused by different capitalization of ASCII letters that have little differenciation, expand the message to highlight that fact (like we already do for inline suggestions). The logic to do this was already present, but implemented incorrectly.
This commit is contained in:
@@ -319,7 +319,9 @@ impl CodeSuggestion {
|
||||
// We need to keep track of the difference between the existing code and the added
|
||||
// or deleted code in order to point at the correct column *after* substitution.
|
||||
let mut acc = 0;
|
||||
let mut only_capitalization = false;
|
||||
for part in &substitution.parts {
|
||||
only_capitalization |= is_case_difference(sm, &part.snippet, part.span);
|
||||
let cur_lo = sm.lookup_char_pos(part.span.lo());
|
||||
if prev_hi.line == cur_lo.line {
|
||||
let mut count =
|
||||
@@ -392,7 +394,6 @@ impl CodeSuggestion {
|
||||
}
|
||||
}
|
||||
highlights.push(std::mem::take(&mut line_highlight));
|
||||
let only_capitalization = is_case_difference(sm, &buf, bounding_span);
|
||||
// if the replacement already ends with a newline, don't print the next line
|
||||
if !buf.ends_with('\n') {
|
||||
push_trailing(&mut buf, prev_line.as_ref(), &prev_hi, None);
|
||||
|
||||
Reference in New Issue
Block a user