RS.CLIPPY.SINGLE_CHAR_LIFETIME_NAMES

Warns against single-character lifetime names

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

What it does

Checks for lifetimes with names which are one character long.

Why restrict this?

A single character is likely not enough to express the purpose of a lifetime. Using a longer name can make code easier to understand.

Known problems

Rust programmers and learning resources tend to use single character lifetimes, so this lint is at odds with the ecosystem at large. In addition, the lifetime's purpose may be obvious or, rarely, expressible in one character.

Example

struct DiagnosticCtx<\'a> {
    source: &\'a str,
}

Use instead:

struct DiagnosticCtx<\'src> {
    source: &\'src str,
}