Consider the following:
use std::borrow::Cow;
use std::alloc::GlobalAlloc;
pub mod baz;
use std::cell::Cell;
use std::ascii::AsciiExt;
When running rustfmt, this sorts the use statements alphabetically, but leaves the mod in place:
use std::alloc::GlobalAlloc;
use std::borrow::Cow;
pub mod baz;
use std::ascii::AsciiExt;
use std::cell::Cell;
- Is there an established convention for whether all
mod statements should go above or below all use?
- If so, is there a way to enforce that in rustfmt?
Consider the following:
When running rustfmt, this sorts the use statements alphabetically, but leaves the mod in place:
modstatements should go above or below alluse?