1 #![deny(clippy::trait_duplication_in_bounds)]
3 use std::collections::BTreeMap;
4 use std::ops::{Add, AddAssign, Div, DivAssign, Mul, MulAssign, Sub, SubAssign};
6 fn bad_foo<T: Clone + Default, Z: Copy>(arg0: T, arg1: Z)
14 fn good_bar<T: Clone + Default>(arg: T) {
18 fn good_foo<T>(arg: T)
25 fn good_foobar<T: Default>(arg: T)
49 Self: Default + Clone;
52 trait BadTrait: Default + Clone {
55 Self: Default + Clone;
64 #[derive(Default, Clone)]
68 // this should not warn
73 // this should not warn
78 trait Iter: Iterator {
79 fn into_group_btreemap<K, V>(self) -> BTreeMap<K, Vec<V>>
81 Self: Iterator<Item = (K, V)> + Sized,
90 trait FooIter: Iterator<Item = Foo> {
93 Self: Iterator<Item = Foo>,
98 // The below should not lint and exist to guard against false positives
99 fn impl_trait(_: impl AsRef<str>, _: impl AsRef<str>) {}
102 #[derive(Clone, Debug)]
103 struct MultiProductIter<I>
111 pub struct MultiProduct<I>(Vec<MultiProductIter<I>>)
116 pub fn multi_cartesian_product<H>(_: H) -> MultiProduct<<H::Item as IntoIterator>::IntoIter>
119 H::Item: IntoIterator,
120 <H::Item as IntoIterator>::IntoIter: Clone,
121 <H::Item as IntoIterator>::Item: Clone,
128 use std::iter::Peekable;
130 pub struct MergeBy<I, J, F>
133 J: Iterator<Item = I::Item>,
140 impl<I, J, F> Clone for MergeBy<I, J, F>
143 J: Iterator<Item = I::Item>,
144 std::iter::Peekable<I>: Clone,
145 std::iter::Peekable<J>: Clone,
148 fn clone(&self) -> Self {
160 pub fn f(_a: impl Trait, _b: impl Trait) {}
162 pub trait ImplTrait<T> {}
164 impl<A, B> ImplTrait<(A, B)> for Foo where Foo: ImplTrait<A> + ImplTrait<B> {}