Skip to content

tests: remove some trailing ws #124398

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions compiler/rustc_errors/src/emitter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -984,7 +984,7 @@ impl HumanEmitter {
// 4 | }
// |
for pos in 0..=line_len {
draw_col_separator(buffer, line_offset + pos + 1, width_offset - 2);
draw_col_separator_no_space(buffer, line_offset + pos + 1, width_offset - 2);
}

// Write the horizontal lines for multiline annotations
Expand Down Expand Up @@ -2260,13 +2260,23 @@ impl HumanEmitter {
buffer.puts(*row_num, max_line_num_len + 1, "+ ", Style::Addition);
}
[] => {
draw_col_separator(buffer, *row_num, max_line_num_len + 1);
draw_col_separator_no_space(buffer, *row_num, max_line_num_len + 1);
}
_ => {
buffer.puts(*row_num, max_line_num_len + 1, "~ ", Style::Addition);
}
}
buffer.append(*row_num, &normalize_whitespace(line_to_add), Style::NoStyle);
// LL | line_to_add
// ++^^^
// | |
// | magic `3`
// `max_line_num_len`
buffer.puts(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the difference here (specifically, why do we need + 3)? Would be worth adding comments explaining a lot of the logic for the + Ns in this function.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added explanation for that changed part.

*row_num,
max_line_num_len + 3,
&normalize_whitespace(line_to_add),
Style::NoStyle,
);
} else if let DisplaySuggestion::Add = show_code_change {
buffer.puts(*row_num, 0, &self.maybe_anonymized(line_num), Style::LineNumber);
buffer.puts(*row_num, max_line_num_len + 1, "+ ", Style::Addition);
Expand Down
2 changes: 1 addition & 1 deletion src/tools/clippy/tests/ui/from_over_into.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ help: replace the `Into` implementation with `From<ExplicitPaths>`
LL ~ impl core::convert::From<crate::ExplicitPaths> for bool {
LL ~ fn from(mut val: crate::ExplicitPaths) -> Self {
LL ~ let in_closure = || val.0;
LL |
LL |
LL ~ val.0 = false;
LL ~ val.0
|
Expand Down
2 changes: 1 addition & 1 deletion src/tools/clippy/tests/ui/let_and_return.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ LL | result
help: return the expression directly
|
LL ~
LL |
LL |
LL ~ (match self {
LL + E::A(x) => x,
LL + E::B(x) => x,
Expand Down
4 changes: 2 additions & 2 deletions src/tools/clippy/tests/ui/manual_strip.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ LL ~ if let Some(<stripped>) = s.strip_prefix("ab") {
LL ~ str::to_string(<stripped>);
LL |
LL ~ <stripped>.to_string();
LL |
LL |
LL ~ str::to_string(<stripped>);
LL ~ <stripped>.to_string();
|
Expand All @@ -39,7 +39,7 @@ LL ~ if let Some(<stripped>) = s.strip_suffix("bc") {
LL ~ str::to_string(<stripped>);
LL |
LL ~ <stripped>.to_string();
LL |
LL |
LL ~ str::to_string(<stripped>);
LL ~ <stripped>.to_string();
|
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ LL | || do_nothing(value)
LL | || });
| ||______^- help: try: `if let Ok(value) = x.field { ... }`
| |______|
|
|

error: called `map(f)` on an `Result` value where `f` is a closure that returns the unit type `()`
--> tests/ui/result_map_unit_fn_unfixable.rs:37:5
Expand Down
2 changes: 1 addition & 1 deletion src/tools/clippy/tests/ui/suspicious_doc_comments.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ LL | | ///! b
help: use an inner doc comment to document the parent module or crate
|
LL ~ //! a
LL |
LL |
LL ~ //! b
|

Expand Down
20 changes: 10 additions & 10 deletions tests/ui/codemap_tests/huge_multispan_highlight.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 5 additions & 5 deletions tests/ui/error-emitter/highlighting.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 5 additions & 5 deletions tests/ui/error-emitter/highlighting.windows.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading