Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unnecessary path prefixes #11888

Closed
alice-i-cecile opened this issue Nov 27, 2023 · 1 comment
Closed

Unnecessary path prefixes #11888

alice-i-cecile opened this issue Nov 27, 2023 · 1 comment
Labels
A-lint Area: New lints

Comments

@alice-i-cecile
Copy link

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();
@EdJoPaTo
Copy link

There exists a rustc lint which is allowed-by-default: unused_qualifications

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-lint Area: New lints
Projects
None yet
Development

No branches or pull requests

2 participants