Email me

Clippy lints / Style

Clippy lint · Style · checked with Clippy 0.1.99

clippy::upper_case_acronyms: Checks for fully capitalized names and optionally names containing a capitalized acronym

What it meansChecks for fully capitalized names and optionally names containing a capitalized acronym. It is in the style group and warns by default.

Does it matter?

In CamelCase, acronyms count as one word. See naming conventions for more. By default, the lint only triggers on fully-capitalized names. You can use the upper-case-acronyms-aggressive: true config option to enable linting on all camel case names

Code that works but is not idiomatic Rust. Warns by default.

How to fix it

Clippy does not fix this one automatically (its suggestion may change behaviour, so it only shows it). Change the code by hand:

Flagged

struct HTTPResponse;

Write this instead

struct HttpResponse;

Turn it off, or on

Allow it where it does not fit your code, as narrowly as you can:

On one item

#[allow(clippy::upper_case_acronyms)]
fn my_function() { /* ... */ }

Whole crate (Cargo.toml)

[lints.clippy]
upper_case_acronyms = "allow"

One run

cargo clippy -- -A clippy::upper-case-acronyms

The [lints] table needs Rust 1.74 or newer. In a workspace, put it under [workspace.lints.clippy] and add [lints] workspace = true to each member.

Settings in clippy.toml

  • avoid-breaking-exported-api: Suppress lints whenever the suggested change would cause breakage for other crates.
  • upper-case-acronyms-aggressive: Enables verbose mode. Triggers if there is more than one uppercase char next to each other
Stylegroup
warndefault level
nofixed by cargo clippy --fix
1.51.0added in Rust

Clippy's own documentation

What it does

Checks for fully capitalized names and optionally names containing a capitalized acronym.

Why is this bad?

In CamelCase, acronyms count as one word. See naming conventions for more.

By default, the lint only triggers on fully-capitalized names. You can use the upper-case-acronyms-aggressive: true config option to enable linting on all camel case names

Known problems

When two acronyms are contiguous, the lint can’t tell where the first acronym ends and the second starts, so it suggests to lowercase all of the letters in the second acronym.

Example

struct HTTPResponse;

Use instead:

struct HttpResponse;

Configuration

  • avoid-breaking-exported-api: Suppress lints whenever the suggested change would cause breakage for other crates.

    (default: true)

  • upper-case-acronyms-aggressive: Enables verbose mode. Triggers if there is more than one uppercase char next to each other

    (default: false)

From the Clippy lint list (0.1.99), part of the Rust project, MIT or Apache-2.0. Official entry.

Related lints

All 847 Clippy lints · Rust compiler errors · Cargo.toml checker

Up next

Related lintclippy::needless_returnunneeded `return` statementRead it next →

Did this answer your question?

Get the receipts by email.

What my AI agents tried this week, with the real numbers: what worked, what flopped, what made money. One email when there is something worth reading.

No spam, never sold. Every email has a one-click unsubscribe.

Popular in the shop

All 124 tools →

Browse: Bundles and kitsHome, family and schoolMoney and businessAI toolsSports and fitnessMaking and hobbiesFood and drinkIndie dev and launchTrading and quant

Free: Landing page teardown iPhone app cost calculator LLM API cost calculator Paid online: $49 Launch Check App builds Articles FAQ