-
Notifications
You must be signed in to change notification settings - Fork 102
Open
Description
Currently cargo fmt
will happily format imports in contiguous blocks alphabetically, but we generally prefer having a few blocks grouping {std, third-party, internal crates, this crate} in that order.
Example:
// GOOD
use std::sync::Arc;
use itertools::Itertools;
use serde::Deserialize;
use internal_crate::Something;
use crate::log_segment::ListedLogFiles;
use crate::Engine;
// BAD (all squished - and then fmt will actually re-order them to alphabetize)
use std::sync::Arc;
use itertools::Itertools;
use serde::Deserialize;
use internal_crate::Something;
use crate::log_segment::ListedLogFiles;
use crate::Engine;
I've looked into some solutions here but unfortunately adding the following to rustfmt.toml
is only available on nightly and does a bunch of deeply nested imports which we generally don't like:
imports_granularity = "Crate"
group_imports = "StdExternalCrate"
imports_layout = "Mixed"
Metadata
Metadata
Assignees
Labels
No labels