Tweak wording · rust-lang/rust@25ad047 (original) (raw)

File tree

6 files changed

lines changed

6 files changed

lines changed

Original file line number Diff line number Diff line change
@@ -361,10 +361,10 @@ pub fn suggest_constraining_type_params<'a>(
361 361 trait_names.dedup();
362 362 let n = trait_names.len();
363 363 let stable = if all_stable { "" } else { "unstable " };
364 -let trait_ = if all_known { "trait" } else { "" };
365 -format!("{stable}{trait_}{} {}", pluralize!(n), match &trait_names[..] {
366 -[t] => t.to_string(),
367 -[ts @ .., last] => format!("{} and {last}", ts.join(", ")),
364 +let trait_ = if all_known { format!("trait{}", pluralize!(n)) } else { String::new() };
365 +format!("{stable}{trait_}{}", match &trait_names[..] {
366 +[t] => format!(" {t}"),
367 +[ts @ .., last] => format!(" {} and {last}", ts.join(", ")),
368 368 [] => return false,
369 369 },)
370 370 } else {
@@ -531,7 +531,7 @@ pub fn suggest_constraining_type_params<'a>(
531 531 let (span, post, suggestion, msg) = suggestions.pop().unwrap();
532 532 let msg = match msg {
533 533 SuggestChangingConstraintsMessage::RestrictBoundFurther => {
534 -format!("consider further restricting this bound with {post}")
534 +format!("consider further restricting this bound")
535 535 }
536 536 SuggestChangingConstraintsMessage::RestrictTypeFurther { ty }
537 537 | SuggestChangingConstraintsMessage::RestrictType { ty }
Original file line number Diff line number Diff line change
@@ -16,7 +16,7 @@ LL | trait UnsafeCopy<'a, T: Copy>
16 16 LL | where
17 17 LL | for<'b> <Self as UnsafeCopy<'b, T>>::Item: std::ops::Deref<Target = T>,
18 18 | ^^^^^^^^^^ required by this bound in `UnsafeCopy`
19 -help: consider further restricting this bound with `<Target = T>`
19 +help: consider further restricting this bound
20 20 |
21 21 LL | impl<T: Copy + std::ops::Deref<Target = T>> UnsafeCopy<'_, T> for T {
22 22 | ++++++++++++
Original file line number Diff line number Diff line change
@@ -13,7 +13,7 @@ note: required by a bound in `UnsafeCopy::Item`
13 13 |
14 14 LL | type Item<'a>: std::ops::Deref<Target = T>;
15 15 | ^^^^^^^^^^ required by this bound in `UnsafeCopy::Item`
16 -help: consider further restricting this bound with `<Target = T>`
16 +help: consider further restricting this bound
17 17 |
18 18 LL | impl<T: Copy + std::ops::Deref<Target = T>> UnsafeCopy for T {
19 19 | ++++++++++++
Original file line number Diff line number Diff line change
@@ -35,7 +35,7 @@ note: tuple struct defined here
35 35 |
36 36 LL | struct A(B);
37 37 | ^
38 -help: consider further restricting this bound with `<Output = B>`
38 +help: consider further restricting this bound
39 39 |
40 40 LL | impl Add for A where B: Add<Output = B> {
41 41 | ++++++++++++
@@ -58,7 +58,7 @@ note: tuple struct defined here
58 58 |
59 59 LL | struct C(B);
60 60 | ^
61 -help: consider further restricting this bound with `<Output = B>`
61 +help: consider further restricting this bound
62 62 |
63 63 LL | impl<B: Add<Output = B>> Add for C {
64 64 | ++++++++++++
@@ -94,7 +94,7 @@ note: tuple struct defined here
94 94 |
95 95 LL | struct E(B);
96 96 | ^
97 -help: consider further restricting this bound with `<Output = B>`
97 +help: consider further restricting this bound
98 98 |
99 99 LL | impl<B: Add<Output = B>> Add for E where ::Output = B {
100 100 | ++++++++++++
Original file line number Diff line number Diff line change
@@ -20,7 +20,7 @@ LL | Ok(self)
20 20 | this argument influences the type of `Ok`
21 21 note: tuple variant defined here
22 22 --> $SRC_DIR/core/src/result.rs:LL:COL
23 -help: consider further restricting this bound with `<Output = T>`
23 +help: consider further restricting this bound
24 24 |
25 25 LL | impl<T: TryAdd<Output = T>> TryAdd for Option {
26 26 | ++++++++++++
@@ -47,7 +47,7 @@ LL | Ok(self)
47 47 | this argument influences the type of `Ok`
48 48 note: tuple variant defined here
49 49 --> $SRC_DIR/core/src/result.rs:LL:COL
50 -help: consider further restricting this bound with `, Output = T`
50 +help: consider further restricting this bound
51 51 |
52 52 LL | impl<T: TryAdd<Error = X, Output = T>> TryAdd for Other {
53 53 | ++++++++++++
Original file line number Diff line number Diff line change
@@ -11,7 +11,7 @@ LL | return a.bar();
11 11 = note: expected type parameter `B`
12 12 found associated type `::T`
13 13 = note: the caller chooses a type for `B` which can be different from `::T`
14 -help: consider further restricting this bound with `<T = B>`
14 +help: consider further restricting this bound
15 15 |
16 16 LL | pub fn foo<A: MyTrait<T = B>, B>(a: A) -> B {
17 17 | +++++++