Skip to content

reorder_imports=false conflicts with imports_indent="Visual" #4794

Open
@ickk

Description

@ickk

When using both imports_indent="Visual" and reorder_imports=false the alignments of all subsequent lines within the block are off by 4 spaces.

To Reproduce
source:

// rustfmt-imports_indent: Visual
// rustfmt-reorder_imports: false

use module::{
  submodule_A::{Type_A1, Type_A2},
  submodule_B::{Type_B1, Type_B2},
};

target:

// rustfmt-imports_indent: Visual
// rustfmt-reorder_imports: false

use module::{submodule_A::{Type_A1, Type_A2},
         submodule_B::{Type_B1, Type_B2}};

Expected behavior

// rustfmt-imports_indent: Visual
// rustfmt-reorder_imports: false

use module::{submodule_A::{Type_A1, Type_A2},
             submodule_B::{Type_B1, Type_B2}};

Note that:

  1. The correct thing happens when either imports_indent="Visual" or reorder_imports=false is set, but not when they are both set simultaneously.
  2. No reordering of modules needs to actually happen (or be prevented from happening) for this to occur.

Meta

  • rustfmt version: 94035f9 (HEAD -> master)

refs #3360

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions