RS.CLIPPY.ELIDABLE_LIFETIME_NAMES
Lifetime name that can be replaced with the anonymous lifetime
This checker is a Clippy lint created by The Rust Project Contributors. The documentation shown here is a copy of the original documentation for: elidable_lifetime_names. Copyright ©2025 The Rust Team. All rights reserved.
What it does
Checks for lifetime annotations which can be replaced with anonymous lifetimes (\'_).
Why is this bad?
The additional lifetimes can make the code look more complicated.
Known problems
This lint ignores functions with where clauses that reference
lifetimes to prevent false positives.
Example
fn f<\'a>(x: &\'a str) -> Chars<\'a> {
x.chars()
}
Use instead:
fn f(x: &str) -> Chars<\'_> {
x.chars()
}