Relative paths and Rust 2018 `use` statements

I would always prefer explicitness over magic. I think both variants are equally on the wrong side of this. I like the idea of making non-relative paths explicit in all cases:

  • use extern::<crate name>::<rest of path>
  • use crate::<rest of path>
  • use super::<rest of path>
  • use <relative path>

Same for paths elsewhere. Make it explicit for non-relative paths and relative otherwise. No ambiguity (I think) ever.

2 Likes