#![deny(clippy::trait_duplication_in_bounds)] #![allow(unused)] use std::any::Any; fn bad_foo(arg0: T, argo1: U) { unimplemented!(); } fn bad_bar(arg0: T, arg1: U) where T: Clone + Clone + 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 + Clone + Clone { fn f(); } trait BadSelfWhereClause { fn f() where Self: Clone + Clone + 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 + Clone + 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 {} fn good_generic + GenericTrait>(arg0: T) { unimplemented!(); } fn bad_generic + GenericTrait + GenericTrait>(arg0: T) { unimplemented!(); } mod foo { pub trait Clone {} } fn qualified_path(arg0: T) { unimplemented!(); } fn good_trait_object(arg0: &(dyn Any + Send)) { unimplemented!(); } fn bad_trait_object(arg0: &(dyn Any + Send + Send)) { unimplemented!(); } trait Proj { type S; } impl Proj for () { type S = (); } impl Proj for i32 { type S = i32; } trait Base { fn is_base(&self); } trait Derived: Base + Base<()> { fn is_derived(&self); } fn f(obj: &dyn Derived

) { obj.is_derived(); Base::::is_base(obj); Base::<()>::is_base(obj); } fn main() { let _x: fn(_) = f::<()>; let _x: fn(_) = f::; }