#![allow(unused)] #![warn(clippy::impl_trait_in_params)] //@no-rustfix pub trait Trait {} pub trait AnotherTrait {} // Should warn pub fn a(_: impl Trait) {} //~^ ERROR: `impl Trait` used as a function parameter pub fn c(_: C, _: impl Trait) {} //~^ ERROR: `impl Trait` used as a function parameter // Shouldn't warn pub fn b(_: B) {} fn e>(_: T) {} fn d(_: impl AnotherTrait) {} //------ IMPLS pub trait Public { // See test in ui-toml for a case where avoid-breaking-exported-api is set to false fn t(_: impl Trait); fn tt(_: T) {} } trait Private { // This shouldn't lint fn t(_: impl Trait); fn tt(_: T) {} } struct S; impl S { pub fn h(_: impl Trait) {} //~ ERROR: `impl Trait` used as a function parameter fn i(_: impl Trait) {} pub fn j(_: J) {} pub fn k>(_: K, _: impl AnotherTrait) {} //~ ERROR: `impl Trait` used as a function parameter } // Trying with traits impl Public for S { fn t(_: impl Trait) {} } fn main() {}