1
Fork 0

reword message to be less vague

This commit is contained in:
Michael Goulet 2023-06-10 22:41:59 +00:00
parent eb76764ea4
commit 8621285e3b
11 changed files with 23 additions and 23 deletions

View file

@ -4029,7 +4029,7 @@ fn hint_missing_borrow<'tcx>(
if !to_borrow.is_empty() { if !to_borrow.is_empty() {
err.multipart_suggestion_verbose( err.multipart_suggestion_verbose(
"consider borrowing the argument", "consider adjusting the signature so it borrows its argument",
to_borrow, to_borrow,
Applicability::MaybeIncorrect, Applicability::MaybeIncorrect,
); );
@ -4037,7 +4037,7 @@ fn hint_missing_borrow<'tcx>(
if !remove_borrow.is_empty() { if !remove_borrow.is_empty() {
err.multipart_suggestion_verbose( err.multipart_suggestion_verbose(
"do not borrow the argument", "consider adjusting the signature so it does not borrow its argument",
remove_borrow, remove_borrow,
Applicability::MaybeIncorrect, Applicability::MaybeIncorrect,
); );

View file

@ -13,7 +13,7 @@ note: required by a bound in `f1`
| |
LL | fn f1<F>(_: F) where F: Fn(&(), &()) {} LL | fn f1<F>(_: F) where F: Fn(&(), &()) {}
| ^^^^^^^^^^^^ required by this bound in `f1` | ^^^^^^^^^^^^ required by this bound in `f1`
help: consider borrowing the argument help: consider adjusting the signature so it borrows its argument
| |
LL | f1(|_: &(), _: &()| {}); LL | f1(|_: &(), _: &()| {});
| + + | + +
@ -33,7 +33,7 @@ note: required by a bound in `f2`
| |
LL | fn f2<F>(_: F) where F: for<'a> Fn(&'a (), &()) {} LL | fn f2<F>(_: F) where F: for<'a> Fn(&'a (), &()) {}
| ^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `f2` | ^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `f2`
help: consider borrowing the argument help: consider adjusting the signature so it borrows its argument
| |
LL | f2(|_: &(), _: &()| {}); LL | f2(|_: &(), _: &()| {});
| + + | + +
@ -53,7 +53,7 @@ note: required by a bound in `f3`
| |
LL | fn f3<'a, F>(_: F) where F: Fn(&'a (), &()) {} LL | fn f3<'a, F>(_: F) where F: Fn(&'a (), &()) {}
| ^^^^^^^^^^^^^^^ required by this bound in `f3` | ^^^^^^^^^^^^^^^ required by this bound in `f3`
help: consider borrowing the argument help: consider adjusting the signature so it borrows its argument
| |
LL | f3(|_: &(), _: &()| {}); LL | f3(|_: &(), _: &()| {});
| + + | + +
@ -73,7 +73,7 @@ note: required by a bound in `f4`
| |
LL | fn f4<F>(_: F) where F: for<'r> Fn(&(), &'r ()) {} LL | fn f4<F>(_: F) where F: for<'r> Fn(&(), &'r ()) {}
| ^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `f4` | ^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `f4`
help: consider borrowing the argument help: consider adjusting the signature so it borrows its argument
| |
LL | f4(|_: &(), _: &()| {}); LL | f4(|_: &(), _: &()| {});
| + + | + +
@ -93,7 +93,7 @@ note: required by a bound in `f5`
| |
LL | fn f5<F>(_: F) where F: for<'r> Fn(&'r (), &'r ()) {} LL | fn f5<F>(_: F) where F: for<'r> Fn(&'r (), &'r ()) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `f5` | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `f5`
help: consider borrowing the argument help: consider adjusting the signature so it borrows its argument
| |
LL | f5(|_: &(), _: &()| {}); LL | f5(|_: &(), _: &()| {});
| + + | + +
@ -113,7 +113,7 @@ note: required by a bound in `g1`
| |
LL | fn g1<F>(_: F) where F: Fn(&(), Box<dyn Fn(&())>) {} LL | fn g1<F>(_: F) where F: Fn(&(), Box<dyn Fn(&())>) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `g1` | ^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `g1`
help: consider borrowing the argument help: consider adjusting the signature so it borrows its argument
| |
LL | g1(|_: &(), _: ()| {}); LL | g1(|_: &(), _: ()| {});
| + | +
@ -133,7 +133,7 @@ note: required by a bound in `g2`
| |
LL | fn g2<F>(_: F) where F: Fn(&(), fn(&())) {} LL | fn g2<F>(_: F) where F: Fn(&(), fn(&())) {}
| ^^^^^^^^^^^^^^^^ required by this bound in `g2` | ^^^^^^^^^^^^^^^^ required by this bound in `g2`
help: consider borrowing the argument help: consider adjusting the signature so it borrows its argument
| |
LL | g2(|_: &(), _: ()| {}); LL | g2(|_: &(), _: ()| {});
| + | +
@ -153,7 +153,7 @@ note: required by a bound in `g3`
| |
LL | fn g3<F>(_: F) where F: for<'s> Fn(&'s (), Box<dyn Fn(&())>) {} LL | fn g3<F>(_: F) where F: for<'s> Fn(&'s (), Box<dyn Fn(&())>) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `g3` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `g3`
help: consider borrowing the argument help: consider adjusting the signature so it borrows its argument
| |
LL | g3(|_: &(), _: ()| {}); LL | g3(|_: &(), _: ()| {});
| + | +
@ -173,7 +173,7 @@ note: required by a bound in `g4`
| |
LL | fn g4<F>(_: F) where F: Fn(&(), for<'r> fn(&'r ())) {} LL | fn g4<F>(_: F) where F: Fn(&(), for<'r> fn(&'r ())) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `g4` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `g4`
help: consider borrowing the argument help: consider adjusting the signature so it borrows its argument
| |
LL | g4(|_: &(), _: ()| {}); LL | g4(|_: &(), _: ()| {});
| + | +
@ -193,7 +193,7 @@ note: required by a bound in `h1`
| |
LL | fn h1<F>(_: F) where F: Fn(&(), Box<dyn Fn(&())>, &(), fn(&(), &())) {} LL | fn h1<F>(_: F) where F: Fn(&(), Box<dyn Fn(&())>, &(), fn(&(), &())) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `h1` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `h1`
help: consider borrowing the argument help: consider adjusting the signature so it borrows its argument
| |
LL | h1(|_: &(), _: (), _: &(), _: ()| {}); LL | h1(|_: &(), _: (), _: &(), _: ()| {});
| + + | + +
@ -213,7 +213,7 @@ note: required by a bound in `h2`
| |
LL | fn h2<F>(_: F) where F: for<'t0> Fn(&(), Box<dyn Fn(&())>, &'t0 (), fn(&(), &())) {} LL | fn h2<F>(_: F) where F: for<'t0> Fn(&(), Box<dyn Fn(&())>, &'t0 (), fn(&(), &())) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `h2` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `h2`
help: consider borrowing the argument help: consider adjusting the signature so it borrows its argument
| |
LL | h2(|_: &(), _: (), _: &(), _: ()| {}); LL | h2(|_: &(), _: (), _: &(), _: ()| {});
| + + | + +

View file

@ -18,7 +18,7 @@ note: required by a bound in `foo`
| |
LL | fn foo<F: Fn(&char) -> bool + Fn(char) -> bool>(f: F) { LL | fn foo<F: Fn(&char) -> bool + Fn(char) -> bool>(f: F) {
| ^^^^^^^^^^^^^^^^ required by this bound in `foo` | ^^^^^^^^^^^^^^^^ required by this bound in `foo`
help: do not borrow the argument help: consider adjusting the signature so it does not borrow its argument
| |
LL | foo(move |char| v); LL | foo(move |char| v);
| ~~~~ | ~~~~

View file

@ -10,7 +10,7 @@ LL | let _ = (-10..=10).find(|x: i32| x.signum() == 0);
found closure signature `fn(i32) -> _` found closure signature `fn(i32) -> _`
note: required by a bound in `find` note: required by a bound in `find`
--> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
help: consider borrowing the argument help: consider adjusting the signature so it borrows its argument
| |
LL | let _ = (-10..=10).find(|x: &i32| x.signum() == 0); LL | let _ = (-10..=10).find(|x: &i32| x.signum() == 0);
| + | +
@ -27,7 +27,7 @@ LL | let _ = (-10..=10).find(|x: &&&i32| x.signum() == 0);
found closure signature `for<'a, 'b, 'c> fn(&'a &'b &'c i32) -> _` found closure signature `for<'a, 'b, 'c> fn(&'a &'b &'c i32) -> _`
note: required by a bound in `find` note: required by a bound in `find`
--> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
help: do not borrow the argument help: consider adjusting the signature so it does not borrow its argument
| |
LL - let _ = (-10..=10).find(|x: &&&i32| x.signum() == 0); LL - let _ = (-10..=10).find(|x: &&&i32| x.signum() == 0);
LL + let _ = (-10..=10).find(|x: &i32| x.signum() == 0); LL + let _ = (-10..=10).find(|x: &i32| x.signum() == 0);

View file

@ -10,7 +10,7 @@ LL | a.iter().map(|_: (u32, u32)| 45);
found closure signature `fn((u32, u32)) -> _` found closure signature `fn((u32, u32)) -> _`
note: required by a bound in `map` note: required by a bound in `map`
--> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
help: consider borrowing the argument help: consider adjusting the signature so it borrows its argument
| |
LL | a.iter().map(|_: &(u32, u32)| 45); LL | a.iter().map(|_: &(u32, u32)| 45);
| + | +

View file

@ -10,7 +10,7 @@ LL | once::<&str>("str").fuse().filter(|a: &str| true).count();
found closure signature `for<'a> fn(&'a str) -> _` found closure signature `for<'a> fn(&'a str) -> _`
note: required by a bound in `filter` note: required by a bound in `filter`
--> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
help: consider borrowing the argument help: consider adjusting the signature so it borrows its argument
| |
LL | once::<&str>("str").fuse().filter(|a: &&str| true).count(); LL | once::<&str>("str").fuse().filter(|a: &&str| true).count();
| + | +

View file

@ -13,7 +13,7 @@ LL | let _has_inference_vars: Option<i32> = Some(0).map(deref_int);
found function signature `for<'a> fn(&'a i32) -> _` found function signature `for<'a> fn(&'a i32) -> _`
note: required by a bound in `Option::<T>::map` note: required by a bound in `Option::<T>::map`
--> $SRC_DIR/core/src/option.rs:LL:COL --> $SRC_DIR/core/src/option.rs:LL:COL
help: do not borrow the argument help: consider adjusting the signature so it does not borrow its argument
| |
LL - fn deref_int(a: &i32) -> i32 { LL - fn deref_int(a: &i32) -> i32 {
LL + fn deref_int(a: i32) -> i32 { LL + fn deref_int(a: i32) -> i32 {

View file

@ -17,7 +17,7 @@ fn generic<T>(_: T) -> Option<()> {
} }
fn generic_ref<T>(_: T) -> Option<()> { fn generic_ref<T>(_: T) -> Option<()> {
//~^ HELP do not borrow the argument //~^ HELP consider adjusting the signature so it does not borrow its argument
Some(()) Some(())
} }

View file

@ -17,7 +17,7 @@ fn generic<T>(_: T) -> Option<()> {
} }
fn generic_ref<T>(_: &T) -> Option<()> { fn generic_ref<T>(_: &T) -> Option<()> {
//~^ HELP do not borrow the argument //~^ HELP consider adjusting the signature so it does not borrow its argument
Some(()) Some(())
} }

View file

@ -73,7 +73,7 @@ LL | let _ = produces_string().and_then(generic_ref);
found function signature `for<'a> fn(&'a _) -> _` found function signature `for<'a> fn(&'a _) -> _`
note: required by a bound in `Option::<T>::and_then` note: required by a bound in `Option::<T>::and_then`
--> $SRC_DIR/core/src/option.rs:LL:COL --> $SRC_DIR/core/src/option.rs:LL:COL
help: do not borrow the argument help: consider adjusting the signature so it does not borrow its argument
| |
LL - fn generic_ref<T>(_: &T) -> Option<()> { LL - fn generic_ref<T>(_: &T) -> Option<()> {
LL + fn generic_ref<T>(_: T) -> Option<()> { LL + fn generic_ref<T>(_: T) -> Option<()> {

View file

@ -16,7 +16,7 @@ note: required by a bound in `Trader::<'a>::set_closure`
| |
LL | pub fn set_closure(&mut self, function: impl Fn(&mut Trader) + 'a) { LL | pub fn set_closure(&mut self, function: impl Fn(&mut Trader) + 'a) {
| ^^^^^^^^^^^^^^^ required by this bound in `Trader::<'a>::set_closure` | ^^^^^^^^^^^^^^^ required by this bound in `Trader::<'a>::set_closure`
help: consider borrowing the argument help: consider adjusting the signature so it borrows its argument
| |
LL | let closure = |trader : &mut Trader| { LL | let closure = |trader : &mut Trader| {
| ++++ | ++++