From a5255ef4c5df7e02c7532401b47dfa8ce0acb1a1 Mon Sep 17 00:00:00 2001 From: Allen Hsu Date: Sat, 9 Jul 2022 20:43:52 +1000 Subject: [PATCH] Disable rustfix until original trait_duplication_in_bounds is refactored. `trait_duplication_in_bounds` is detecting the same errors and reporting them differently. This causes the fixed file to fail to compile. --- tests/compile-test.rs | 1 + tests/ui/trait_duplication_in_bounds.fixed | 214 -------------------- tests/ui/trait_duplication_in_bounds.rs | 2 - tests/ui/trait_duplication_in_bounds.stderr | 46 ++--- 4 files changed, 24 insertions(+), 239 deletions(-) delete mode 100644 tests/ui/trait_duplication_in_bounds.fixed diff --git a/tests/compile-test.rs b/tests/compile-test.rs index 41048298349e..52cf751c8d0b 100644 --- a/tests/compile-test.rs +++ b/tests/compile-test.rs @@ -397,6 +397,7 @@ const RUSTFIX_COVERAGE_KNOWN_EXCEPTIONS: &[&str] = &[ "single_component_path_imports_nested_first.rs", "string_add.rs", "toplevel_ref_arg_non_rustfix.rs", + "trait_duplication_in_bounds.rs", "unit_arg.rs", "unnecessary_clone.rs", "unnecessary_lazy_eval_unfixable.rs", diff --git a/tests/ui/trait_duplication_in_bounds.fixed b/tests/ui/trait_duplication_in_bounds.fixed deleted file mode 100644 index 3057dd16fcfb..000000000000 --- a/tests/ui/trait_duplication_in_bounds.fixed +++ /dev/null @@ -1,214 +0,0 @@ -// run-rustfix -// -#![deny(clippy::trait_duplication_in_bounds)] -#![allow(unused)] - -use std::collections::BTreeMap; -use std::ops::{Add, AddAssign, Div, DivAssign, Mul, MulAssign, Sub, SubAssign}; - -fn bad_foo(arg0: T, arg1: Z) -where - T: Clone, - T: Default, -{ - unimplemented!(); -} - -fn good_bar(arg: T) { - unimplemented!(); -} - -fn good_foo(arg: T) -where - T: Clone + Default, -{ - unimplemented!(); -} - -fn good_foobar(arg: T) -where - T: Clone, -{ - unimplemented!(); -} - -trait T: Default { - fn f() - where - Self: Default; -} - -trait U: Default { - fn f() - where - Self: Clone; -} - -trait ZZ: Default { - fn g(); - fn h(); - fn f() - where - Self: Default + Clone; -} - -trait BadTrait: Default + Clone { - fn f() - where - Self: Default + Clone; - fn g() - where - Self: Default; - fn h() - where - Self: Copy; -} - -#[derive(Default, Clone)] -struct Life; - -impl T for Life { - // this should not warn - fn f() {} -} - -impl U for Life { - // this should not warn - fn f() {} -} - -// should not warn -trait Iter: Iterator { - fn into_group_btreemap(self) -> BTreeMap> - where - Self: Iterator + Sized, - K: Ord + Eq, - { - unimplemented!(); - } -} - -struct Foo; - -trait FooIter: Iterator { - fn bar() - where - Self: Iterator, - { - } -} - -// This should not lint -fn impl_trait(_: impl AsRef, _: impl AsRef) {} - -mod repeated_where_clauses_or_trait_bounds { - fn bad_foo(arg0: T, argo1: U) { - unimplemented!(); - } - - fn bad_bar(arg0: T, arg1: U) - where - T: Clone + Copy, - U: Clone + Copy, - { - unimplemented!(); - } - - fn good_bar(arg0: T, arg1: U) { - unimplemented!(); - } - - fn good_foo(arg0: T, arg1: U) - where - T: Clone + Copy, - U: Clone + Copy, - { - unimplemented!(); - } - - trait GoodSelfTraitBound: Clone + Copy { - fn f(); - } - - trait GoodSelfWhereClause { - fn f() - where - Self: Clone + Copy; - } - - trait BadSelfTraitBound: Clone { - fn f(); - } - - trait BadSelfWhereClause { - fn f() - where - Self: Clone; - } - - trait GoodTraitBound { - fn f(); - } - - trait GoodWhereClause { - fn f() - where - T: Clone + Copy, - U: Clone + Copy; - } - - trait BadTraitBound { - fn f(); - } - - trait BadWhereClause { - fn f() - where - T: Clone + Copy, - U: Clone + Copy; - } - - struct GoodStructBound { - t: T, - u: U, - } - - impl GoodTraitBound for GoodStructBound { - // this should not warn - fn f() {} - } - - struct GoodStructWhereClause; - - impl GoodTraitBound for GoodStructWhereClause - where - T: Clone + Copy, - U: Clone + Copy, - { - // this should not warn - fn f() {} - } - - fn no_error_separate_arg_bounds(program: impl AsRef<()>, dir: impl AsRef<()>, args: &[impl AsRef<()>]) {} - - trait GenericTrait {} - - // This should not warn but currently does see #8757 - fn good_generic + GenericTrait>(arg0: T) { - unimplemented!(); - } - - fn bad_generic + GenericTrait>(arg0: T) { - unimplemented!(); - } - - mod foo { - pub trait Clone {} - } - - fn qualified_path(arg0: T) { - unimplemented!(); - } -} - -fn main() {} diff --git a/tests/ui/trait_duplication_in_bounds.rs b/tests/ui/trait_duplication_in_bounds.rs index a03f334e0401..a5751c58aab8 100644 --- a/tests/ui/trait_duplication_in_bounds.rs +++ b/tests/ui/trait_duplication_in_bounds.rs @@ -1,5 +1,3 @@ -// run-rustfix -// #![deny(clippy::trait_duplication_in_bounds)] #![allow(unused)] diff --git a/tests/ui/trait_duplication_in_bounds.stderr b/tests/ui/trait_duplication_in_bounds.stderr index 3707a1d2f12b..7ef04e52708f 100644 --- a/tests/ui/trait_duplication_in_bounds.stderr +++ b/tests/ui/trait_duplication_in_bounds.stderr @@ -1,18 +1,18 @@ error: this trait bound is already specified in the where clause - --> $DIR/trait_duplication_in_bounds.rs:9:15 + --> $DIR/trait_duplication_in_bounds.rs:7:15 | LL | fn bad_foo(arg0: T, arg1: Z) | ^^^^^ | note: the lint level is defined here - --> $DIR/trait_duplication_in_bounds.rs:3:9 + --> $DIR/trait_duplication_in_bounds.rs:1:9 | LL | #![deny(clippy::trait_duplication_in_bounds)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = help: consider removing this trait bound error: this trait bound is already specified in the where clause - --> $DIR/trait_duplication_in_bounds.rs:9:23 + --> $DIR/trait_duplication_in_bounds.rs:7:23 | LL | fn bad_foo(arg0: T, arg1: Z) | ^^^^^^^ @@ -20,7 +20,7 @@ LL | fn bad_foo(arg0: T, arg1: Z) = help: consider removing this trait bound error: this trait bound is already specified in trait declaration - --> $DIR/trait_duplication_in_bounds.rs:38:15 + --> $DIR/trait_duplication_in_bounds.rs:36:15 | LL | Self: Default; | ^^^^^^^ @@ -28,7 +28,7 @@ LL | Self: Default; = help: consider removing this trait bound error: this trait bound is already specified in trait declaration - --> $DIR/trait_duplication_in_bounds.rs:52:15 + --> $DIR/trait_duplication_in_bounds.rs:50:15 | LL | Self: Default + Clone; | ^^^^^^^ @@ -36,7 +36,7 @@ LL | Self: Default + Clone; = help: consider removing this trait bound error: this trait bound is already specified in trait declaration - --> $DIR/trait_duplication_in_bounds.rs:58:15 + --> $DIR/trait_duplication_in_bounds.rs:56:15 | LL | Self: Default + Clone; | ^^^^^^^ @@ -44,7 +44,7 @@ LL | Self: Default + Clone; = help: consider removing this trait bound error: this trait bound is already specified in trait declaration - --> $DIR/trait_duplication_in_bounds.rs:58:25 + --> $DIR/trait_duplication_in_bounds.rs:56:25 | LL | Self: Default + Clone; | ^^^^^ @@ -52,7 +52,7 @@ LL | Self: Default + Clone; = help: consider removing this trait bound error: this trait bound is already specified in trait declaration - --> $DIR/trait_duplication_in_bounds.rs:61:15 + --> $DIR/trait_duplication_in_bounds.rs:59:15 | LL | Self: Default; | ^^^^^^^ @@ -60,7 +60,7 @@ LL | Self: Default; = help: consider removing this trait bound error: this trait bound is already specified in trait declaration - --> $DIR/trait_duplication_in_bounds.rs:96:15 + --> $DIR/trait_duplication_in_bounds.rs:94:15 | LL | Self: Iterator, | ^^^^^^^^^^^^^^^^^^^^ @@ -68,7 +68,7 @@ LL | Self: Iterator, = help: consider removing this trait bound error: this trait bound is already specified in the where clause - --> $DIR/trait_duplication_in_bounds.rs:105:19 + --> $DIR/trait_duplication_in_bounds.rs:103:19 | LL | fn bad_foo(arg0: T, argo1: U) { | ^^^^^ @@ -76,13 +76,13 @@ LL | fn bad_foo(arg0: T, a = help: consider removing this trait bound error: these bounds contain repeated elements - --> $DIR/trait_duplication_in_bounds.rs:105:19 + --> $DIR/trait_duplication_in_bounds.rs:103:19 | LL | fn bad_foo(arg0: T, argo1: U) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `Clone + Copy` error: this trait bound is already specified in the where clause - --> $DIR/trait_duplication_in_bounds.rs:111:12 + --> $DIR/trait_duplication_in_bounds.rs:109:12 | LL | T: Clone + Clone + Clone + Copy, | ^^^^^ @@ -90,25 +90,25 @@ LL | T: Clone + Clone + Clone + Copy, = help: consider removing this trait bound error: these where clauses contain repeated elements - --> $DIR/trait_duplication_in_bounds.rs:111:12 + --> $DIR/trait_duplication_in_bounds.rs:109:12 | LL | T: Clone + Clone + Clone + Copy, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `Clone + Copy` error: these bounds contain repeated elements - --> $DIR/trait_duplication_in_bounds.rs:139:30 + --> $DIR/trait_duplication_in_bounds.rs:137:30 | LL | trait BadSelfTraitBound: Clone + Clone + Clone { | ^^^^^^^^^^^^^^^^^^^^^ help: try: `Clone` error: these where clauses contain repeated elements - --> $DIR/trait_duplication_in_bounds.rs:146:19 + --> $DIR/trait_duplication_in_bounds.rs:144:19 | LL | Self: Clone + Clone + Clone; | ^^^^^^^^^^^^^^^^^^^^^ help: try: `Clone` error: this trait bound is already specified in the where clause - --> $DIR/trait_duplication_in_bounds.rs:160:28 + --> $DIR/trait_duplication_in_bounds.rs:158:28 | LL | trait BadTraitBound { | ^^^^^ @@ -116,19 +116,19 @@ LL | trait BadTraitBound { = help: consider removing this trait bound error: these bounds contain repeated elements - --> $DIR/trait_duplication_in_bounds.rs:160:28 + --> $DIR/trait_duplication_in_bounds.rs:158:28 | LL | trait BadTraitBound { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `Clone + Copy` error: these where clauses contain repeated elements - --> $DIR/trait_duplication_in_bounds.rs:167:16 + --> $DIR/trait_duplication_in_bounds.rs:165:16 | LL | T: Clone + Clone + Clone + Copy, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `Clone + Copy` error: this trait bound is already specified in the where clause - --> $DIR/trait_duplication_in_bounds.rs:197:24 + --> $DIR/trait_duplication_in_bounds.rs:195:24 | LL | fn good_generic + GenericTrait>(arg0: T) { | ^^^^^^^^^^^^^^^^^ @@ -136,7 +136,7 @@ LL | fn good_generic + GenericTrait>(arg0: T) { = help: consider removing this trait bound error: this trait bound is already specified in the where clause - --> $DIR/trait_duplication_in_bounds.rs:201:23 + --> $DIR/trait_duplication_in_bounds.rs:199:23 | LL | fn bad_generic + GenericTrait + GenericTrait>(arg0: T) { | ^^^^^^^^^^^^^^^^^ @@ -144,13 +144,13 @@ LL | fn bad_generic + GenericTrait + GenericTrait< = help: consider removing this trait bound error: these bounds contain repeated elements - --> $DIR/trait_duplication_in_bounds.rs:201:23 + --> $DIR/trait_duplication_in_bounds.rs:199:23 | LL | fn bad_generic + GenericTrait + GenericTrait>(arg0: T) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `GenericTrait + GenericTrait` error: this trait bound is already specified in the where clause - --> $DIR/trait_duplication_in_bounds.rs:209:26 + --> $DIR/trait_duplication_in_bounds.rs:207:26 | LL | fn qualified_path(arg0: T) { | ^^^^^^^^^^^^^^^^^ @@ -158,7 +158,7 @@ LL | fn qualified_path(arg0: T) { = help: consider removing this trait bound error: these bounds contain repeated elements - --> $DIR/trait_duplication_in_bounds.rs:209:26 + --> $DIR/trait_duplication_in_bounds.rs:207:26 | LL | fn qualified_path(arg0: T) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `Clone + foo::Clone`