I want to find a way to make sure that all the import paths in my project are consistent with each other.
For example, I want the import paths of A
in b.rs
and c.rs
to be the same (either crate::A
or crate::a::A
is ok).
Is there a rustfmt rule or a clippy rule which can enforce that?
// lib.rs
pub use a::A;
pub(crate) mod a;
pub(crate) mod b;
pub(crate) mod c;
// a.rs
pub struct A;
// b.rs
// 1
use crate::A;
// 2
use crate::a::A;
struct B(A);
// c.rs
// 1
use crate::A;
// 2
use crate::a::A;
struct C(A);