2023-02-25 18:08:29 -06:00
|
|
|
#![allow(unused)]
|
|
|
|
#![warn(clippy::impl_trait_in_params)]
|
2023-08-24 14:32:12 -05:00
|
|
|
//@no-rustfix
|
2023-02-25 18:08:29 -06:00
|
|
|
pub trait Trait {}
|
|
|
|
pub trait AnotherTrait<T> {}
|
|
|
|
|
|
|
|
// Should warn
|
|
|
|
pub fn a(_: impl Trait) {}
|
2023-08-24 14:32:12 -05:00
|
|
|
//~^ ERROR: '`impl Trait` used as a function parameter'
|
|
|
|
//~| NOTE: `-D clippy::impl-trait-in-params` implied by `-D warnings`
|
2023-02-25 18:08:29 -06:00
|
|
|
pub fn c<C: Trait>(_: C, _: impl Trait) {}
|
2023-08-24 14:32:12 -05:00
|
|
|
//~^ ERROR: '`impl Trait` used as a function parameter'
|
2023-02-25 18:08:29 -06:00
|
|
|
fn d(_: impl AnotherTrait<u32>) {}
|
|
|
|
|
|
|
|
// Shouldn't warn
|
|
|
|
|
|
|
|
pub fn b<B: Trait>(_: B) {}
|
|
|
|
fn e<T: AnotherTrait<u32>>(_: T) {}
|
|
|
|
|
|
|
|
fn main() {}
|