RS.CLIPPY.MISSING_ENFORCED_IMPORT_RENAMES

Enforce import renames

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

What it does

Checks for imports that do not rename the item as specified in the enforced-import-renames config option.

Note: Even though this lint is warn-by-default, it will only trigger if import renames are defined in the clippy.toml file.

Why is this bad?

Consistency is important; if a project has defined import renames, then they should be followed. More practically, some item names are too vague outside of their defining scope, in which case this can enforce a more meaningful naming.

Example

An example clippy.toml configuration:

enforced-import-renames = [
    { path = "serde_json::Value", rename = "JsonValue" },
]
use serde_json::Value;

Use instead:

use serde_json::Value as JsonValue;

Configuration

  • enforced-import-renames: The list of imports to always rename, a fully qualified path followed by the rename.

    (default: [])