RS.CLIPPY.IMPL_TRAIT_IN_PARAMS

`impl Trait` is used in the function's parameters

This checker is a Clippy lint created by The Rust Project Contributors. The documentation shown here is a copy of the original documentation for: impl_trait_in_params. Copyright ©2025 The Rust Team. All rights reserved.

What it does

Lints when impl Trait is being used in a function's parameters.

Why restrict this?

Turbofish syntax (::<>) cannot be used to specify the type of an impl Trait parameter, making impl Trait less powerful. Readability may also be a factor.

Example

trait MyTrait {}
fn foo(a: impl MyTrait) {
\t// [...]
}

Use instead:

trait MyTrait {}
fn foo<T: MyTrait>(a: T) {
\t// [...]
}