From 9b1b3d69559750cf459638076dc32202110ec40e Mon Sep 17 00:00:00 2001 From: Tom Milligan Date: Sat, 16 Apr 2022 11:50:24 +0100 Subject: [PATCH] [review] rename internal function --- src/imports.rs | 7 +++++-- src/reorder.rs | 8 +++++--- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/imports.rs b/src/imports.rs index 485a72b85da..efe4e9498c9 100644 --- a/src/imports.rs +++ b/src/imports.rs @@ -183,7 +183,7 @@ fn from_path_segment( } } -pub(crate) fn regroup_use_trees( +pub(crate) fn normalize_use_trees_with_granularity( use_trees: Vec, import_granularity: ImportGranularity, ) -> Vec { @@ -1125,7 +1125,10 @@ macro_rules! parse_use_trees { macro_rules! test_merge { ($by:ident, [$($input:expr),* $(,)*], [$($output:expr),* $(,)*]) => { assert_eq!( - regroup_use_trees(parse_use_trees!($($input,)*), ImportGranularity::$by), + normalize_use_trees_with_granularity( + parse_use_trees!($($input,)*), + ImportGranularity::$by, + ), parse_use_trees!($($output,)*), ); } diff --git a/src/reorder.rs b/src/reorder.rs index f565612ded1..8ae297de25b 100644 --- a/src/reorder.rs +++ b/src/reorder.rs @@ -12,7 +12,7 @@ use rustc_span::{symbol::sym, Span}; use crate::config::{Config, GroupImportsTactic}; -use crate::imports::{regroup_use_trees, UseSegment, UseTree}; +use crate::imports::{normalize_use_trees_with_granularity, UseSegment, UseTree}; use crate::items::{is_mod_decl, rewrite_extern_crate, rewrite_mod}; use crate::lists::{itemize_list, write_list, ListFormatting, ListItem}; use crate::rewrite::RewriteContext; @@ -107,8 +107,10 @@ fn rewrite_reorderable_or_regroupable_items( for (item, list_item) in normalized_items.iter_mut().zip(list_items) { item.list_item = Some(list_item.clone()); } - normalized_items = - regroup_use_trees(normalized_items, context.config.imports_granularity()); + normalized_items = normalize_use_trees_with_granularity( + normalized_items, + context.config.imports_granularity(), + ); let mut regrouped_items = match context.config.group_imports() { GroupImportsTactic::Preserve | GroupImportsTactic::One => {