Skip to content

Unnecessary path prefixes #11888

@alice-i-cecile

Description

@alice-i-cecile

What it does

Strips out unnecessary path qualifiers on types/functions/structs when the module they are being imported from is already in scope.

See bevyengine/bevy#10749 for an example of this in practice, powered by RustRover's refactoring tools.

Advantage

  • clarifies that this is the standard, already imported form
  • reduces noise and saves characters

Drawbacks

Maybe makes imports less clear in cases where you really want to be explicit?

This is a weaker version of absolute_paths, focused on redundancy rather than enforcing a universal style. In some cases, you might want the latter.

Example

use bevy::prelude::*; let world = bevy::ecs::World::new();

Could be written as:

use bevy::prelude::*; let world = World::new();

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-lintArea: New lints

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions