Make removal suggestion not verbose

This commit is contained in:
Esteban Küber 2023-02-01 17:44:48 +00:00
parent 5d63e10318
commit bd176ee591
16 changed files with 136 additions and 196 deletions

View file

@ -1167,7 +1167,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
Some(format!("provide the argument{}", if plural { "s" } else { "" }))
}
SuggestionText::Remove(plural) => {
err.multipart_suggestion_verbose(
err.multipart_suggestion(
&format!("remove the extra argument{}", if plural { "s" } else { "" }),
suggestions,
Applicability::HasPlaceholders,

View file

@ -7,7 +7,10 @@ LL | fn oom() -> ! {
| _-^^^^^^^^^^^^
LL | | loop {}
LL | | }
| |_- unexpected argument of type `core::alloc::Layout`
| | -
| | |
| |_unexpected argument of type `core::alloc::Layout`
| help: remove the extra argument
|
note: function defined here
--> $DIR/alloc-error-handler-bad-signature-3.rs:10:4
@ -15,12 +18,6 @@ note: function defined here
LL | fn oom() -> ! {
| ^^^
= note: this error originates in the attribute macro `alloc_error_handler` (in Nightly builds, run with -Z macro-backtrace for more info)
help: remove the extra argument
|
LL - fn oom() -> ! {
LL - loop {}
LL - }
|
error: aborting due to previous error

View file

@ -16,18 +16,16 @@ 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`
| ^^^^^ --
| |
| unexpected argument of type `&'static str`
| help: remove the extra argument
|
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

View file

@ -2,69 +2,61 @@ 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`
| ^ ----
| |
| unexpected argument of type `i32`
| help: remove the extra argument
|
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`
| ^ ----
| |
| unexpected argument of type `i32`
| help: remove the extra argument
|
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`
| ^^^^^ ----
| |
| unexpected argument of type `i32`
| help: remove the extra argument
|
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`
| ^ ----
| |
| unexpected argument of type `i32`
| help: remove the extra argument
|
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

View file

@ -2,52 +2,46 @@ error[E0061]: this function takes 0 arguments but 1 argument was supplied
--> $DIR/extra_arguments.rs:7:3
|
LL | empty("");
| ^^^^^ -- unexpected argument of type `&'static str`
| ^^^^^ --
| |
| unexpected argument of type `&'static str`
| help: remove the extra argument
|
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 1 argument but 2 arguments were supplied
--> $DIR/extra_arguments.rs:9:3
|
LL | one_arg(1, 1);
| ^^^^^^^ - unexpected argument of type `{integer}`
| ^^^^^^^ ---
| | |
| | unexpected argument of type `{integer}`
| help: remove the extra argument
|
note: function defined here
--> $DIR/extra_arguments.rs:2:4
|
LL | fn one_arg(_a: i32) {}
| ^^^^^^^ -------
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:10:3
|
LL | one_arg(1, "");
| ^^^^^^^ -- unexpected argument of type `&'static str`
| ^^^^^^^ ----
| | |
| | unexpected argument of type `&'static str`
| help: remove the extra argument
|
note: function defined here
--> $DIR/extra_arguments.rs:2:4
|
LL | fn one_arg(_a: i32) {}
| ^^^^^^^ -------
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:11:3
@ -72,69 +66,61 @@ error[E0061]: this function takes 2 arguments but 3 arguments were supplied
--> $DIR/extra_arguments.rs:13:3
|
LL | two_arg_same(1, 1, 1);
| ^^^^^^^^^^^^ - unexpected argument of type `{integer}`
| ^^^^^^^^^^^^ ---
| | |
| | unexpected argument of type `{integer}`
| help: remove the extra argument
|
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:14:3
|
LL | two_arg_same(1, 1, 1.0);
| ^^^^^^^^^^^^ --- unexpected argument of type `{float}`
| ^^^^^^^^^^^^ -----
| | |
| | unexpected argument of type `{float}`
| help: remove the extra argument
|
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:16:3
|
LL | two_arg_diff(1, 1, "");
| ^^^^^^^^^^^^ - unexpected argument of type `{integer}`
| ^^^^^^^^^^^^ ---
| | |
| | unexpected argument of type `{integer}`
| help: remove the extra argument
|
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:17:3
|
LL | two_arg_diff(1, "", "");
| ^^^^^^^^^^^^ -- unexpected argument of type `&'static str`
| ^^^^^^^^^^^^ ----
| | |
| | unexpected argument of type `&'static str`
| help: remove the extra argument
|
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:18:3
@ -178,75 +164,70 @@ error[E0061]: this function takes 2 arguments but 3 arguments were supplied
--> $DIR/extra_arguments.rs:22:3
|
LL | two_arg_same(1, 1, "");
| ^^^^^^^^^^^^ -- unexpected argument of type `&'static str`
| ^^^^^^^^^^^^ --------
| | |
| | unexpected argument of type `&'static str`
| help: remove the extra argument
|
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:23:3
|
LL | two_arg_diff(1, 1, "");
| ^^^^^^^^^^^^ - unexpected argument of type `{integer}`
| ^^^^^^^^^^^^ ---
| | |
| | unexpected argument of type `{integer}`
| help: remove the extra argument
|
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:24:3
|
LL | two_arg_same(
| ^^^^^^^^^^^^
...
LL | ""
| -- unexpected argument of type `&'static str`
LL | two_arg_same(
| ^^^^^^^^^^^^
LL | 1,
LL | 1,
| ______-
LL | | ""
| | --
| |_____||
| |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 - 1,
LL + 1
|
error[E0061]: this function takes 2 arguments but 3 arguments were supplied
--> $DIR/extra_arguments.rs:30:3
|
LL | two_arg_diff(
| ^^^^^^^^^^^^
LL | 1,
LL | 1,
| - unexpected argument of type `{integer}`
LL | two_arg_diff(
| ^^^^^^^^^^^^
LL | 1,
| ______-
LL | | 1,
| | -
| | |
| |_____unexpected argument of type `{integer}`
| help: remove the extra argument
|
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,
LL + 1,
|
error: aborting due to 14 previous errors

View file

@ -18,18 +18,16 @@ 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}`
| ^ ---
| | |
| | unexpected argument of type `{integer}`
| help: remove the extra argument
|
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

View file

@ -2,18 +2,16 @@ error[E0057]: this function takes 0 arguments but 1 argument was supplied
--> $DIR/issue-16939.rs:5:9
|
LL | |t| f(t);
| ^ - unexpected argument
| ^ -
| |
| unexpected argument
| help: remove the extra 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 previous error

View file

@ -2,7 +2,10 @@ error[E0061]: this function takes 0 arguments but 1 argument was supplied
--> $DIR/issue-26094.rs:10:17
|
LL | $other(None)
| ---- unexpected argument of type `Option<_>`
| ----
| |
| unexpected argument of type `Option<_>`
| help: remove the extra argument
...
LL | some_macro!(some_function);
| ^^^^^^^^^^^^^
@ -12,11 +15,6 @@ note: function defined here
|
LL | fn some_function() {}
| ^^^^^^^^^^^^^
help: remove the extra argument
|
LL - $other(None)
LL + $other()
|
error: aborting due to previous error

View file

@ -2,18 +2,16 @@ 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}`
| ^^^ ---
| | |
| | unexpected argument of type `{integer}`
| help: remove the extra argument
|
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 previous error

View file

@ -2,18 +2,16 @@ 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}`
| ^^^^ -
| |
| unexpected argument of type `{integer}`
| help: remove the extra argument
|
note: associated function 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

View file

@ -24,15 +24,13 @@ 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
| ^^^^^^^^^^^^^^^^^ ---
| |
| unexpected argument
| help: remove the extra 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

View file

@ -54,18 +54,16 @@ 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`
| ^^^ ----
| | |
| | unexpected argument of type `&'static str`
| help: remove the extra argument
|
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
@ -85,18 +83,16 @@ 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}`
| ^^^ ---
| | |
| | unexpected argument of type `{integer}`
| help: remove the extra argument
|
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

View file

@ -6,18 +6,16 @@ LL | (|| {})(|| {
LL | |
LL | | let b = 1;
LL | | });
| |_____- unexpected argument of type `[closure@$DIR/wrong_argument_ice-4.rs:2:13: 2:15]`
| | -
| | |
| |_____unexpected argument of type `[closure@$DIR/wrong_argument_ice-4.rs:2:13: 2:15]`
| help: remove the extra argument
|
note: closure defined here
--> $DIR/wrong_argument_ice-4.rs:2:6
|
LL | (|| {})(|| {
| ^^
help: remove the extra argument
|
LL - (|| {})(|| {
LL + (|| {})();
|
error: aborting due to previous error

View file

@ -11,15 +11,13 @@ 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}`
| ^^^^^^^^^^^^^^^^^^ ----
| | |
| | unexpected argument of type `{integer}`
| help: remove the extra argument
|
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

View file

@ -2,18 +2,16 @@ 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<_>`
| ^ --------
| | |
| | unexpected argument of type `Vec<_>`
| help: remove the extra argument
|
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 previous error

View file

@ -2,15 +2,13 @@ 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}`
| ^^^^ ---
| | |
| | unexpected argument of type `{integer}`
| help: remove the extra argument
|
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
@ -61,18 +59,16 @@ 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}`
| ^^^^^^^ ---
| | |
| | unexpected argument of type `{integer}`
| help: remove the extra argument
|
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
@ -110,18 +106,16 @@ 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}`
| ^^^^^^^^^^^^^ ---
| | |
| | unexpected argument of type `{integer}`
| help: remove the extra argument
|
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