#![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 + 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 {} 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 good_trait_object(arg0: &(dyn Any + Send)) { unimplemented!(); } fn bad_trait_object(arg0: &(dyn Any + Send)) { unimplemented!(); } fn main() {}