You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Require self before paths in use statements that are relative to self.
Advantage
I found out that I'd want to easily distinguish between imports of my code and imports from other crates, and currently I can't easily distinguish between them.
A possible solution is to require adding self before relative imports. This makes it easy to distinguish between the two kinds, since local imports will always start with self, crate or super.
This would also make it easier to organize the imports according to their kind, like what the unstable rust-fmt option group_imports = StdExternalCrate does.
I don't suggest to enable this lint by default.
Drawbacks
I don't think of drawbacks, but I won't be surpried if others would think of some...
Example
use my_module::my_function;
Could be written as:
useself::my_module::my_function;
Note
If this is approved, I'd be happy to try to implement this.
The text was updated successfully, but these errors were encountered:
What it does
Require
self
before paths inuse
statements that are relative to self.Advantage
I found out that I'd want to easily distinguish between imports of my code and imports from other crates, and currently I can't easily distinguish between them.
A possible solution is to require adding
self
before relative imports. This makes it easy to distinguish between the two kinds, since local imports will always start withself
,crate
orsuper
.This would also make it easier to organize the imports according to their kind, like what the unstable rust-fmt option group_imports =
StdExternalCrate
does.I don't suggest to enable this lint by default.
Drawbacks
I don't think of drawbacks, but I won't be surpried if others would think of some...
Example
Could be written as:
Note
If this is approved, I'd be happy to try to implement this.
The text was updated successfully, but these errors were encountered: