From 17f236c2b041de7abd8ec3be208b8eff75fd7ffb Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 10 Dec 2020 17:41:57 +0300 Subject: Normalize spelling to American English --- crates/ide_db/src/helpers/insert_use.rs | 20 ++++++++++---------- crates/ide_db/src/helpers/insert_use/tests.rs | 16 ++++++++-------- 2 files changed, 18 insertions(+), 18 deletions(-) (limited to 'crates/ide_db') diff --git a/crates/ide_db/src/helpers/insert_use.rs b/crates/ide_db/src/helpers/insert_use.rs index 040843990..9be36d59b 100644 --- a/crates/ide_db/src/helpers/insert_use.rs +++ b/crates/ide_db/src/helpers/insert_use.rs @@ -93,7 +93,7 @@ fn is_inner_comment(token: SyntaxToken) -> bool { pub fn insert_use<'a>( scope: &ImportScope, path: ast::Path, - merge: Option, + merge: Option, ) -> SyntaxRewriter<'a> { let _p = profile::span("insert_use"); let mut rewriter = SyntaxRewriter::default(); @@ -183,7 +183,7 @@ fn eq_visibility(vis0: Option, vis1: Option) - pub fn try_merge_imports( lhs: &ast::Use, rhs: &ast::Use, - merge_behaviour: MergeBehaviour, + merge_behavior: MergeBehavior, ) -> Option { // don't merge imports with different visibilities if !eq_visibility(lhs.visibility(), rhs.visibility()) { @@ -191,14 +191,14 @@ pub fn try_merge_imports( } let lhs_tree = lhs.use_tree()?; let rhs_tree = rhs.use_tree()?; - let merged = try_merge_trees(&lhs_tree, &rhs_tree, merge_behaviour)?; + let merged = try_merge_trees(&lhs_tree, &rhs_tree, merge_behavior)?; Some(lhs.with_use_tree(merged)) } pub fn try_merge_trees( lhs: &ast::UseTree, rhs: &ast::UseTree, - merge: MergeBehaviour, + merge: MergeBehavior, ) -> Option { let lhs_path = lhs.path()?; let rhs_path = rhs.path()?; @@ -220,7 +220,7 @@ pub fn try_merge_trees( fn recursive_merge( lhs: &ast::UseTree, rhs: &ast::UseTree, - merge: MergeBehaviour, + merge: MergeBehavior, ) -> Option { let mut use_trees = lhs .use_tree_list() @@ -301,7 +301,7 @@ fn recursive_merge( } } Err(_) - if merge == MergeBehaviour::Last + if merge == MergeBehavior::Last && use_trees.len() > 0 && rhs_t.use_tree_list().is_some() => { @@ -438,20 +438,20 @@ fn path_segment_cmp(a: &ast::PathSegment, b: &ast::PathSegment) -> Ordering { /// What type of merges are allowed. #[derive(Copy, Clone, Debug, PartialEq, Eq)] -pub enum MergeBehaviour { +pub enum MergeBehavior { /// Merge everything together creating deeply nested imports. Full, /// Only merge the last import level, doesn't allow import nesting. Last, } -impl MergeBehaviour { +impl MergeBehavior { #[inline] fn is_tree_allowed(&self, tree: &ast::UseTree) -> bool { match self { - MergeBehaviour::Full => true, + MergeBehavior::Full => true, // only simple single segment paths are allowed - MergeBehaviour::Last => { + MergeBehavior::Last => { tree.use_tree_list().is_none() && tree.path().map(path_len) <= Some(1) } } diff --git a/crates/ide_db/src/helpers/insert_use/tests.rs b/crates/ide_db/src/helpers/insert_use/tests.rs index 86bfa5b41..9e194354e 100644 --- a/crates/ide_db/src/helpers/insert_use/tests.rs +++ b/crates/ide_db/src/helpers/insert_use/tests.rs @@ -533,7 +533,7 @@ fn merge_last_fail() { check_merge_only_fail( r"use foo::bar::{baz::{Qux, Fez}};", r"use foo::bar::{baaz::{Quux, Feez}};", - MergeBehaviour::Last, + MergeBehavior::Last, ); } @@ -542,7 +542,7 @@ fn merge_last_fail1() { check_merge_only_fail( r"use foo::bar::{baz::{Qux, Fez}};", r"use foo::bar::baaz::{Quux, Feez};", - MergeBehaviour::Last, + MergeBehavior::Last, ); } @@ -551,7 +551,7 @@ fn merge_last_fail2() { check_merge_only_fail( r"use foo::bar::baz::{Qux, Fez};", r"use foo::bar::{baaz::{Quux, Feez}};", - MergeBehaviour::Last, + MergeBehavior::Last, ); } @@ -560,7 +560,7 @@ fn merge_last_fail3() { check_merge_only_fail( r"use foo::bar::baz::{Qux, Fez};", r"use foo::bar::baaz::{Quux, Feez};", - MergeBehaviour::Last, + MergeBehavior::Last, ); } @@ -568,7 +568,7 @@ fn check( path: &str, ra_fixture_before: &str, ra_fixture_after: &str, - mb: Option, + mb: Option, module: bool, ) { let mut syntax = ast::SourceFile::parse(ra_fixture_before).tree().syntax().clone(); @@ -589,18 +589,18 @@ fn check( } fn check_full(path: &str, ra_fixture_before: &str, ra_fixture_after: &str) { - check(path, ra_fixture_before, ra_fixture_after, Some(MergeBehaviour::Full), false) + check(path, ra_fixture_before, ra_fixture_after, Some(MergeBehavior::Full), false) } fn check_last(path: &str, ra_fixture_before: &str, ra_fixture_after: &str) { - check(path, ra_fixture_before, ra_fixture_after, Some(MergeBehaviour::Last), false) + check(path, ra_fixture_before, ra_fixture_after, Some(MergeBehavior::Last), false) } fn check_none(path: &str, ra_fixture_before: &str, ra_fixture_after: &str) { check(path, ra_fixture_before, ra_fixture_after, None, false) } -fn check_merge_only_fail(ra_fixture0: &str, ra_fixture1: &str, mb: MergeBehaviour) { +fn check_merge_only_fail(ra_fixture0: &str, ra_fixture1: &str, mb: MergeBehavior) { let use0 = ast::SourceFile::parse(ra_fixture0) .tree() .syntax() -- cgit v1.2.3