Skip to content

Commit

Permalink
Handle indented import groups
Browse files Browse the repository at this point in the history
  • Loading branch information
MattX committed Oct 28, 2020
1 parent a0b4a3b commit f8f55c7
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/formatting/reorder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,8 @@ fn rewrite_reorderable_or_regroupable_items(
})
.collect::<Option<Vec<_>>>()?;

Some(item_vec.join("\n\n"))
let join_string = format!("\n\n{}", shape.indent.to_string(context.config));
Some(item_vec.join(&join_string))
}
_ => {
let list_items = itemize_list(
Expand Down
6 changes: 6 additions & 0 deletions tests/source/configs/group_imports/StdExternalCrate-nested.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// rustfmt-group_imports: StdExternalCrate
mod test {
use crate::foo::bar;
use std::path;
use crate::foo::bar2;
}
7 changes: 7 additions & 0 deletions tests/target/configs/group_imports/StdExternalCrate-nested.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// rustfmt-group_imports: StdExternalCrate
mod test {
use std::path;

use crate::foo::bar;
use crate::foo::bar2;
}

0 comments on commit f8f55c7

Please sign in to comment.