1
Fork 0

Tweak wording

This commit is contained in:
Esteban Küber 2023-11-14 22:41:45 +00:00
parent 5fce361d58
commit d30252e359
7 changed files with 16 additions and 16 deletions

View file

@ -3012,7 +3012,7 @@ impl<'a: 'ast, 'ast, 'tcx> LateResolutionVisitor<'a, '_, 'ast, 'tcx> {
sugg, sugg,
Applicability::MaybeIncorrect, Applicability::MaybeIncorrect,
); );
"...or alternatively," "...or alternatively, you might want"
} else if let Some((kind, _span)) = } else if let Some((kind, _span)) =
self.diagnostic_metadata.current_function self.diagnostic_metadata.current_function
&& let FnKind::Fn(_, _, sig, _, _, _) = kind && let FnKind::Fn(_, _, sig, _, _, _) = kind
@ -3070,9 +3070,9 @@ impl<'a: 'ast, 'ast, 'tcx> LateResolutionVisitor<'a, '_, 'ast, 'tcx> {
higher_ranked higher_ranked
}, },
); );
"...or alternatively," "alternatively, you might want"
} else { } else {
"instead, you are more likely" "instead, you are more likely to want"
}; };
let mut sugg = vec![(lt.span, String::new())]; let mut sugg = vec![(lt.span, String::new())];
if let Some((kind, _span)) = if let Some((kind, _span)) =
@ -3105,7 +3105,7 @@ impl<'a: 'ast, 'ast, 'tcx> LateResolutionVisitor<'a, '_, 'ast, 'tcx> {
} }
}; };
err.multipart_suggestion_verbose( err.multipart_suggestion_verbose(
format!("{pre} to want to return an owned value"), format!("{pre} to return an owned value"),
sugg, sugg,
Applicability::MaybeIncorrect, Applicability::MaybeIncorrect,
); );

View file

@ -13,7 +13,7 @@ help: instead, you are more likely to want to change one of the arguments to be
| |
LL | x: &usize, LL | x: &usize,
| + | +
help: ...or alternatively, to want to return an owned value help: ...or alternatively, you might want to return an owned value
| |
LL - ) -> &usize { LL - ) -> &usize {
LL + ) -> usize { LL + ) -> usize {

View file

@ -25,7 +25,7 @@ help: instead, you are more likely to want to change the argument to be borrowed
| |
LL | fn parse_type_2(iter: &fn(&u8)->&u8) -> &str { iter() } LL | fn parse_type_2(iter: &fn(&u8)->&u8) -> &str { iter() }
| + | +
help: ...or alternatively, to want to return an owned value help: ...or alternatively, you might want to return an owned value
| |
LL | fn parse_type_2(iter: fn(&u8)->&u8) -> String { iter() } LL | fn parse_type_2(iter: fn(&u8)->&u8) -> String { iter() }
| ~~~~~~ | ~~~~~~

View file

@ -54,7 +54,7 @@ help: instead, you are more likely to want to change the argument to be borrowed
| |
LL | fn i(_x: &isize) -> &isize { LL | fn i(_x: &isize) -> &isize {
| + | +
help: ...or alternatively, to want to return an owned value help: ...or alternatively, you might want to return an owned value
| |
LL - fn i(_x: isize) -> &isize { LL - fn i(_x: isize) -> &isize {
LL + fn i(_x: isize) -> isize { LL + fn i(_x: isize) -> isize {
@ -75,7 +75,7 @@ help: instead, you are more likely to want to change the argument to be borrowed
| |
LL | fn j(_x: &StaticStr) -> &isize { LL | fn j(_x: &StaticStr) -> &isize {
| + | +
help: ...or alternatively, to want to return an owned value help: ...or alternatively, you might want to return an owned value
| |
LL - fn j(_x: StaticStr) -> &isize { LL - fn j(_x: StaticStr) -> &isize {
LL + fn j(_x: StaticStr) -> isize { LL + fn j(_x: StaticStr) -> isize {
@ -96,7 +96,7 @@ help: instead, you are more likely to want to change the argument to be borrowed
| |
LL | fn k<'a, T: WithLifetime<'a>>(_x: &T::Output) -> &isize { LL | fn k<'a, T: WithLifetime<'a>>(_x: &T::Output) -> &isize {
| + | +
help: ...or alternatively, to want to return an owned value help: ...or alternatively, you might want to return an owned value
| |
LL - fn k<'a, T: WithLifetime<'a>>(_x: T::Output) -> &isize { LL - fn k<'a, T: WithLifetime<'a>>(_x: T::Output) -> &isize {
LL + fn k<'a, T: WithLifetime<'a>>(_x: T::Output) -> isize { LL + fn k<'a, T: WithLifetime<'a>>(_x: T::Output) -> isize {
@ -117,7 +117,7 @@ help: instead, you are more likely to want to change one of the arguments to be
| |
LL | fn l<'a>(_: &&'a str, _: &&'a str) -> &str { "" } LL | fn l<'a>(_: &&'a str, _: &&'a str) -> &str { "" }
| + + | + +
help: ...or alternatively, to want to return an owned value help: ...or alternatively, you might want to return an owned value
| |
LL | fn l<'a>(_: &'a str, _: &'a str) -> String { "" } LL | fn l<'a>(_: &'a str, _: &'a str) -> String { "" }
| ~~~~~~ | ~~~~~~

View file

@ -29,7 +29,7 @@ help: instead, you are more likely to want to change the argument to be borrowed
| |
LL | fn wrap(self: &Wrap<{ fn bar(&self) {} }>) -> &() { LL | fn wrap(self: &Wrap<{ fn bar(&self) {} }>) -> &() {
| + | +
help: ...or alternatively, to want to return an owned value help: ...or alternatively, you might want to return an owned value
| |
LL - fn wrap(self: Wrap<{ fn bar(&self) {} }>) -> &() { LL - fn wrap(self: Wrap<{ fn bar(&self) {} }>) -> &() {
LL + fn wrap(self: Wrap<{ fn bar(&self) {} }>) -> () { LL + fn wrap(self: Wrap<{ fn bar(&self) {} }>) -> () {

View file

@ -13,7 +13,7 @@ help: consider introducing a named lifetime parameter
| |
LL | fn g<'a>(mut x: impl Iterator<Item = &'a ()>) -> Option<&'a ()> { x.next() } LL | fn g<'a>(mut x: impl Iterator<Item = &'a ()>) -> Option<&'a ()> { x.next() }
| ++++ ~~~ ~~~ | ++++ ~~~ ~~~
help: ...or alternatively, to want to return an owned value help: alternatively, you might want to return an owned value
| |
LL - fn g(mut x: impl Iterator<Item = &()>) -> Option<&()> { x.next() } LL - fn g(mut x: impl Iterator<Item = &()>) -> Option<&()> { x.next() }
LL + fn g(mut x: impl Iterator<Item = &()>) -> Option<()> { x.next() } LL + fn g(mut x: impl Iterator<Item = &()>) -> Option<()> { x.next() }
@ -34,7 +34,7 @@ help: consider introducing a named lifetime parameter
| |
LL | async fn i<'a>(mut x: impl Iterator<Item = &'a ()>) -> Option<&'a ()> { x.next() } LL | async fn i<'a>(mut x: impl Iterator<Item = &'a ()>) -> Option<&'a ()> { x.next() }
| ++++ ~~~ ~~~ | ++++ ~~~ ~~~
help: ...or alternatively, to want to return an owned value help: alternatively, you might want to return an owned value
| |
LL - async fn i(mut x: impl Iterator<Item = &()>) -> Option<&()> { x.next() } LL - async fn i(mut x: impl Iterator<Item = &()>) -> Option<&()> { x.next() }
LL + async fn i(mut x: impl Iterator<Item = &()>) -> Option<()> { x.next() } LL + async fn i(mut x: impl Iterator<Item = &()>) -> Option<()> { x.next() }
@ -79,7 +79,7 @@ help: consider introducing a named lifetime parameter
| |
LL | fn g<'a>(mut x: impl Foo) -> Option<&'a ()> { x.next() } LL | fn g<'a>(mut x: impl Foo) -> Option<&'a ()> { x.next() }
| ++++ ~~~ | ++++ ~~~
help: ...or alternatively, to want to return an owned value help: alternatively, you might want to return an owned value
| |
LL - fn g(mut x: impl Foo) -> Option<&()> { x.next() } LL - fn g(mut x: impl Foo) -> Option<&()> { x.next() }
LL + fn g(mut x: impl Foo) -> Option<()> { x.next() } LL + fn g(mut x: impl Foo) -> Option<()> { x.next() }
@ -100,7 +100,7 @@ help: consider introducing a named lifetime parameter
| |
LL | fn g<'a>(mut x: impl Foo<()>) -> Option<&'a ()> { x.next() } LL | fn g<'a>(mut x: impl Foo<()>) -> Option<&'a ()> { x.next() }
| ++++ ~~~ | ++++ ~~~
help: ...or alternatively, to want to return an owned value help: alternatively, you might want to return an owned value
| |
LL - fn g(mut x: impl Foo<()>) -> Option<&()> { x.next() } LL - fn g(mut x: impl Foo<()>) -> Option<&()> { x.next() }
LL + fn g(mut x: impl Foo<()>) -> Option<()> { x.next() } LL + fn g(mut x: impl Foo<()>) -> Option<()> { x.next() }

View file

@ -44,7 +44,7 @@ help: instead, you are more likely to want to change one of the arguments to be
| |
LL | fn f2(a: &i32, b: &i32) -> &i32 { loop {} } LL | fn f2(a: &i32, b: &i32) -> &i32 { loop {} }
| + + | + +
help: ...or alternatively, to want to return an owned value help: ...or alternatively, you might want to return an owned value
| |
LL - fn f2(a: i32, b: i32) -> &i32 { loop {} } LL - fn f2(a: i32, b: i32) -> &i32 { loop {} }
LL + fn f2(a: i32, b: i32) -> i32 { loop {} } LL + fn f2(a: i32, b: i32) -> i32 { loop {} }