Skip to content

Group use vs mod statements #3959

@dakom

Description

@dakom

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;
  1. Is there an established convention for whether all mod statements should go above or below all use?
  2. If so, is there a way to enforce that in rustfmt?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions