// run-rustfix #![allow(dead_code)] fn duplicate_t(t: T) -> (T, T) { //~^ HELP consider restricting type parameter `T` (t, t) //~ use of moved value: `t` } fn duplicate_opt(t: Option) -> (Option, Option) { //~^ HELP consider restricting type parameter `T` (t, t) //~ use of moved value: `t` } fn duplicate_tup1(t: (T,)) -> ((T,), (T,)) { //~^ HELP consider restricting type parameter `T` (t, t) //~ use of moved value: `t` } fn duplicate_tup2(t: (A, B)) -> ((A, B), (A, B)) { //~^ HELP consider restricting type parameters (t, t) //~ use of moved value: `t` } fn duplicate_custom(t: S) -> (S, S) { //~^ HELP consider restricting type parameter `T` (t, t) //~ use of moved value: `t` } struct S(T); trait Trait {} impl Clone for S { fn clone(&self) -> Self { Self(self.0.clone()) } } impl Copy for S {} trait A {} trait B {} // Test where bounds are added with different bound placements fn duplicate_custom_1(t: S) -> (S, S) where { //~^ HELP consider restricting type parameter `T` (t, t) //~ use of moved value: `t` } fn duplicate_custom_2(t: S) -> (S, S) where T: A + Copy + Trait, //~^ HELP consider further restricting this bound { (t, t) //~ use of moved value: `t` } fn duplicate_custom_3(t: S) -> (S, S) where T: A + Copy + Trait, //~^ HELP consider further restricting this bound T: B, { (t, t) //~ use of moved value: `t` } fn duplicate_custom_4(t: S) -> (S, S) //~^ HELP consider further restricting this bound where T: B, { (t, t) //~ use of moved value: `t` } #[rustfmt::skip] fn existing_colon(t: T) { //~^ HELP consider restricting type parameter `T` [t, t]; //~ use of moved value: `t` } fn existing_colon_in_where(t: T) where T:, T: Copy //~^ HELP consider further restricting type parameter `T` { [t, t]; //~ use of moved value: `t` } fn main() {}