Rollup merge of #65914 - estebank:type-alias-bounds-sugg, r=davidtwco

Use structured suggestion for unnecessary bounds in type aliases
This commit is contained in:
Tyler Mandry 2019-11-01 11:20:15 -07:00 committed by GitHub
commit b7416348c8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 109 additions and 28 deletions

View file

@ -5,7 +5,10 @@ LL | type _TaWhere1<T> where T: Iterator<Item: Copy> = T;
| ^^^^^^^^^^^^^^^^^^^^^^^
|
= note: `#[warn(type_alias_bounds)]` on by default
= help: the clause will not be checked when the type alias is used, and should be removed
help: the clause will not be checked when the type alias is used, and should be removed
|
LL | type _TaWhere1<T> = T;
| --
warning: where clauses are not enforced in type aliases
--> $DIR/type-alias.rs:6:25
@ -13,7 +16,10 @@ warning: where clauses are not enforced in type aliases
LL | type _TaWhere2<T> where T: Iterator<Item: 'static> = T;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: the clause will not be checked when the type alias is used, and should be removed
help: the clause will not be checked when the type alias is used, and should be removed
|
LL | type _TaWhere2<T> = T;
| --
warning: where clauses are not enforced in type aliases
--> $DIR/type-alias.rs:7:25
@ -21,7 +27,10 @@ warning: where clauses are not enforced in type aliases
LL | type _TaWhere3<T> where T: Iterator<Item: 'static> = T;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: the clause will not be checked when the type alias is used, and should be removed
help: the clause will not be checked when the type alias is used, and should be removed
|
LL | type _TaWhere3<T> = T;
| --
warning: where clauses are not enforced in type aliases
--> $DIR/type-alias.rs:8:25
@ -29,7 +38,10 @@ warning: where clauses are not enforced in type aliases
LL | type _TaWhere4<T> where T: Iterator<Item: 'static + Copy + Send> = T;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: the clause will not be checked when the type alias is used, and should be removed
help: the clause will not be checked when the type alias is used, and should be removed
|
LL | type _TaWhere4<T> = T;
| --
warning: where clauses are not enforced in type aliases
--> $DIR/type-alias.rs:9:25
@ -37,7 +49,10 @@ warning: where clauses are not enforced in type aliases
LL | type _TaWhere5<T> where T: Iterator<Item: for<'a> Into<&'a u8>> = T;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: the clause will not be checked when the type alias is used, and should be removed
help: the clause will not be checked when the type alias is used, and should be removed
|
LL | type _TaWhere5<T> = T;
| --
warning: where clauses are not enforced in type aliases
--> $DIR/type-alias.rs:10:25
@ -45,7 +60,10 @@ warning: where clauses are not enforced in type aliases
LL | type _TaWhere6<T> where T: Iterator<Item: Iterator<Item: Copy>> = T;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: the clause will not be checked when the type alias is used, and should be removed
help: the clause will not be checked when the type alias is used, and should be removed
|
LL | type _TaWhere6<T> = T;
| --
warning: bounds on generic parameters are not enforced in type aliases
--> $DIR/type-alias.rs:12:20
@ -53,7 +71,10 @@ warning: bounds on generic parameters are not enforced in type aliases
LL | type _TaInline1<T: Iterator<Item: Copy>> = T;
| ^^^^^^^^^^^^^^^^^^^^
|
= help: the bound will not be checked when the type alias is used, and should be removed
help: the bound will not be checked when the type alias is used, and should be removed
|
LL | type _TaInline1<T> = T;
| --
warning: bounds on generic parameters are not enforced in type aliases
--> $DIR/type-alias.rs:13:20
@ -61,7 +82,10 @@ warning: bounds on generic parameters are not enforced in type aliases
LL | type _TaInline2<T: Iterator<Item: 'static>> = T;
| ^^^^^^^^^^^^^^^^^^^^^^^
|
= help: the bound will not be checked when the type alias is used, and should be removed
help: the bound will not be checked when the type alias is used, and should be removed
|
LL | type _TaInline2<T> = T;
| --
warning: bounds on generic parameters are not enforced in type aliases
--> $DIR/type-alias.rs:14:20
@ -69,7 +93,10 @@ warning: bounds on generic parameters are not enforced in type aliases
LL | type _TaInline3<T: Iterator<Item: 'static>> = T;
| ^^^^^^^^^^^^^^^^^^^^^^^
|
= help: the bound will not be checked when the type alias is used, and should be removed
help: the bound will not be checked when the type alias is used, and should be removed
|
LL | type _TaInline3<T> = T;
| --
warning: bounds on generic parameters are not enforced in type aliases
--> $DIR/type-alias.rs:15:20
@ -77,7 +104,10 @@ warning: bounds on generic parameters are not enforced in type aliases
LL | type _TaInline4<T: Iterator<Item: 'static + Copy + Send>> = T;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: the bound will not be checked when the type alias is used, and should be removed
help: the bound will not be checked when the type alias is used, and should be removed
|
LL | type _TaInline4<T> = T;
| --
warning: bounds on generic parameters are not enforced in type aliases
--> $DIR/type-alias.rs:16:20
@ -85,7 +115,10 @@ warning: bounds on generic parameters are not enforced in type aliases
LL | type _TaInline5<T: Iterator<Item: for<'a> Into<&'a u8>>> = T;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: the bound will not be checked when the type alias is used, and should be removed
help: the bound will not be checked when the type alias is used, and should be removed
|
LL | type _TaInline5<T> = T;
| --
warning: bounds on generic parameters are not enforced in type aliases
--> $DIR/type-alias.rs:17:20
@ -93,5 +126,8 @@ warning: bounds on generic parameters are not enforced in type aliases
LL | type _TaInline6<T: Iterator<Item: Iterator<Item: Copy>>> = T;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: the bound will not be checked when the type alias is used, and should be removed
help: the bound will not be checked when the type alias is used, and should be removed
|
LL | type _TaInline6<T> = T;
| --

View file

@ -340,7 +340,10 @@ LL | pub type Alias<T: PrivTr> = T;
| ^^^^^^
|
= note: `#[warn(type_alias_bounds)]` on by default
= help: the bound will not be checked when the type alias is used, and should be removed
help: the bound will not be checked when the type alias is used, and should be removed
|
LL | pub type Alias<T> = T;
| --
warning: where clauses are not enforced in type aliases
--> $DIR/private-in-public-warn.rs:75:29
@ -348,7 +351,10 @@ warning: where clauses are not enforced in type aliases
LL | pub type Alias<T> where T: PrivTr = T;
| ^^^^^^^^^
|
= help: the clause will not be checked when the type alias is used, and should be removed
help: the clause will not be checked when the type alias is used, and should be removed
|
LL | pub type Alias<T> = T;
| --
error: aborting due to 36 previous errors

View file

@ -31,7 +31,10 @@ LL | type Y where i32: Foo = ();
| ^^^^^^^^
|
= note: `#[warn(type_alias_bounds)]` on by default
= help: the clause will not be checked when the type alias is used, and should be removed
help: the clause will not be checked when the type alias is used, and should be removed
|
LL | type Y = ();
| --
warning: Trait bound i32: Foo does not depend on any type or lifetime parameters
--> $DIR/trivial-bounds-inconsistent.rs:22:19

View file

@ -5,7 +5,10 @@ LL | type SVec<T: Send + Send> = Vec<T>;
| ^^^^ ^^^^
|
= note: `#[warn(type_alias_bounds)]` on by default
= help: the bound will not be checked when the type alias is used, and should be removed
help: the bound will not be checked when the type alias is used, and should be removed
|
LL | type SVec<T> = Vec<T>;
| -- --
warning: where clauses are not enforced in type aliases
--> $DIR/type-alias-bounds.rs:10:21
@ -13,7 +16,10 @@ warning: where clauses are not enforced in type aliases
LL | type S2Vec<T> where T: Send = Vec<T>;
| ^^^^^^^
|
= help: the clause will not be checked when the type alias is used, and should be removed
help: the clause will not be checked when the type alias is used, and should be removed
|
LL | type S2Vec<T> = Vec<T>;
| --
warning: bounds on generic parameters are not enforced in type aliases
--> $DIR/type-alias-bounds.rs:12:19
@ -21,7 +27,10 @@ warning: bounds on generic parameters are not enforced in type aliases
LL | type VVec<'b, 'a: 'b + 'b> = (&'b u32, Vec<&'a i32>);
| ^^ ^^
|
= help: the bound will not be checked when the type alias is used, and should be removed
help: the bound will not be checked when the type alias is used, and should be removed
|
LL | type VVec<'b, 'a> = (&'b u32, Vec<&'a i32>);
| -- --
warning: bounds on generic parameters are not enforced in type aliases
--> $DIR/type-alias-bounds.rs:14:18
@ -29,7 +38,10 @@ warning: bounds on generic parameters are not enforced in type aliases
LL | type WVec<'b, T: 'b + 'b> = (&'b u32, Vec<T>);
| ^^ ^^
|
= help: the bound will not be checked when the type alias is used, and should be removed
help: the bound will not be checked when the type alias is used, and should be removed
|
LL | type WVec<'b, T> = (&'b u32, Vec<T>);
| -- --
warning: where clauses are not enforced in type aliases
--> $DIR/type-alias-bounds.rs:16:25
@ -37,7 +49,10 @@ warning: where clauses are not enforced in type aliases
LL | type W2Vec<'b, T> where T: 'b, T: 'b = (&'b u32, Vec<T>);
| ^^^^^ ^^^^^
|
= help: the clause will not be checked when the type alias is used, and should be removed
help: the clause will not be checked when the type alias is used, and should be removed
|
LL | type W2Vec<'b, T> = (&'b u32, Vec<T>);
| --
warning: bounds on generic parameters are not enforced in type aliases
--> $DIR/type-alias-bounds.rs:47:12
@ -45,12 +60,15 @@ warning: bounds on generic parameters are not enforced in type aliases
LL | type T1<U: Bound> = U::Assoc;
| ^^^^^
|
= help: the bound will not be checked when the type alias is used, and should be removed
help: use fully disambiguated paths (i.e., `<T as Trait>::Assoc`) to refer to associated types in type aliases
--> $DIR/type-alias-bounds.rs:47:21
|
LL | type T1<U: Bound> = U::Assoc;
| ^^^^^^^^
help: the bound will not be checked when the type alias is used, and should be removed
|
LL | type T1<U> = U::Assoc;
| --
warning: where clauses are not enforced in type aliases
--> $DIR/type-alias-bounds.rs:48:18
@ -58,12 +76,15 @@ warning: where clauses are not enforced in type aliases
LL | type T2<U> where U: Bound = U::Assoc;
| ^^^^^^^^
|
= help: the clause will not be checked when the type alias is used, and should be removed
help: use fully disambiguated paths (i.e., `<T as Trait>::Assoc`) to refer to associated types in type aliases
--> $DIR/type-alias-bounds.rs:48:29
|
LL | type T2<U> where U: Bound = U::Assoc;
| ^^^^^^^^
help: the clause will not be checked when the type alias is used, and should be removed
|
LL | type T2<U> = U::Assoc;
| --
warning: bounds on generic parameters are not enforced in type aliases
--> $DIR/type-alias-bounds.rs:56:12
@ -71,7 +92,10 @@ warning: bounds on generic parameters are not enforced in type aliases
LL | type T5<U: Bound> = <U as Bound>::Assoc;
| ^^^^^
|
= help: the bound will not be checked when the type alias is used, and should be removed
help: the bound will not be checked when the type alias is used, and should be removed
|
LL | type T5<U> = <U as Bound>::Assoc;
| --
warning: bounds on generic parameters are not enforced in type aliases
--> $DIR/type-alias-bounds.rs:57:12
@ -79,5 +103,8 @@ warning: bounds on generic parameters are not enforced in type aliases
LL | type T6<U: Bound> = ::std::vec::Vec<U>;
| ^^^^^
|
= help: the bound will not be checked when the type alias is used, and should be removed
help: the bound will not be checked when the type alias is used, and should be removed
|
LL | type T6<U> = ::std::vec::Vec<U>;
| --