Don't Use Preludes and Globs
corrode.dev
corrode.dev
I think it is worth pointing out what that really means.
The semver spec says:
"Minor version Y (x.Y.z | x > 0) MUST be incremented if new, backward compatible functionality is introduced to the public API." [1]
Unlike most other languages Rust has clear and written rules about what comprises a minor change.
"Adding new, public items is a minor change" [2]
If the new, public item gets glob imported and you already have an item with this name your code will not compile.
The consequence of all of this is that when using glob imports a minor update of a dependency can break your build, which is not what most people would expect.
[2] https://doc.rust-lang.org/cargo/reference/semver.html#item-n...
struct Foo;
struct Bar;
mod tests {
use super::*;
}
Apart from that, I use globs very rarely.