mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-27 15:11:30 +00:00
353 lines
11 KiB
Text
353 lines
11 KiB
Text
error: `?Sized` bound is ignored because of a `Sized` requirement
|
|
--> tests/ui/needless_maybe_sized.rs:9:24
|
|
|
|
|
LL | fn directly<T: Sized + ?Sized>(t: &T) {}
|
|
| ^^^^^^
|
|
|
|
|
note: `T` cannot be unsized because of the bound
|
|
--> tests/ui/needless_maybe_sized.rs:9:16
|
|
|
|
|
LL | fn directly<T: Sized + ?Sized>(t: &T) {}
|
|
| ^^^^^
|
|
= note: `-D clippy::needless-maybe-sized` implied by `-D warnings`
|
|
= help: to override `-D warnings` add `#[allow(clippy::needless_maybe_sized)]`
|
|
help: change the bounds that require `Sized`, or remove the `?Sized` bound
|
|
|
|
|
LL - fn directly<T: Sized + ?Sized>(t: &T) {}
|
|
LL + fn directly<T: Sized>(t: &T) {}
|
|
|
|
|
|
|
error: `?Sized` bound is ignored because of a `Sized` requirement
|
|
--> tests/ui/needless_maybe_sized.rs:14:19
|
|
|
|
|
LL | fn depth_1<T: A + ?Sized>(t: &T) {}
|
|
| ^^^^^^
|
|
|
|
|
note: `T` cannot be unsized because of the bound
|
|
--> tests/ui/needless_maybe_sized.rs:14:15
|
|
|
|
|
LL | fn depth_1<T: A + ?Sized>(t: &T) {}
|
|
| ^
|
|
= note: ...because `A` has the bound `Sized`
|
|
help: change the bounds that require `Sized`, or remove the `?Sized` bound
|
|
|
|
|
LL - fn depth_1<T: A + ?Sized>(t: &T) {}
|
|
LL + fn depth_1<T: A>(t: &T) {}
|
|
|
|
|
|
|
error: `?Sized` bound is ignored because of a `Sized` requirement
|
|
--> tests/ui/needless_maybe_sized.rs:15:19
|
|
|
|
|
LL | fn depth_2<T: B + ?Sized>(t: &T) {}
|
|
| ^^^^^^
|
|
|
|
|
note: `T` cannot be unsized because of the bound
|
|
--> tests/ui/needless_maybe_sized.rs:15:15
|
|
|
|
|
LL | fn depth_2<T: B + ?Sized>(t: &T) {}
|
|
| ^
|
|
= note: ...because `B` has the bound `A`
|
|
= note: ...because `A` has the bound `Sized`
|
|
help: change the bounds that require `Sized`, or remove the `?Sized` bound
|
|
|
|
|
LL - fn depth_2<T: B + ?Sized>(t: &T) {}
|
|
LL + fn depth_2<T: B>(t: &T) {}
|
|
|
|
|
|
|
error: `?Sized` bound is ignored because of a `Sized` requirement
|
|
--> tests/ui/needless_maybe_sized.rs:18:30
|
|
|
|
|
LL | fn multiple_paths<T: A + B + ?Sized>(t: &T) {}
|
|
| ^^^^^^
|
|
|
|
|
note: `T` cannot be unsized because of the bound
|
|
--> tests/ui/needless_maybe_sized.rs:18:22
|
|
|
|
|
LL | fn multiple_paths<T: A + B + ?Sized>(t: &T) {}
|
|
| ^
|
|
= note: ...because `A` has the bound `Sized`
|
|
help: change the bounds that require `Sized`, or remove the `?Sized` bound
|
|
|
|
|
LL - fn multiple_paths<T: A + B + ?Sized>(t: &T) {}
|
|
LL + fn multiple_paths<T: A + B>(t: &T) {}
|
|
|
|
|
|
|
error: `?Sized` bound is ignored because of a `Sized` requirement
|
|
--> tests/ui/needless_maybe_sized.rs:22:16
|
|
|
|
|
LL | T: Sized + ?Sized,
|
|
| ^^^^^^
|
|
|
|
|
note: `T` cannot be unsized because of the bound
|
|
--> tests/ui/needless_maybe_sized.rs:22:8
|
|
|
|
|
LL | T: Sized + ?Sized,
|
|
| ^^^^^
|
|
help: change the bounds that require `Sized`, or remove the `?Sized` bound
|
|
|
|
|
LL - T: Sized + ?Sized,
|
|
LL + T: Sized,
|
|
|
|
|
|
|
error: `?Sized` bound is ignored because of a `Sized` requirement
|
|
--> tests/ui/needless_maybe_sized.rs:28:8
|
|
|
|
|
LL | T: ?Sized,
|
|
| ^^^^^^
|
|
|
|
|
note: `T` cannot be unsized because of the bound
|
|
--> tests/ui/needless_maybe_sized.rs:26:15
|
|
|
|
|
LL | fn mixed_1<T: Sized>(t: &T)
|
|
| ^^^^^
|
|
help: change the bounds that require `Sized`, or remove the `?Sized` bound
|
|
|
|
|
LL - where
|
|
LL - T: ?Sized,
|
|
|
|
|
|
|
error: `?Sized` bound is ignored because of a `Sized` requirement
|
|
--> tests/ui/needless_maybe_sized.rs:32:15
|
|
|
|
|
LL | fn mixed_2<T: ?Sized>(t: &T)
|
|
| ^^^^^^
|
|
|
|
|
note: `T` cannot be unsized because of the bound
|
|
--> tests/ui/needless_maybe_sized.rs:34:8
|
|
|
|
|
LL | T: Sized,
|
|
| ^^^^^
|
|
help: change the bounds that require `Sized`, or remove the `?Sized` bound
|
|
|
|
|
LL - fn mixed_2<T: ?Sized>(t: &T)
|
|
LL + fn mixed_2<T>(t: &T)
|
|
|
|
|
|
|
error: `?Sized` bound is ignored because of a `Sized` requirement
|
|
--> tests/ui/needless_maybe_sized.rs:41:8
|
|
|
|
|
LL | T: ?Sized,
|
|
| ^^^^^^
|
|
|
|
|
note: `T` cannot be unsized because of the bound
|
|
--> tests/ui/needless_maybe_sized.rs:40:8
|
|
|
|
|
LL | T: Sized,
|
|
| ^^^^^
|
|
help: change the bounds that require `Sized`, or remove the `?Sized` bound
|
|
|
|
|
LL - T: Sized,
|
|
LL - T: ?Sized,
|
|
LL + T: Sized,
|
|
|
|
|
|
|
error: `?Sized` bound is ignored because of a `Sized` requirement
|
|
--> tests/ui/needless_maybe_sized.rs:45:26
|
|
|
|
|
LL | struct Struct<T: Sized + ?Sized>(T);
|
|
| ^^^^^^
|
|
|
|
|
note: `T` cannot be unsized because of the bound
|
|
--> tests/ui/needless_maybe_sized.rs:45:18
|
|
|
|
|
LL | struct Struct<T: Sized + ?Sized>(T);
|
|
| ^^^^^
|
|
help: change the bounds that require `Sized`, or remove the `?Sized` bound
|
|
|
|
|
LL - struct Struct<T: Sized + ?Sized>(T);
|
|
LL + struct Struct<T: Sized>(T);
|
|
|
|
|
|
|
error: `?Sized` bound is ignored because of a `Sized` requirement
|
|
--> tests/ui/needless_maybe_sized.rs:47:17
|
|
|
|
|
LL | impl<T: Sized + ?Sized> Struct<T> {
|
|
| ^^^^^^
|
|
|
|
|
note: `T` cannot be unsized because of the bound
|
|
--> tests/ui/needless_maybe_sized.rs:47:9
|
|
|
|
|
LL | impl<T: Sized + ?Sized> Struct<T> {
|
|
| ^^^^^
|
|
help: change the bounds that require `Sized`, or remove the `?Sized` bound
|
|
|
|
|
LL - impl<T: Sized + ?Sized> Struct<T> {
|
|
LL + impl<T: Sized> Struct<T> {
|
|
|
|
|
|
|
error: `?Sized` bound is ignored because of a `Sized` requirement
|
|
--> tests/ui/needless_maybe_sized.rs:48:26
|
|
|
|
|
LL | fn method<U: Sized + ?Sized>(&self) {}
|
|
| ^^^^^^
|
|
|
|
|
note: `U` cannot be unsized because of the bound
|
|
--> tests/ui/needless_maybe_sized.rs:48:18
|
|
|
|
|
LL | fn method<U: Sized + ?Sized>(&self) {}
|
|
| ^^^^^
|
|
help: change the bounds that require `Sized`, or remove the `?Sized` bound
|
|
|
|
|
LL - fn method<U: Sized + ?Sized>(&self) {}
|
|
LL + fn method<U: Sized>(&self) {}
|
|
|
|
|
|
|
error: `?Sized` bound is ignored because of a `Sized` requirement
|
|
--> tests/ui/needless_maybe_sized.rs:51:22
|
|
|
|
|
LL | enum Enum<T: Sized + ?Sized + 'static> {
|
|
| ^^^^^^
|
|
|
|
|
note: `T` cannot be unsized because of the bound
|
|
--> tests/ui/needless_maybe_sized.rs:51:14
|
|
|
|
|
LL | enum Enum<T: Sized + ?Sized + 'static> {
|
|
| ^^^^^
|
|
help: change the bounds that require `Sized`, or remove the `?Sized` bound
|
|
|
|
|
LL - enum Enum<T: Sized + ?Sized + 'static> {
|
|
LL + enum Enum<T: Sized + 'static> {
|
|
|
|
|
|
|
error: `?Sized` bound is ignored because of a `Sized` requirement
|
|
--> tests/ui/needless_maybe_sized.rs:55:28
|
|
|
|
|
LL | union Union<'a, T: Sized + ?Sized> {
|
|
| ^^^^^^
|
|
|
|
|
note: `T` cannot be unsized because of the bound
|
|
--> tests/ui/needless_maybe_sized.rs:55:20
|
|
|
|
|
LL | union Union<'a, T: Sized + ?Sized> {
|
|
| ^^^^^
|
|
help: change the bounds that require `Sized`, or remove the `?Sized` bound
|
|
|
|
|
LL - union Union<'a, T: Sized + ?Sized> {
|
|
LL + union Union<'a, T: Sized> {
|
|
|
|
|
|
|
error: `?Sized` bound is ignored because of a `Sized` requirement
|
|
--> tests/ui/needless_maybe_sized.rs:59:24
|
|
|
|
|
LL | trait Trait<T: Sized + ?Sized> {
|
|
| ^^^^^^
|
|
|
|
|
note: `T` cannot be unsized because of the bound
|
|
--> tests/ui/needless_maybe_sized.rs:59:16
|
|
|
|
|
LL | trait Trait<T: Sized + ?Sized> {
|
|
| ^^^^^
|
|
help: change the bounds that require `Sized`, or remove the `?Sized` bound
|
|
|
|
|
LL - trait Trait<T: Sized + ?Sized> {
|
|
LL + trait Trait<T: Sized> {
|
|
|
|
|
|
|
error: `?Sized` bound is ignored because of a `Sized` requirement
|
|
--> tests/ui/needless_maybe_sized.rs:60:32
|
|
|
|
|
LL | fn trait_method<U: Sized + ?Sized>() {}
|
|
| ^^^^^^
|
|
|
|
|
note: `U` cannot be unsized because of the bound
|
|
--> tests/ui/needless_maybe_sized.rs:60:24
|
|
|
|
|
LL | fn trait_method<U: Sized + ?Sized>() {}
|
|
| ^^^^^
|
|
help: change the bounds that require `Sized`, or remove the `?Sized` bound
|
|
|
|
|
LL - fn trait_method<U: Sized + ?Sized>() {}
|
|
LL + fn trait_method<U: Sized>() {}
|
|
|
|
|
|
|
error: `?Sized` bound is ignored because of a `Sized` requirement
|
|
--> tests/ui/needless_maybe_sized.rs:62:25
|
|
|
|
|
LL | type GAT<U: Sized + ?Sized>;
|
|
| ^^^^^^
|
|
|
|
|
note: `U` cannot be unsized because of the bound
|
|
--> tests/ui/needless_maybe_sized.rs:62:17
|
|
|
|
|
LL | type GAT<U: Sized + ?Sized>;
|
|
| ^^^^^
|
|
help: change the bounds that require `Sized`, or remove the `?Sized` bound
|
|
|
|
|
LL - type GAT<U: Sized + ?Sized>;
|
|
LL + type GAT<U: Sized>;
|
|
|
|
|
|
|
error: `?Sized` bound is ignored because of a `Sized` requirement
|
|
--> tests/ui/needless_maybe_sized.rs:68:23
|
|
|
|
|
LL | fn second_in_trait<T: ?Sized + SecondInTrait>() {}
|
|
| ^^^^^^
|
|
|
|
|
note: `T` cannot be unsized because of the bound
|
|
--> tests/ui/needless_maybe_sized.rs:68:32
|
|
|
|
|
LL | fn second_in_trait<T: ?Sized + SecondInTrait>() {}
|
|
| ^^^^^^^^^^^^^
|
|
= note: ...because `SecondInTrait` has the bound `Sized`
|
|
help: change the bounds that require `Sized`, or remove the `?Sized` bound
|
|
|
|
|
LL - fn second_in_trait<T: ?Sized + SecondInTrait>() {}
|
|
LL + fn second_in_trait<T: SecondInTrait>() {}
|
|
|
|
|
|
|
error: `?Sized` bound is ignored because of a `Sized` requirement
|
|
--> tests/ui/needless_maybe_sized.rs:70:33
|
|
|
|
|
LL | fn impl_trait(_: &(impl Sized + ?Sized)) {}
|
|
| ^^^^^^
|
|
|
|
|
note: `impl Sized + ?Sized` cannot be unsized because of the bound
|
|
--> tests/ui/needless_maybe_sized.rs:70:25
|
|
|
|
|
LL | fn impl_trait(_: &(impl Sized + ?Sized)) {}
|
|
| ^^^^^
|
|
help: change the bounds that require `Sized`, or remove the `?Sized` bound
|
|
|
|
|
LL - fn impl_trait(_: &(impl Sized + ?Sized)) {}
|
|
LL + fn impl_trait(_: &(impl Sized)) {}
|
|
|
|
|
|
|
error: `?Sized` bound is ignored because of a `Sized` requirement
|
|
--> tests/ui/needless_maybe_sized.rs:73:42
|
|
|
|
|
LL | fn in_generic_trait<T: GenericTrait<U> + ?Sized, U>() {}
|
|
| ^^^^^^
|
|
|
|
|
note: `T` cannot be unsized because of the bound
|
|
--> tests/ui/needless_maybe_sized.rs:73:24
|
|
|
|
|
LL | fn in_generic_trait<T: GenericTrait<U> + ?Sized, U>() {}
|
|
| ^^^^^^^^^^^^^^^
|
|
= note: ...because `GenericTrait` has the bound `Sized`
|
|
help: change the bounds that require `Sized`, or remove the `?Sized` bound
|
|
|
|
|
LL - fn in_generic_trait<T: GenericTrait<U> + ?Sized, U>() {}
|
|
LL + fn in_generic_trait<T: GenericTrait<U>, U>() {}
|
|
|
|
|
|
|
error: `?Sized` bound is ignored because of a `Sized` requirement
|
|
--> tests/ui/needless_maybe_sized.rs:88:29
|
|
|
|
|
LL | fn larger_graph<T: A1 + ?Sized>() {}
|
|
| ^^^^^^
|
|
|
|
|
note: `T` cannot be unsized because of the bound
|
|
--> tests/ui/needless_maybe_sized.rs:88:24
|
|
|
|
|
LL | fn larger_graph<T: A1 + ?Sized>() {}
|
|
| ^^
|
|
= note: ...because `A1` has the bound `B2`
|
|
= note: ...because `B2` has the bound `Sized`
|
|
help: change the bounds that require `Sized`, or remove the `?Sized` bound
|
|
|
|
|
LL - fn larger_graph<T: A1 + ?Sized>() {}
|
|
LL + fn larger_graph<T: A1>() {}
|
|
|
|
|
|
|
error: aborting due to 20 previous errors
|
|
|