Cleanup module declaration and imports #27
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What it does
Defines a uniform way to import modules, switches those messy
use super::super::super::super...
into always going to the root:Delegates the submodule declaration to each module, we used to have all modules declared in
main.rs
I took a very opinionated decision here, so let me know what you think, we could declare the modules and submodules for our current codebase as follows:
Option A
Option B
I went for option B, I believe having everything in the same folder makes it clearer and avoids a bunch of scrolling and clicking when navigating graphically through the codebase. It also makes module declaration feel more explicit even if the file also contains code. i.e.: you know you'll always find the mod declaration in the
mod.rs
fileI'd like to also set up a convention when organizing the imports at the top of the file, for the time being, I used:
Unrelated, but also finally ran
cargo fmt
and removed/docs
from the.gitignore
file (so you'll see diagrams added)