From 411607bec493ac02c6038714561b52008f097a02 Mon Sep 17 00:00:00 2001 From: klensy Date: Thu, 25 Apr 2024 13:17:29 +0300 Subject: [PATCH 1/2] tests: remove some trailing ws --- compiler/rustc_errors/src/emitter.rs | 16 ++++++++++++--- .../huge_multispan_highlight.svg | 20 +++++++++---------- tests/ui/error-emitter/highlighting.svg | 10 +++++----- .../ui/error-emitter/highlighting.windows.svg | 10 +++++----- .../multiline-multipart-suggestion.svg | 10 +++++----- ...multiline-multipart-suggestion.windows.svg | 10 +++++----- tests/ui/imports/issue-59764.stderr | 4 ++-- tests/ui/issues/issue-22644.stderr | 4 ++-- tests/ui/lint/use_suggestion_json.stderr | 2 +- tests/ui/macros/issue-118048.stderr | 2 +- tests/ui/methods/method-call-err-msg.stderr | 2 +- tests/ui/str/str-escape.stderr | 4 ++-- .../struct-rec/issue-17431-2.stderr | 2 +- .../struct-rec/mutual-struct-recursion.stderr | 4 ++-- tests/ui/suggestions/issue-99240-2.stderr | 2 +- tests/ui/typeck/issue-100285.stderr | 2 +- tests/ui/typeck/issue-31173.stderr | 2 +- ...oxed-closure-sugar-lifetime-elision.stderr | 2 +- .../variance-regions-unused-indirect.stderr | 2 +- 19 files changed, 60 insertions(+), 50 deletions(-) diff --git a/compiler/rustc_errors/src/emitter.rs b/compiler/rustc_errors/src/emitter.rs index 6ce3fa3535dc9..74852ba36985a 100644 --- a/compiler/rustc_errors/src/emitter.rs +++ b/compiler/rustc_errors/src/emitter.rs @@ -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 @@ -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( + *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); diff --git a/tests/ui/codemap_tests/huge_multispan_highlight.svg b/tests/ui/codemap_tests/huge_multispan_highlight.svg index f1e96583ff062..7b6dbb17c6f95 100644 --- a/tests/ui/codemap_tests/huge_multispan_highlight.svg +++ b/tests/ui/codemap_tests/huge_multispan_highlight.svg @@ -27,11 +27,11 @@ LL | let _ = match true { - | ---------- `match` arms have incompatible types + | ---------- `match` arms have incompatible types LL | true => ( - | _________________- + | _________________- LL | | // last line shown in multispan header @@ -41,11 +41,11 @@ LL | | ), - | |_________- this is found to be of type `()` + | |_________- this is found to be of type `()` LL | false => " - | __________________^ + | __________________^ ... | @@ -53,7 +53,7 @@ LL | | ", - | |_________^ expected `()`, found `&str` + | |_________^ expected `()`, found `&str` @@ -65,11 +65,11 @@ LL | let _ = match true { - | ---------- `match` arms have incompatible types + | ---------- `match` arms have incompatible types LL | true => ( - | _________________- + | _________________- LL | | @@ -81,11 +81,11 @@ LL | | ), - | |_________- this is found to be of type `{integer}` + | |_________- this is found to be of type `{integer}` LL | false => " - | __________________^ + | __________________^ LL | | @@ -99,7 +99,7 @@ LL | | ", - | |_________^ expected integer, found `&str` + | |_________^ expected integer, found `&str` diff --git a/tests/ui/error-emitter/highlighting.svg b/tests/ui/error-emitter/highlighting.svg index 1d82a97888ae0..be92c00c19bdc 100644 --- a/tests/ui/error-emitter/highlighting.svg +++ b/tests/ui/error-emitter/highlighting.svg @@ -29,11 +29,11 @@ LL | query(wrapped_fn); - | ----- ^^^^^^^^^^ one type is more general than the other + | ----- ^^^^^^^^^^ one type is more general than the other - | | + | | - | arguments to this function are incorrect + | arguments to this function are incorrect | @@ -49,13 +49,13 @@ LL | fn query(_: fn(Box<(dyn Any + Send + '_)>) -> Pin<Box<( - | ____^^^^^_- + | ____^^^^^_- LL | | dyn Future<Output = Result<Box<(dyn Any + 'static)>, String>> + Send + 'static LL | | )>>) {} - | |___- + | |___- diff --git a/tests/ui/error-emitter/highlighting.windows.svg b/tests/ui/error-emitter/highlighting.windows.svg index 88143f725a5bb..152245da9ddc1 100644 --- a/tests/ui/error-emitter/highlighting.windows.svg +++ b/tests/ui/error-emitter/highlighting.windows.svg @@ -30,11 +30,11 @@ LL | query(wrapped_fn); - | ----- ^^^^^^^^^^ one type is more general than the other + | ----- ^^^^^^^^^^ one type is more general than the other - | | + | | - | arguments to this function are incorrect + | arguments to this function are incorrect | @@ -50,13 +50,13 @@ LL | fn query(_: fn(Box<(dyn Any + Send + '_)>) -> Pin<Box<( - | ____^^^^^_- + | ____^^^^^_- LL | | dyn Future<Output = Result<Box<(dyn Any + 'static)>, String>> + Send + 'static LL | | )>>) {} - | |___- + | |___- diff --git a/tests/ui/error-emitter/multiline-multipart-suggestion.svg b/tests/ui/error-emitter/multiline-multipart-suggestion.svg index 26210fade74c8..c0fb98555ad86 100644 --- a/tests/ui/error-emitter/multiline-multipart-suggestion.svg +++ b/tests/ui/error-emitter/multiline-multipart-suggestion.svg @@ -29,7 +29,7 @@ LL | fn short(foo_bar: &Vec<&i32>) -> &i32 { - | ---------- ^ expected named lifetime parameter + | ---------- ^ expected named lifetime parameter | @@ -53,13 +53,13 @@ LL | foo_bar: &Vec<&i32>, - | ---------- + | ---------- LL | something_very_long_so_that_the_line_will_wrap_around__________: i32, LL | ) -> &i32 { - | ^ expected named lifetime parameter + | ^ expected named lifetime parameter | @@ -73,7 +73,7 @@ LL ~ foo_bar: &'a Vec<&'a i32>, - LL | something_very_long_so_that_the_line_will_wrap_around__________: i32, + LL | something_very_long_so_that_the_line_will_wrap_around__________: i32, LL ~ ) -> &'a i32 { @@ -89,7 +89,7 @@ LL | foo_bar: &Vec<&i32>) -> &i32 { - | ---------- ^ expected named lifetime parameter + | ---------- ^ expected named lifetime parameter | diff --git a/tests/ui/error-emitter/multiline-multipart-suggestion.windows.svg b/tests/ui/error-emitter/multiline-multipart-suggestion.windows.svg index 3fa9cc18f0de8..61b544001f08c 100644 --- a/tests/ui/error-emitter/multiline-multipart-suggestion.windows.svg +++ b/tests/ui/error-emitter/multiline-multipart-suggestion.windows.svg @@ -29,7 +29,7 @@ LL | fn short(foo_bar: &Vec<&i32>) -> &i32 { - | ---------- ^ expected named lifetime parameter + | ---------- ^ expected named lifetime parameter | @@ -53,13 +53,13 @@ LL | foo_bar: &Vec<&i32>, - | ---------- + | ---------- LL | something_very_long_so_that_the_line_will_wrap_around__________: i32, LL | ) -> &i32 { - | ^ expected named lifetime parameter + | ^ expected named lifetime parameter | @@ -73,7 +73,7 @@ LL ~ foo_bar: &'a Vec<&'a i32>, - LL | something_very_long_so_that_the_line_will_wrap_around__________: i32, + LL | something_very_long_so_that_the_line_will_wrap_around__________: i32, LL ~ ) -> &'a i32 { @@ -89,7 +89,7 @@ LL | foo_bar: &Vec<&i32>) -> &i32 { - | ---------- ^ expected named lifetime parameter + | ---------- ^ expected named lifetime parameter | diff --git a/tests/ui/imports/issue-59764.stderr b/tests/ui/imports/issue-59764.stderr index fe58eb97b8dbf..293c2a60d8033 100644 --- a/tests/ui/imports/issue-59764.stderr +++ b/tests/ui/imports/issue-59764.stderr @@ -208,9 +208,9 @@ LL | makro as foobar} help: a macro with this name exists at the root of the crate | LL ~ issue_59764::{makro as foobar, -LL | +LL | ... -LL | +LL | LL ~ foo::{baz} | diff --git a/tests/ui/issues/issue-22644.stderr b/tests/ui/issues/issue-22644.stderr index 0799e9ef11b14..7d8a0ff170a59 100644 --- a/tests/ui/issues/issue-22644.stderr +++ b/tests/ui/issues/issue-22644.stderr @@ -63,9 +63,9 @@ LL | 5); help: try comparing the cast value | LL ~ println!("{}", (a -LL | +LL | ... -LL | +LL | LL ~ usize) | diff --git a/tests/ui/lint/use_suggestion_json.stderr b/tests/ui/lint/use_suggestion_json.stderr index 16fb1682d4a69..acc36550642d6 100644 --- a/tests/ui/lint/use_suggestion_json.stderr +++ b/tests/ui/lint/use_suggestion_json.stderr @@ -384,7 +384,7 @@ mod foo { \u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m--> \u001b[0m\u001b[0m$DIR/use_suggestion_json.rs:12:12\u001b[0m \u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m \u001b[0m\u001b[1m\u001b[38;5;12mLL\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\u001b[0m \u001b[0m\u001b[0m let x: Iter;\u001b[0m -\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m| \u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;9m^^^^\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;9mnot found in this scope\u001b[0m +\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;9m^^^^\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;9mnot found in this scope\u001b[0m \u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m \u001b[0m\u001b[1m\u001b[38;5;14mhelp\u001b[0m\u001b[0m: consider importing one of these items\u001b[0m \u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m diff --git a/tests/ui/macros/issue-118048.stderr b/tests/ui/macros/issue-118048.stderr index 6acf78f63b2bd..4dc5ef71fec69 100644 --- a/tests/ui/macros/issue-118048.stderr +++ b/tests/ui/macros/issue-118048.stderr @@ -12,7 +12,7 @@ help: use type parameters instead LL ~ fn foo(_: $ty, _: $ty) {} LL | } LL | } -LL | +LL | LL ~ foo!(T); | diff --git a/tests/ui/methods/method-call-err-msg.stderr b/tests/ui/methods/method-call-err-msg.stderr index 7d9b38fb29b5f..5a76449e9f95b 100644 --- a/tests/ui/methods/method-call-err-msg.stderr +++ b/tests/ui/methods/method-call-err-msg.stderr @@ -55,7 +55,7 @@ LL | / y.zero() LL | | .take() | | -^^^^ `Foo` is not an iterator | |______| - | + | | = note: the following trait bounds were not satisfied: `Foo: Iterator` diff --git a/tests/ui/str/str-escape.stderr b/tests/ui/str/str-escape.stderr index 00fe5444e1a4e..c4aee2a110a5b 100644 --- a/tests/ui/str/str-escape.stderr +++ b/tests/ui/str/str-escape.stderr @@ -15,7 +15,7 @@ LL | let s = c"foo\ LL | |   bar | | ^ whitespace symbol '\u{a0}' is not skipped | |___| - | + | warning: whitespace symbol '\u{c}' is not skipped --> $DIR/str-escape.rs:26:16 @@ -25,7 +25,7 @@ LL | let s = b"a\ LL | | b"; | | ^- whitespace symbol '\u{c}' is not skipped | |____| - | + | warning: 3 warnings emitted diff --git a/tests/ui/structs-enums/struct-rec/issue-17431-2.stderr b/tests/ui/structs-enums/struct-rec/issue-17431-2.stderr index cdf51632acd0e..e818409366d6a 100644 --- a/tests/ui/structs-enums/struct-rec/issue-17431-2.stderr +++ b/tests/ui/structs-enums/struct-rec/issue-17431-2.stderr @@ -11,7 +11,7 @@ help: insert some indirection (e.g., a `Box`, `Rc`, or `&`) to break the cycle | LL ~ struct Baz { q: Option> } LL | -LL | +LL | LL ~ struct Foo { q: Option> } | diff --git a/tests/ui/structs-enums/struct-rec/mutual-struct-recursion.stderr b/tests/ui/structs-enums/struct-rec/mutual-struct-recursion.stderr index 881bc2819369b..afe523939acd2 100644 --- a/tests/ui/structs-enums/struct-rec/mutual-struct-recursion.stderr +++ b/tests/ui/structs-enums/struct-rec/mutual-struct-recursion.stderr @@ -16,7 +16,7 @@ help: insert some indirection (e.g., a `Box`, `Rc`, or `&`) to break the cycle | LL ~ y: Box>, LL | } -LL | +LL | LL | struct B { LL ~ z: Box> | @@ -39,7 +39,7 @@ help: insert some indirection (e.g., a `Box`, `Rc`, or `&`) to break the cycle | LL ~ y: Option>>>, LL | } -LL | +LL | LL | struct D { LL ~ z: Option>>>, | diff --git a/tests/ui/suggestions/issue-99240-2.stderr b/tests/ui/suggestions/issue-99240-2.stderr index 00bffee652938..5b86bc9880f6a 100644 --- a/tests/ui/suggestions/issue-99240-2.stderr +++ b/tests/ui/suggestions/issue-99240-2.stderr @@ -8,7 +8,7 @@ LL | // Alias:: LL | || Unit(); | ||________^_- call expression requires function | |________| - | + | | help: `Alias::Unit` is a unit enum variant, and does not take parentheses to be constructed | diff --git a/tests/ui/typeck/issue-100285.stderr b/tests/ui/typeck/issue-100285.stderr index 9c8685a77127b..c0deb63af59ac 100644 --- a/tests/ui/typeck/issue-100285.stderr +++ b/tests/ui/typeck/issue-100285.stderr @@ -49,7 +49,7 @@ LL ~ return Some(4); LL | } else { LL ~ return Some(5); LL | } -LL | +LL | LL ~ } LL ~ None | diff --git a/tests/ui/typeck/issue-31173.stderr b/tests/ui/typeck/issue-31173.stderr index 0983147a5f0c5..9598bc61352fd 100644 --- a/tests/ui/typeck/issue-31173.stderr +++ b/tests/ui/typeck/issue-31173.stderr @@ -34,7 +34,7 @@ LL | | .cloned() LL | | .collect(); | | -^^^^^^^ method cannot be called due to unsatisfied trait bounds | |_________| - | + | | = note: the following trait bounds were not satisfied: `, {closure@$DIR/issue-31173.rs:7:21: 7:25}> as Iterator>::Item = &_` diff --git a/tests/ui/unboxed-closures/unboxed-closure-sugar-lifetime-elision.stderr b/tests/ui/unboxed-closures/unboxed-closure-sugar-lifetime-elision.stderr index b7e9e1baa7bb4..c0fce5c2aaadc 100644 --- a/tests/ui/unboxed-closures/unboxed-closure-sugar-lifetime-elision.stderr +++ b/tests/ui/unboxed-closures/unboxed-closure-sugar-lifetime-elision.stderr @@ -15,7 +15,7 @@ help: consider introducing a named lifetime parameter LL ~ fn main<'a>() { LL | eq::< dyn for<'a> Foo<(&'a isize,), Output=&'a isize>, ... -LL | +LL | LL ~ let _: dyn Foo(&'a isize, &'a usize) -> &'a usize; | diff --git a/tests/ui/variance/variance-regions-unused-indirect.stderr b/tests/ui/variance/variance-regions-unused-indirect.stderr index ec4d480baab78..8cdbb3c0f5ebd 100644 --- a/tests/ui/variance/variance-regions-unused-indirect.stderr +++ b/tests/ui/variance/variance-regions-unused-indirect.stderr @@ -16,7 +16,7 @@ help: insert some indirection (e.g., a `Box`, `Rc`, or `&`) to break the cycle | LL ~ Foo1(Box>) LL | } -LL | +LL | LL | enum Bar<'a> { LL ~ Bar1(Box>) | From ce48c60c99c33f6df9d2fe6c9e943da4be68f370 Mon Sep 17 00:00:00 2001 From: klensy Date: Fri, 26 Apr 2024 13:47:14 +0300 Subject: [PATCH 2/2] clippy: bless tests --- src/tools/clippy/tests/ui/from_over_into.stderr | 2 +- src/tools/clippy/tests/ui/let_and_return.stderr | 2 +- src/tools/clippy/tests/ui/manual_strip.stderr | 4 ++-- src/tools/clippy/tests/ui/result_map_unit_fn_unfixable.stderr | 2 +- src/tools/clippy/tests/ui/suspicious_doc_comments.stderr | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/tools/clippy/tests/ui/from_over_into.stderr b/src/tools/clippy/tests/ui/from_over_into.stderr index 0649a6cb0f3ec..f913ae0bb5067 100644 --- a/src/tools/clippy/tests/ui/from_over_into.stderr +++ b/src/tools/clippy/tests/ui/from_over_into.stderr @@ -54,7 +54,7 @@ help: replace the `Into` implementation with `From` LL ~ impl core::convert::From 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 | diff --git a/src/tools/clippy/tests/ui/let_and_return.stderr b/src/tools/clippy/tests/ui/let_and_return.stderr index f614a5739a860..ff5962ec196e6 100644 --- a/src/tools/clippy/tests/ui/let_and_return.stderr +++ b/src/tools/clippy/tests/ui/let_and_return.stderr @@ -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, diff --git a/src/tools/clippy/tests/ui/manual_strip.stderr b/src/tools/clippy/tests/ui/manual_strip.stderr index d2d4f765310b9..a70c988a0549e 100644 --- a/src/tools/clippy/tests/ui/manual_strip.stderr +++ b/src/tools/clippy/tests/ui/manual_strip.stderr @@ -17,7 +17,7 @@ LL ~ if let Some() = s.strip_prefix("ab") { LL ~ str::to_string(); LL | LL ~ .to_string(); -LL | +LL | LL ~ str::to_string(); LL ~ .to_string(); | @@ -39,7 +39,7 @@ LL ~ if let Some() = s.strip_suffix("bc") { LL ~ str::to_string(); LL | LL ~ .to_string(); -LL | +LL | LL ~ str::to_string(); LL ~ .to_string(); | diff --git a/src/tools/clippy/tests/ui/result_map_unit_fn_unfixable.stderr b/src/tools/clippy/tests/ui/result_map_unit_fn_unfixable.stderr index fa2ac7a1b37e8..d69c86c70e291 100644 --- a/src/tools/clippy/tests/ui/result_map_unit_fn_unfixable.stderr +++ b/src/tools/clippy/tests/ui/result_map_unit_fn_unfixable.stderr @@ -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 diff --git a/src/tools/clippy/tests/ui/suspicious_doc_comments.stderr b/src/tools/clippy/tests/ui/suspicious_doc_comments.stderr index b54309b44d5d8..f12053b1595a1 100644 --- a/src/tools/clippy/tests/ui/suspicious_doc_comments.stderr +++ b/src/tools/clippy/tests/ui/suspicious_doc_comments.stderr @@ -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 |