Skip to content

Commit 9b1b3d6

Browse files
tommilligancalebcartwright
authored andcommitted
[review] rename internal function
1 parent ba0351a commit 9b1b3d6

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

src/imports.rs

+5-2
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ impl UseSegment {
183183
}
184184
}
185185

186-
pub(crate) fn regroup_use_trees(
186+
pub(crate) fn normalize_use_trees_with_granularity(
187187
use_trees: Vec<UseTree>,
188188
import_granularity: ImportGranularity,
189189
) -> Vec<UseTree> {
@@ -1125,7 +1125,10 @@ mod test {
11251125
macro_rules! test_merge {
11261126
($by:ident, [$($input:expr),* $(,)*], [$($output:expr),* $(,)*]) => {
11271127
assert_eq!(
1128-
regroup_use_trees(parse_use_trees!($($input,)*), ImportGranularity::$by),
1128+
normalize_use_trees_with_granularity(
1129+
parse_use_trees!($($input,)*),
1130+
ImportGranularity::$by,
1131+
),
11291132
parse_use_trees!($($output,)*),
11301133
);
11311134
}

src/reorder.rs

+5-3
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use rustc_ast::ast;
1212
use rustc_span::{symbol::sym, Span};
1313

1414
use crate::config::{Config, GroupImportsTactic};
15-
use crate::imports::{regroup_use_trees, UseSegment, UseTree};
15+
use crate::imports::{normalize_use_trees_with_granularity, UseSegment, UseTree};
1616
use crate::items::{is_mod_decl, rewrite_extern_crate, rewrite_mod};
1717
use crate::lists::{itemize_list, write_list, ListFormatting, ListItem};
1818
use crate::rewrite::RewriteContext;
@@ -107,8 +107,10 @@ fn rewrite_reorderable_or_regroupable_items(
107107
for (item, list_item) in normalized_items.iter_mut().zip(list_items) {
108108
item.list_item = Some(list_item.clone());
109109
}
110-
normalized_items =
111-
regroup_use_trees(normalized_items, context.config.imports_granularity());
110+
normalized_items = normalize_use_trees_with_granularity(
111+
normalized_items,
112+
context.config.imports_granularity(),
113+
);
112114

113115
let mut regrouped_items = match context.config.group_imports() {
114116
GroupImportsTactic::Preserve | GroupImportsTactic::One => {

0 commit comments

Comments
 (0)