about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEsteban Küber <esteban@kuber.com.ar>2024-07-05 19:40:09 +0000
committerEsteban Küber <esteban@kuber.com.ar>2024-07-05 19:40:09 +0000
commit8e9a3661a8ec7078f480f21f1dfe4b07d31e4c79 (patch)
tree082e40188f8934c940e5db4308f5db01b5fca36c
parentc4225812973cee4bba952cbf7a421f69871fed0d (diff)
downloadrust-8e9a3661a8ec7078f480f21f1dfe4b07d31e4c79.tar.gz
rust-8e9a3661a8ec7078f480f21f1dfe4b07d31e4c79.zip
Use verbose style for argument removal suggestion
-rw-r--r--compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs2
-rw-r--r--tests/ui/argument-suggestions/basic.stderr10
-rw-r--r--tests/ui/argument-suggestions/exotic-calls.stderr40
-rw-r--r--tests/ui/argument-suggestions/extra_arguments.stderr169
-rw-r--r--tests/ui/argument-suggestions/suggest-better-removing-issue-126246.stderr60
-rw-r--r--tests/ui/error-codes/E0057.stderr10
-rw-r--r--tests/ui/impl-trait/opaque-used-in-extraneous-argument.stderr20
-rw-r--r--tests/ui/inference/ice-ifer-var-leaked-out-of-rollback-122098.stderr10
-rw-r--r--tests/ui/issues/issue-16939.stderr10
-rw-r--r--tests/ui/issues/issue-4935.stderr10
-rw-r--r--tests/ui/methods/method-call-err-msg.stderr10
-rw-r--r--tests/ui/resolve/resolve-primitive-fallback.stderr10
-rw-r--r--tests/ui/span/issue-34264.stderr20
-rw-r--r--tests/ui/tuple/wrong_argument_ice-4.stderr13
-rw-r--r--tests/ui/type/type-ascription-instead-of-initializer.stderr10
-rw-r--r--tests/ui/typeck/remove-extra-argument.stderr10
-rw-r--r--tests/ui/typeck/struct-enum-wrong-args.stderr30
17 files changed, 264 insertions, 180 deletions
diff --git a/compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs b/compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs
index 56dff080867..047d0850d4c 100644
--- a/compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs
+++ b/compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs
@@ -1384,7 +1384,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
                 Some(format!("provide the argument{}", if plural { "s" } else { "" }))
             }
             SuggestionText::Remove(plural) => {
-                err.multipart_suggestion(
+                err.multipart_suggestion_verbose(
                     format!("remove the extra argument{}", if plural { "s" } else { "" }),
                     suggestions,
                     Applicability::HasPlaceholders,
diff --git a/tests/ui/argument-suggestions/basic.stderr b/tests/ui/argument-suggestions/basic.stderr
index c74186285f9..ea58ca97cfa 100644
--- a/tests/ui/argument-suggestions/basic.stderr
+++ b/tests/ui/argument-suggestions/basic.stderr
@@ -16,16 +16,18 @@ error[E0061]: this function takes 0 arguments but 1 argument was supplied
   --> $DIR/basic.rs:21:5
    |
 LL |     extra("");
-   |     ^^^^^ --
-   |           |
-   |           unexpected argument of type `&'static str`
-   |           help: remove the extra argument
+   |     ^^^^^ -- unexpected argument of type `&'static str`
    |
 note: function defined here
   --> $DIR/basic.rs:14:4
    |
 LL | fn extra() {}
    |    ^^^^^
+help: remove the extra argument
+   |
+LL -     extra("");
+LL +     extra();
+   |
 
 error[E0061]: this function takes 1 argument but 0 arguments were supplied
   --> $DIR/basic.rs:22:5
diff --git a/tests/ui/argument-suggestions/exotic-calls.stderr b/tests/ui/argument-suggestions/exotic-calls.stderr
index ff795b507f2..aca3b8a3433 100644
--- a/tests/ui/argument-suggestions/exotic-calls.stderr
+++ b/tests/ui/argument-suggestions/exotic-calls.stderr
@@ -2,61 +2,69 @@ error[E0057]: this function takes 0 arguments but 1 argument was supplied
   --> $DIR/exotic-calls.rs:2:5
    |
 LL |     t(1i32);
-   |     ^ ----
-   |       |
-   |       unexpected argument of type `i32`
-   |       help: remove the extra argument
+   |     ^ ---- unexpected argument of type `i32`
    |
 note: callable defined here
   --> $DIR/exotic-calls.rs:1:11
    |
 LL | fn foo<T: Fn()>(t: T) {
    |           ^^^^
+help: remove the extra argument
+   |
+LL -     t(1i32);
+LL +     t();
+   |
 
 error[E0057]: this function takes 0 arguments but 1 argument was supplied
   --> $DIR/exotic-calls.rs:7:5
    |
 LL |     t(1i32);
-   |     ^ ----
-   |       |
-   |       unexpected argument of type `i32`
-   |       help: remove the extra argument
+   |     ^ ---- unexpected argument of type `i32`
    |
 note: type parameter defined here
   --> $DIR/exotic-calls.rs:6:11
    |
 LL | fn bar(t: impl Fn()) {
    |           ^^^^^^^^^
+help: remove the extra argument
+   |
+LL -     t(1i32);
+LL +     t();
+   |
 
 error[E0057]: this function takes 0 arguments but 1 argument was supplied
   --> $DIR/exotic-calls.rs:16:5
    |
 LL |     baz()(1i32)
-   |     ^^^^^ ----
-   |           |
-   |           unexpected argument of type `i32`
-   |           help: remove the extra argument
+   |     ^^^^^ ---- unexpected argument of type `i32`
    |
 note: opaque type defined here
   --> $DIR/exotic-calls.rs:11:13
    |
 LL | fn baz() -> impl Fn() {
    |             ^^^^^^^^^
+help: remove the extra argument
+   |
+LL -     baz()(1i32)
+LL +     baz()()
+   |
 
 error[E0057]: this function takes 0 arguments but 1 argument was supplied
   --> $DIR/exotic-calls.rs:22:5
    |
 LL |     x(1i32);
-   |     ^ ----
-   |       |
-   |       unexpected argument of type `i32`
-   |       help: remove the extra argument
+   |     ^ ---- unexpected argument of type `i32`
    |
 note: closure defined here
   --> $DIR/exotic-calls.rs:21:13
    |
 LL |     let x = || {};
    |             ^^
+help: remove the extra argument
+   |
+LL -     x(1i32);
+LL +     x();
+   |
 
 error: aborting due to 4 previous errors
 
diff --git a/tests/ui/argument-suggestions/extra_arguments.stderr b/tests/ui/argument-suggestions/extra_arguments.stderr
index 5ad8e35920a..dec3da75186 100644
--- a/tests/ui/argument-suggestions/extra_arguments.stderr
+++ b/tests/ui/argument-suggestions/extra_arguments.stderr
@@ -2,16 +2,18 @@ error[E0061]: this function takes 0 arguments but 1 argument was supplied
   --> $DIR/extra_arguments.rs:19:3
    |
 LL |   empty("");
-   |   ^^^^^ --
-   |         |
-   |         unexpected argument of type `&'static str`
-   |         help: remove the extra argument
+   |   ^^^^^ -- unexpected argument of type `&'static str`
    |
 note: function defined here
   --> $DIR/extra_arguments.rs:1:4
    |
 LL | fn empty() {}
    |    ^^^^^
+help: remove the extra argument
+   |
+LL -   empty("");
+LL +   empty();
+   |
 
 error[E0061]: this function takes 0 arguments but 2 arguments were supplied
   --> $DIR/extra_arguments.rs:20:3
@@ -36,31 +38,35 @@ error[E0061]: this function takes 1 argument but 2 arguments were supplied
   --> $DIR/extra_arguments.rs:22:3
    |
 LL |   one_arg(1, 1);
-   |   ^^^^^^^  ---
-   |            | |
-   |            | unexpected argument of type `{integer}`
-   |            help: remove the extra argument
+   |   ^^^^^^^    - unexpected argument of type `{integer}`
    |
 note: function defined here
   --> $DIR/extra_arguments.rs:2:4
    |
 LL | fn one_arg<T>(_a: T) {}
    |    ^^^^^^^    -----
+help: remove the extra argument
+   |
+LL -   one_arg(1, 1);
+LL +   one_arg(1);
+   |
 
 error[E0061]: this function takes 1 argument but 2 arguments were supplied
   --> $DIR/extra_arguments.rs:23:3
    |
 LL |   one_arg(1, "");
-   |   ^^^^^^^  ----
-   |            | |
-   |            | unexpected argument of type `&'static str`
-   |            help: remove the extra argument
+   |   ^^^^^^^    -- unexpected argument of type `&'static str`
    |
 note: function defined here
   --> $DIR/extra_arguments.rs:2:4
    |
 LL | fn one_arg<T>(_a: T) {}
    |    ^^^^^^^    -----
+help: remove the extra argument
+   |
+LL -   one_arg(1, "");
+LL +   one_arg(1);
+   |
 
 error[E0061]: this function takes 1 argument but 3 arguments were supplied
   --> $DIR/extra_arguments.rs:24:3
@@ -85,61 +91,69 @@ error[E0061]: this function takes 2 arguments but 3 arguments were supplied
   --> $DIR/extra_arguments.rs:26:3
    |
 LL |   two_arg_same(1, 1, 1);
-   |   ^^^^^^^^^^^^     ---
-   |                    | |
-   |                    | unexpected argument of type `{integer}`
-   |                    help: remove the extra argument
+   |   ^^^^^^^^^^^^       - unexpected argument of type `{integer}`
    |
 note: function defined here
   --> $DIR/extra_arguments.rs:3:4
    |
 LL | fn two_arg_same(_a: i32, _b: i32) {}
    |    ^^^^^^^^^^^^ -------  -------
+help: remove the extra argument
+   |
+LL -   two_arg_same(1, 1, 1);
+LL +   two_arg_same(1, 1);
+   |
 
 error[E0061]: this function takes 2 arguments but 3 arguments were supplied
   --> $DIR/extra_arguments.rs:27:3
    |
 LL |   two_arg_same(1, 1, 1.0);
-   |   ^^^^^^^^^^^^     -----
-   |                    | |
-   |                    | unexpected argument of type `{float}`
-   |                    help: remove the extra argument
+   |   ^^^^^^^^^^^^       --- unexpected argument of type `{float}`
    |
 note: function defined here
   --> $DIR/extra_arguments.rs:3:4
    |
 LL | fn two_arg_same(_a: i32, _b: i32) {}
    |    ^^^^^^^^^^^^ -------  -------
+help: remove the extra argument
+   |
+LL -   two_arg_same(1, 1, 1.0);
+LL +   two_arg_same(1, 1);
+   |
 
 error[E0061]: this function takes 2 arguments but 3 arguments were supplied
   --> $DIR/extra_arguments.rs:29:3
    |
 LL |   two_arg_diff(1, 1, "");
-   |   ^^^^^^^^^^^^  ---
-   |                 | |
-   |                 | unexpected argument of type `{integer}`
-   |                 help: remove the extra argument
+   |   ^^^^^^^^^^^^    - unexpected argument of type `{integer}`
    |
 note: function defined here
   --> $DIR/extra_arguments.rs:4:4
    |
 LL | fn two_arg_diff(_a: i32, _b: &str) {}
    |    ^^^^^^^^^^^^ -------  --------
+help: remove the extra argument
+   |
+LL -   two_arg_diff(1, 1, "");
+LL +   two_arg_diff(1, "");
+   |
 
 error[E0061]: this function takes 2 arguments but 3 arguments were supplied
   --> $DIR/extra_arguments.rs:30:3
    |
 LL |   two_arg_diff(1, "", "");
-   |   ^^^^^^^^^^^^      ----
-   |                     | |
-   |                     | unexpected argument of type `&'static str`
-   |                     help: remove the extra argument
+   |   ^^^^^^^^^^^^        -- unexpected argument of type `&'static str`
    |
 note: function defined here
   --> $DIR/extra_arguments.rs:4:4
    |
 LL | fn two_arg_diff(_a: i32, _b: &str) {}
    |    ^^^^^^^^^^^^ -------  --------
+help: remove the extra argument
+   |
+LL -   two_arg_diff(1, "", "");
+LL +   two_arg_diff(1, "");
+   |
 
 error[E0061]: this function takes 2 arguments but 4 arguments were supplied
   --> $DIR/extra_arguments.rs:31:3
@@ -183,70 +197,75 @@ error[E0061]: this function takes 2 arguments but 3 arguments were supplied
   --> $DIR/extra_arguments.rs:35:3
    |
 LL |   two_arg_same(1, 1,     "");
-   |   ^^^^^^^^^^^^     --------
-   |                    |     |
-   |                    |     unexpected argument of type `&'static str`
-   |                    help: remove the extra argument
+   |   ^^^^^^^^^^^^           -- unexpected argument of type `&'static str`
    |
 note: function defined here
   --> $DIR/extra_arguments.rs:3:4
    |
 LL | fn two_arg_same(_a: i32, _b: i32) {}
    |    ^^^^^^^^^^^^ -------  -------
+help: remove the extra argument
+   |
+LL -   two_arg_same(1, 1,     "");
+LL +   two_arg_same(1, 1);
+   |
 
 error[E0061]: this function takes 2 arguments but 3 arguments were supplied
   --> $DIR/extra_arguments.rs:36:3
    |
 LL |   two_arg_diff(1, 1,     "");
-   |   ^^^^^^^^^^^^  ---
-   |                 | |
-   |                 | unexpected argument of type `{integer}`
-   |                 help: remove the extra argument
+   |   ^^^^^^^^^^^^    - unexpected argument of type `{integer}`
    |
 note: function defined here
   --> $DIR/extra_arguments.rs:4:4
    |
 LL | fn two_arg_diff(_a: i32, _b: &str) {}
    |    ^^^^^^^^^^^^ -------  --------
+help: remove the extra argument
+   |
+LL -   two_arg_diff(1, 1,     "");
+LL +   two_arg_diff(1,     "");
+   |
 
 error[E0061]: this function takes 2 arguments but 3 arguments were supplied
   --> $DIR/extra_arguments.rs:37:3
    |
-LL |     two_arg_same(
-   |     ^^^^^^^^^^^^
-LL |       1,
-LL |       1,
-   |  ______-
-LL | |     ""
-   | |     --
-   | |_____||
-   |       |help: remove the extra argument
-   |       unexpected argument of type `&'static str`
+LL |   two_arg_same(
+   |   ^^^^^^^^^^^^
+...
+LL |     ""
+   |     -- unexpected argument of type `&'static str`
    |
 note: function defined here
   --> $DIR/extra_arguments.rs:3:4
    |
 LL | fn two_arg_same(_a: i32, _b: i32) {}
    |    ^^^^^^^^^^^^ -------  -------
+help: remove the extra argument
+   |
+LL -     1,
+LL -     ""
+LL +     1
+   |
 
 error[E0061]: this function takes 2 arguments but 3 arguments were supplied
   --> $DIR/extra_arguments.rs:43:3
    |
-LL |     two_arg_diff(
-   |     ^^^^^^^^^^^^
-LL |       1,
-   |  ______-
-LL | |     1,
-   | |     -
-   | |     |
-   | |_____unexpected argument of type `{integer}`
-   |       help: remove the extra argument
+LL |   two_arg_diff(
+   |   ^^^^^^^^^^^^
+LL |     1,
+LL |     1,
+   |     - unexpected argument of type `{integer}`
    |
 note: function defined here
   --> $DIR/extra_arguments.rs:4:4
    |
 LL | fn two_arg_diff(_a: i32, _b: &str) {}
    |    ^^^^^^^^^^^^ -------  --------
+help: remove the extra argument
+   |
+LL -     1,
+   |
 
 error[E0061]: this function takes 0 arguments but 2 arguments were supplied
   --> $DIR/extra_arguments.rs:8:9
@@ -310,61 +329,69 @@ error[E0061]: this function takes 1 argument but 2 arguments were supplied
   --> $DIR/extra_arguments.rs:53:3
    |
 LL |   one_arg(1, panic!());
-   |   ^^^^^^^  ----------
-   |            | |
-   |            | unexpected argument
-   |            help: remove the extra argument
+   |   ^^^^^^^    -------- unexpected argument
    |
 note: function defined here
   --> $DIR/extra_arguments.rs:2:4
    |
 LL | fn one_arg<T>(_a: T) {}
    |    ^^^^^^^    -----
+help: remove the extra argument
+   |
+LL -   one_arg(1, panic!());
+LL +   one_arg(1);
+   |
 
 error[E0061]: this function takes 1 argument but 2 arguments were supplied
   --> $DIR/extra_arguments.rs:54:3
    |
 LL |   one_arg(panic!(), 1);
-   |   ^^^^^^^         ---
-   |                   | |
-   |                   | unexpected argument of type `{integer}`
-   |                   help: remove the extra argument
+   |   ^^^^^^^           - unexpected argument of type `{integer}`
    |
 note: function defined here
   --> $DIR/extra_arguments.rs:2:4
    |
 LL | fn one_arg<T>(_a: T) {}
    |    ^^^^^^^    -----
+help: remove the extra argument
+   |
+LL -   one_arg(panic!(), 1);
+LL +   one_arg(panic!());
+   |
 
 error[E0061]: this function takes 1 argument but 2 arguments were supplied
   --> $DIR/extra_arguments.rs:55:3
    |
 LL |   one_arg(stringify!($e), 1);
-   |   ^^^^^^^               ---
-   |                         | |
-   |                         | unexpected argument of type `{integer}`
-   |                         help: remove the extra argument
+   |   ^^^^^^^                 - unexpected argument of type `{integer}`
    |
 note: function defined here
   --> $DIR/extra_arguments.rs:2:4
    |
 LL | fn one_arg<T>(_a: T) {}
    |    ^^^^^^^    -----
+help: remove the extra argument
+   |
+LL -   one_arg(stringify!($e), 1);
+LL +   one_arg(stringify!($e));
+   |
 
 error[E0061]: this function takes 1 argument but 2 arguments were supplied
   --> $DIR/extra_arguments.rs:60:3
    |
 LL |   one_arg(for _ in 1.. {}, 1);
-   |   ^^^^^^^                ---
-   |                          | |
-   |                          | unexpected argument of type `{integer}`
-   |                          help: remove the extra argument
+   |   ^^^^^^^                  - unexpected argument of type `{integer}`
    |
 note: function defined here
   --> $DIR/extra_arguments.rs:2:4
    |
 LL | fn one_arg<T>(_a: T) {}
    |    ^^^^^^^    -----
+help: remove the extra argument
+   |
+LL -   one_arg(for _ in 1.. {}, 1);
+LL +   one_arg(for _ in 1.. {});
+   |
 
 error: aborting due to 22 previous errors
 
diff --git a/tests/ui/argument-suggestions/suggest-better-removing-issue-126246.stderr b/tests/ui/argument-suggestions/suggest-better-removing-issue-126246.stderr
index 7c4daa3ffe9..dc293945eb6 100644
--- a/tests/ui/argument-suggestions/suggest-better-removing-issue-126246.stderr
+++ b/tests/ui/argument-suggestions/suggest-better-removing-issue-126246.stderr
@@ -32,91 +32,103 @@ error[E0061]: this function takes 1 argument but 2 arguments were supplied
   --> $DIR/suggest-better-removing-issue-126246.rs:10:5
    |
 LL |     add_one(2, 2);
-   |     ^^^^^^^  ---
-   |              | |
-   |              | unexpected argument of type `{integer}`
-   |              help: remove the extra argument
+   |     ^^^^^^^    - unexpected argument of type `{integer}`
    |
 note: function defined here
   --> $DIR/suggest-better-removing-issue-126246.rs:1:4
    |
 LL | fn add_one(x: i32) -> i32 {
    |    ^^^^^^^ ------
+help: remove the extra argument
+   |
+LL -     add_one(2, 2);
+LL +     add_one(2);
+   |
 
 error[E0061]: this function takes 1 argument but 2 arguments were supplied
   --> $DIR/suggest-better-removing-issue-126246.rs:11:5
    |
 LL |     add_one(no_such_local, 10);
-   |     ^^^^^^^ ---------------
-   |             |
-   |             unexpected argument
-   |             help: remove the extra argument
+   |     ^^^^^^^ ------------- unexpected argument
    |
 note: function defined here
   --> $DIR/suggest-better-removing-issue-126246.rs:1:4
    |
 LL | fn add_one(x: i32) -> i32 {
    |    ^^^^^^^ ------
+help: remove the extra argument
+   |
+LL -     add_one(no_such_local, 10);
+LL +     add_one(10);
+   |
 
 error[E0061]: this function takes 1 argument but 2 arguments were supplied
   --> $DIR/suggest-better-removing-issue-126246.rs:13:5
    |
 LL |     add_one(10, no_such_local);
-   |     ^^^^^^^   ---------------
-   |               | |
-   |               | unexpected argument
-   |               help: remove the extra argument
+   |     ^^^^^^^     ------------- unexpected argument
    |
 note: function defined here
   --> $DIR/suggest-better-removing-issue-126246.rs:1:4
    |
 LL | fn add_one(x: i32) -> i32 {
    |    ^^^^^^^ ------
+help: remove the extra argument
+   |
+LL -     add_one(10, no_such_local);
+LL +     add_one(10);
+   |
 
 error[E0061]: this function takes 2 arguments but 3 arguments were supplied
   --> $DIR/suggest-better-removing-issue-126246.rs:15:5
    |
 LL |     add_two(10, no_such_local, 10);
-   |     ^^^^^^^   ---------------
-   |               | |
-   |               | unexpected argument
-   |               help: remove the extra argument
+   |     ^^^^^^^     ------------- unexpected argument
    |
 note: function defined here
   --> $DIR/suggest-better-removing-issue-126246.rs:5:4
    |
 LL | fn add_two(x: i32, y: i32) -> i32 {
    |    ^^^^^^^ ------  ------
+help: remove the extra argument
+   |
+LL -     add_two(10, no_such_local, 10);
+LL +     add_two(10, 10);
+   |
 
 error[E0061]: this function takes 2 arguments but 3 arguments were supplied
   --> $DIR/suggest-better-removing-issue-126246.rs:17:5
    |
 LL |     add_two(no_such_local, 10, 10);
-   |     ^^^^^^^ ---------------
-   |             |
-   |             unexpected argument
-   |             help: remove the extra argument
+   |     ^^^^^^^ ------------- unexpected argument
    |
 note: function defined here
   --> $DIR/suggest-better-removing-issue-126246.rs:5:4
    |
 LL | fn add_two(x: i32, y: i32) -> i32 {
    |    ^^^^^^^ ------  ------
+help: remove the extra argument
+   |
+LL -     add_two(no_such_local, 10, 10);
+LL +     add_two(10, 10);
+   |
 
 error[E0061]: this function takes 2 arguments but 3 arguments were supplied
   --> $DIR/suggest-better-removing-issue-126246.rs:19:5
    |
 LL |     add_two(10, 10, no_such_local);
-   |     ^^^^^^^       ---------------
-   |                   | |
-   |                   | unexpected argument
-   |                   help: remove the extra argument
+   |     ^^^^^^^         ------------- unexpected argument
    |
 note: function defined here
   --> $DIR/suggest-better-removing-issue-126246.rs:5:4
    |
 LL | fn add_two(x: i32, y: i32) -> i32 {
    |    ^^^^^^^ ------  ------
+help: remove the extra argument
+   |
+LL -     add_two(10, 10, no_such_local);
+LL +     add_two(10, 10);
+   |
 
 error: aborting due to 11 previous errors
 
diff --git a/tests/ui/error-codes/E0057.stderr b/tests/ui/error-codes/E0057.stderr
index 9b0cf069824..efd2af6d609 100644
--- a/tests/ui/error-codes/E0057.stderr
+++ b/tests/ui/error-codes/E0057.stderr
@@ -18,16 +18,18 @@ error[E0057]: this function takes 1 argument but 2 arguments were supplied
   --> $DIR/E0057.rs:5:13
    |
 LL |     let c = f(2, 3);
-   |             ^  ---
-   |                | |
-   |                | unexpected argument of type `{integer}`
-   |                help: remove the extra argument
+   |             ^    - unexpected argument of type `{integer}`
    |
 note: closure defined here
   --> $DIR/E0057.rs:2:13
    |
 LL |     let f = |x| x * 3;
    |             ^^^
+help: remove the extra argument
+   |
+LL -     let c = f(2, 3);
+LL +     let c = f(2);
+   |
 
 error: aborting due to 2 previous errors
 
diff --git a/tests/ui/impl-trait/opaque-used-in-extraneous-argument.stderr b/tests/ui/impl-trait/opaque-used-in-extraneous-argument.stderr
index 6d417488533..caaac5434c5 100644
--- a/tests/ui/impl-trait/opaque-used-in-extraneous-argument.stderr
+++ b/tests/ui/impl-trait/opaque-used-in-extraneous-argument.stderr
@@ -57,31 +57,35 @@ error[E0061]: this function takes 0 arguments but 1 argument was supplied
   --> $DIR/opaque-used-in-extraneous-argument.rs:17:20
    |
 LL |     let old_path = frob("hello");
-   |                    ^^^^ -------
-   |                         |
-   |                         unexpected argument of type `&'static str`
-   |                         help: remove the extra argument
+   |                    ^^^^ ------- unexpected argument of type `&'static str`
    |
 note: function defined here
   --> $DIR/opaque-used-in-extraneous-argument.rs:5:4
    |
 LL | fn frob() -> impl Fn<P, Output = T> + '_ {}
    |    ^^^^
+help: remove the extra argument
+   |
+LL -     let old_path = frob("hello");
+LL +     let old_path = frob();
+   |
 
 error[E0061]: this function takes 0 arguments but 1 argument was supplied
   --> $DIR/opaque-used-in-extraneous-argument.rs:20:5
    |
 LL |     open_parent(&old_path)
-   |     ^^^^^^^^^^^ ---------
-   |                 |
-   |                 unexpected argument of type `&impl FnOnce<{type error}, Output = {type error}> + Fn<{type error}> + 'static`
-   |                 help: remove the extra argument
+   |     ^^^^^^^^^^^ --------- unexpected argument of type `&impl FnOnce<{type error}, Output = {type error}> + Fn<{type error}> + 'static`
    |
 note: function defined here
   --> $DIR/opaque-used-in-extraneous-argument.rs:12:4
    |
 LL | fn open_parent<'path>() {
    |    ^^^^^^^^^^^
+help: remove the extra argument
+   |
+LL -     open_parent(&old_path)
+LL +     open_parent()
+   |
 
 error: aborting due to 7 previous errors
 
diff --git a/tests/ui/inference/ice-ifer-var-leaked-out-of-rollback-122098.stderr b/tests/ui/inference/ice-ifer-var-leaked-out-of-rollback-122098.stderr
index e2ddf474c4a..a5cd057e284 100644
--- a/tests/ui/inference/ice-ifer-var-leaked-out-of-rollback-122098.stderr
+++ b/tests/ui/inference/ice-ifer-var-leaked-out-of-rollback-122098.stderr
@@ -55,16 +55,18 @@ error[E0061]: this function takes 0 arguments but 1 argument was supplied
   --> $DIR/ice-ifer-var-leaked-out-of-rollback-122098.rs:21:31
    |
 LL |     LendingIterator::for_each(Query::new(&data), Box::new);
-   |                               ^^^^^^^^^^ -----
-   |                                          |
-   |                                          unexpected argument of type `&fn() {data}`
-   |                                          help: remove the extra argument
+   |                               ^^^^^^^^^^ ----- unexpected argument of type `&fn() {data}`
    |
 note: associated function defined here
   --> $DIR/ice-ifer-var-leaked-out-of-rollback-122098.rs:17:12
    |
 LL |     pub fn new() -> Self {}
    |            ^^^
+help: remove the extra argument
+   |
+LL -     LendingIterator::for_each(Query::new(&data), Box::new);
+LL +     LendingIterator::for_each(Query::new(), Box::new);
+   |
 
 error: aborting due to 6 previous errors
 
diff --git a/tests/ui/issues/issue-16939.stderr b/tests/ui/issues/issue-16939.stderr
index 229ff9f1817..6e0889b8963 100644
--- a/tests/ui/issues/issue-16939.stderr
+++ b/tests/ui/issues/issue-16939.stderr
@@ -2,16 +2,18 @@ error[E0057]: this function takes 0 arguments but 1 argument was supplied
   --> $DIR/issue-16939.rs:5:9
    |
 LL |     |t| f(t);
-   |         ^ -
-   |           |
-   |           unexpected argument
-   |           help: remove the extra argument
+   |         ^ - unexpected argument
    |
 note: callable defined here
   --> $DIR/issue-16939.rs:4:12
    |
 LL | fn _foo<F: Fn()> (f: F) {
    |            ^^^^
+help: remove the extra argument
+   |
+LL -     |t| f(t);
+LL +     |t| f();
+   |
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/issues/issue-4935.stderr b/tests/ui/issues/issue-4935.stderr
index 25f299ae5f3..f18cf66f14d 100644
--- a/tests/ui/issues/issue-4935.stderr
+++ b/tests/ui/issues/issue-4935.stderr
@@ -2,16 +2,18 @@ error[E0061]: this function takes 1 argument but 2 arguments were supplied
   --> $DIR/issue-4935.rs:5:13
    |
 LL | fn main() { foo(5, 6) }
-   |             ^^^  ---
-   |                  | |
-   |                  | unexpected argument of type `{integer}`
-   |                  help: remove the extra argument
+   |             ^^^    - unexpected argument of type `{integer}`
    |
 note: function defined here
   --> $DIR/issue-4935.rs:3:4
    |
 LL | fn foo(a: usize) {}
    |    ^^^ --------
+help: remove the extra argument
+   |
+LL - fn main() { foo(5, 6) }
+LL + fn main() { foo(5) }
+   |
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/methods/method-call-err-msg.stderr b/tests/ui/methods/method-call-err-msg.stderr
index 5a76449e9f9..0855a17b333 100644
--- a/tests/ui/methods/method-call-err-msg.stderr
+++ b/tests/ui/methods/method-call-err-msg.stderr
@@ -2,16 +2,18 @@ error[E0061]: this method takes 0 arguments but 1 argument was supplied
   --> $DIR/method-call-err-msg.rs:13:7
    |
 LL |     x.zero(0)
-   |       ^^^^ -
-   |            |
-   |            unexpected argument of type `{integer}`
-   |            help: remove the extra argument
+   |       ^^^^ - unexpected argument of type `{integer}`
    |
 note: method defined here
   --> $DIR/method-call-err-msg.rs:5:8
    |
 LL |     fn zero(self) -> Foo { self }
    |        ^^^^
+help: remove the extra argument
+   |
+LL -     x.zero(0)
+LL +     x.zero()
+   |
 
 error[E0061]: this method takes 1 argument but 0 arguments were supplied
   --> $DIR/method-call-err-msg.rs:14:7
diff --git a/tests/ui/resolve/resolve-primitive-fallback.stderr b/tests/ui/resolve/resolve-primitive-fallback.stderr
index e3a5d4edcf1..d0583966459 100644
--- a/tests/ui/resolve/resolve-primitive-fallback.stderr
+++ b/tests/ui/resolve/resolve-primitive-fallback.stderr
@@ -24,13 +24,15 @@ error[E0061]: this function takes 0 arguments but 1 argument was supplied
   --> $DIR/resolve-primitive-fallback.rs:3:5
    |
 LL |     std::mem::size_of(u16);
-   |     ^^^^^^^^^^^^^^^^^ ---
-   |                       |
-   |                       unexpected argument
-   |                       help: remove the extra argument
+   |     ^^^^^^^^^^^^^^^^^ --- unexpected argument
    |
 note: function defined here
   --> $SRC_DIR/core/src/mem/mod.rs:LL:COL
+help: remove the extra argument
+   |
+LL -     std::mem::size_of(u16);
+LL +     std::mem::size_of();
+   |
 
 error: aborting due to 3 previous errors
 
diff --git a/tests/ui/span/issue-34264.stderr b/tests/ui/span/issue-34264.stderr
index f0dea66f612..89c67719b5a 100644
--- a/tests/ui/span/issue-34264.stderr
+++ b/tests/ui/span/issue-34264.stderr
@@ -54,16 +54,18 @@ error[E0061]: this function takes 2 arguments but 3 arguments were supplied
   --> $DIR/issue-34264.rs:7:5
    |
 LL |     foo(Some(42), 2, "");
-   |     ^^^            ----
-   |                    | |
-   |                    | unexpected argument of type `&'static str`
-   |                    help: remove the extra argument
+   |     ^^^              -- unexpected argument of type `&'static str`
    |
 note: function defined here
   --> $DIR/issue-34264.rs:1:4
    |
 LL | fn foo(Option<i32>, String) {}
    |    ^^^ -----------  ------
+help: remove the extra argument
+   |
+LL -     foo(Some(42), 2, "");
+LL +     foo(Some(42), 2);
+   |
 
 error[E0308]: mismatched types
   --> $DIR/issue-34264.rs:8:13
@@ -83,16 +85,18 @@ error[E0061]: this function takes 2 arguments but 3 arguments were supplied
   --> $DIR/issue-34264.rs:10:5
    |
 LL |     bar(1, 2, 3);
-   |     ^^^     ---
-   |             | |
-   |             | unexpected argument of type `{integer}`
-   |             help: remove the extra argument
+   |     ^^^       - unexpected argument of type `{integer}`
    |
 note: function defined here
   --> $DIR/issue-34264.rs:3:4
    |
 LL | fn bar(x, y: usize) {}
    |    ^^^ -  --------
+help: remove the extra argument
+   |
+LL -     bar(1, 2, 3);
+LL +     bar(1, 2);
+   |
 
 error: aborting due to 6 previous errors
 
diff --git a/tests/ui/tuple/wrong_argument_ice-4.stderr b/tests/ui/tuple/wrong_argument_ice-4.stderr
index 3c7d6699be2..10191faf7bf 100644
--- a/tests/ui/tuple/wrong_argument_ice-4.stderr
+++ b/tests/ui/tuple/wrong_argument_ice-4.stderr
@@ -6,16 +6,21 @@ LL |       (|| {})(|| {
 LL | |
 LL | |         let b = 1;
 LL | |     });
-   | |     -
-   | |     |
-   | |_____unexpected argument of type `{closure@$DIR/wrong_argument_ice-4.rs:2:13: 2:15}`
-   |       help: remove the extra argument
+   | |_____- unexpected argument of type `{closure@$DIR/wrong_argument_ice-4.rs:2:13: 2:15}`
    |
 note: closure defined here
   --> $DIR/wrong_argument_ice-4.rs:2:6
    |
 LL |     (|| {})(|| {
    |      ^^
+help: remove the extra argument
+   |
+LL -     (|| {})(|| {
+LL -
+LL -         let b = 1;
+LL -     });
+LL +     (|| {})();
+   |
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/type/type-ascription-instead-of-initializer.stderr b/tests/ui/type/type-ascription-instead-of-initializer.stderr
index efa917334bf..224ff6e7404 100644
--- a/tests/ui/type/type-ascription-instead-of-initializer.stderr
+++ b/tests/ui/type/type-ascription-instead-of-initializer.stderr
@@ -11,13 +11,15 @@ error[E0061]: this function takes 1 argument but 2 arguments were supplied
   --> $DIR/type-ascription-instead-of-initializer.rs:2:12
    |
 LL |     let x: Vec::with_capacity(10, 20);
-   |            ^^^^^^^^^^^^^^^^^^   ----
-   |                                 | |
-   |                                 | unexpected argument of type `{integer}`
-   |                                 help: remove the extra argument
+   |            ^^^^^^^^^^^^^^^^^^     -- unexpected argument of type `{integer}`
    |
 note: associated function defined here
   --> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL
+help: remove the extra argument
+   |
+LL -     let x: Vec::with_capacity(10, 20);
+LL +     let x: Vec::with_capacity(10);
+   |
 
 error: aborting due to 2 previous errors
 
diff --git a/tests/ui/typeck/remove-extra-argument.stderr b/tests/ui/typeck/remove-extra-argument.stderr
index 9557c41457d..4bab2959651 100644
--- a/tests/ui/typeck/remove-extra-argument.stderr
+++ b/tests/ui/typeck/remove-extra-argument.stderr
@@ -2,16 +2,18 @@ error[E0061]: this function takes 1 argument but 2 arguments were supplied
   --> $DIR/remove-extra-argument.rs:6:5
    |
 LL |     l(vec![], vec![])
-   |     ^       --------
-   |             | |
-   |             | unexpected argument of type `Vec<_>`
-   |             help: remove the extra argument
+   |     ^         ------ unexpected argument of type `Vec<_>`
    |
 note: function defined here
   --> $DIR/remove-extra-argument.rs:3:4
    |
 LL | fn l(_a: Vec<u8>) {}
    |    ^ -----------
+help: remove the extra argument
+   |
+LL -     l(vec![], vec![])
+LL +     l(vec![])
+   |
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/typeck/struct-enum-wrong-args.stderr b/tests/ui/typeck/struct-enum-wrong-args.stderr
index 57cbd1d2005..d005eca841e 100644
--- a/tests/ui/typeck/struct-enum-wrong-args.stderr
+++ b/tests/ui/typeck/struct-enum-wrong-args.stderr
@@ -2,13 +2,15 @@ error[E0061]: this enum variant takes 1 argument but 2 arguments were supplied
   --> $DIR/struct-enum-wrong-args.rs:6:13
    |
 LL |     let _ = Some(3, 2);
-   |             ^^^^  ---
-   |                   | |
-   |                   | unexpected argument of type `{integer}`
-   |                   help: remove the extra argument
+   |             ^^^^    - unexpected argument of type `{integer}`
    |
 note: tuple variant defined here
   --> $SRC_DIR/core/src/option.rs:LL:COL
+help: remove the extra argument
+   |
+LL -     let _ = Some(3, 2);
+LL +     let _ = Some(3);
+   |
 
 error[E0061]: this enum variant takes 1 argument but 3 arguments were supplied
   --> $DIR/struct-enum-wrong-args.rs:7:13
@@ -59,16 +61,18 @@ error[E0061]: this struct takes 1 argument but 2 arguments were supplied
   --> $DIR/struct-enum-wrong-args.rs:10:13
    |
 LL |     let _ = Wrapper(5, 2);
-   |             ^^^^^^^  ---
-   |                      | |
-   |                      | unexpected argument of type `{integer}`
-   |                      help: remove the extra argument
+   |             ^^^^^^^    - unexpected argument of type `{integer}`
    |
 note: tuple struct defined here
   --> $DIR/struct-enum-wrong-args.rs:2:8
    |
 LL | struct Wrapper(i32);
    |        ^^^^^^^
+help: remove the extra argument
+   |
+LL -     let _ = Wrapper(5, 2);
+LL +     let _ = Wrapper(5);
+   |
 
 error[E0061]: this struct takes 2 arguments but 0 arguments were supplied
   --> $DIR/struct-enum-wrong-args.rs:11:13
@@ -106,16 +110,18 @@ error[E0061]: this struct takes 2 arguments but 3 arguments were supplied
   --> $DIR/struct-enum-wrong-args.rs:13:13
    |
 LL |     let _ = DoubleWrapper(5, 2, 7);
-   |             ^^^^^^^^^^^^^     ---
-   |                               | |
-   |                               | unexpected argument of type `{integer}`
-   |                               help: remove the extra argument
+   |             ^^^^^^^^^^^^^       - unexpected argument of type `{integer}`
    |
 note: tuple struct defined here
   --> $DIR/struct-enum-wrong-args.rs:3:8
    |
 LL | struct DoubleWrapper(i32, i32);
    |        ^^^^^^^^^^^^^
+help: remove the extra argument
+   |
+LL -     let _ = DoubleWrapper(5, 2, 7);
+LL +     let _ = DoubleWrapper(5, 2);
+   |
 
 error: aborting due to 8 previous errors