2020-07-28 14:23:47 +00:00
|
|
|
#![deny(clippy::trait_duplication_in_bounds)]
|
|
|
|
|
2022-01-20 05:38:48 +00:00
|
|
|
use std::collections::BTreeMap;
|
2020-07-28 14:23:47 +00:00
|
|
|
use std::ops::{Add, AddAssign, Div, DivAssign, Mul, MulAssign, Sub, SubAssign};
|
|
|
|
|
|
|
|
fn bad_foo<T: Clone + Default, Z: Copy>(arg0: T, arg1: Z)
|
|
|
|
where
|
|
|
|
T: Clone,
|
|
|
|
T: Default,
|
|
|
|
{
|
|
|
|
unimplemented!();
|
|
|
|
}
|
|
|
|
|
|
|
|
fn good_bar<T: Clone + Default>(arg: T) {
|
|
|
|
unimplemented!();
|
|
|
|
}
|
|
|
|
|
|
|
|
fn good_foo<T>(arg: T)
|
|
|
|
where
|
|
|
|
T: Clone + Default,
|
|
|
|
{
|
|
|
|
unimplemented!();
|
|
|
|
}
|
|
|
|
|
|
|
|
fn good_foobar<T: Default>(arg: T)
|
|
|
|
where
|
|
|
|
T: Clone,
|
|
|
|
{
|
|
|
|
unimplemented!();
|
|
|
|
}
|
|
|
|
|
2022-01-06 10:43:44 +00:00
|
|
|
trait T: Default {
|
|
|
|
fn f()
|
|
|
|
where
|
|
|
|
Self: Default;
|
|
|
|
}
|
|
|
|
|
|
|
|
trait U: Default {
|
|
|
|
fn f()
|
|
|
|
where
|
|
|
|
Self: Clone;
|
|
|
|
}
|
|
|
|
|
|
|
|
trait ZZ: Default {
|
2022-01-10 04:45:01 +00:00
|
|
|
fn g();
|
|
|
|
fn h();
|
2022-01-06 10:43:44 +00:00
|
|
|
fn f()
|
|
|
|
where
|
|
|
|
Self: Default + Clone;
|
|
|
|
}
|
|
|
|
|
|
|
|
trait BadTrait: Default + Clone {
|
|
|
|
fn f()
|
|
|
|
where
|
|
|
|
Self: Default + Clone;
|
2022-01-10 04:45:01 +00:00
|
|
|
fn g()
|
|
|
|
where
|
|
|
|
Self: Default;
|
|
|
|
fn h()
|
|
|
|
where
|
|
|
|
Self: Copy;
|
2022-01-06 10:43:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Default, Clone)]
|
2022-03-27 12:41:09 +00:00
|
|
|
struct Life;
|
2022-01-06 10:43:44 +00:00
|
|
|
|
|
|
|
impl T for Life {
|
|
|
|
// this should not warn
|
|
|
|
fn f() {}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl U for Life {
|
|
|
|
// this should not warn
|
|
|
|
fn f() {}
|
|
|
|
}
|
|
|
|
|
2022-01-20 05:38:48 +00:00
|
|
|
// should not warn
|
|
|
|
trait Iter: Iterator {
|
|
|
|
fn into_group_btreemap<K, V>(self) -> BTreeMap<K, Vec<V>>
|
|
|
|
where
|
|
|
|
Self: Iterator<Item = (K, V)> + Sized,
|
|
|
|
K: Ord + Eq,
|
|
|
|
{
|
|
|
|
unimplemented!();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-03-27 12:41:09 +00:00
|
|
|
struct Foo;
|
2022-01-20 05:38:48 +00:00
|
|
|
|
|
|
|
trait FooIter: Iterator<Item = Foo> {
|
|
|
|
fn bar()
|
|
|
|
where
|
|
|
|
Self: Iterator<Item = Foo>,
|
|
|
|
{
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-07-28 14:23:47 +00:00
|
|
|
fn main() {}
|