From 95c8c65139c10e4de44367fead8dff88511e6d46 Mon Sep 17 00:00:00 2001 From: Lukas Wirth Date: Thu, 17 Jun 2021 17:37:14 +0200 Subject: Nest all the or-patterns! --- crates/ide/src/join_lines.rs | 2 +- crates/ide/src/references.rs | 3 +-- crates/ide/src/syntax_highlighting.rs | 4 ++-- 3 files changed, 4 insertions(+), 5 deletions(-) (limited to 'crates/ide/src') diff --git a/crates/ide/src/join_lines.rs b/crates/ide/src/join_lines.rs index 93d3760bf..ffa8bd182 100644 --- a/crates/ide/src/join_lines.rs +++ b/crates/ide/src/join_lines.rs @@ -197,7 +197,7 @@ fn join_single_use_tree(edit: &mut TextEditBuilder, token: &SyntaxToken) -> Opti } fn is_trailing_comma(left: SyntaxKind, right: SyntaxKind) -> bool { - matches!((left, right), (T![,], T![')']) | (T![,], T![']'])) + matches!((left, right), (T![,], T![')'] | T![']'])) } fn compute_ws(left: SyntaxKind, right: SyntaxKind) -> &'static str { diff --git a/crates/ide/src/references.rs b/crates/ide/src/references.rs index 945c9b9e1..5808562a7 100644 --- a/crates/ide/src/references.rs +++ b/crates/ide/src/references.rs @@ -79,8 +79,7 @@ pub(crate) fn find_all_refs( }); usages.references.retain(|_, it| !it.is_empty()); } - Definition::ModuleDef(hir::ModuleDef::Adt(_)) - | Definition::ModuleDef(hir::ModuleDef::Variant(_)) => { + Definition::ModuleDef(hir::ModuleDef::Adt(_) | hir::ModuleDef::Variant(_)) => { refs.for_each(|it| { it.retain(|reference| { reference.name.as_name_ref().map_or(false, is_lit_name_ref) diff --git a/crates/ide/src/syntax_highlighting.rs b/crates/ide/src/syntax_highlighting.rs index e186b82b7..d44a1b45f 100644 --- a/crates/ide/src/syntax_highlighting.rs +++ b/crates/ide/src/syntax_highlighting.rs @@ -294,7 +294,7 @@ fn traverse( Some(parent) => { // We only care Name and Name_ref match (token.kind(), parent.kind()) { - (IDENT, NAME) | (IDENT, NAME_REF) => parent.into(), + (IDENT, NAME | NAME_REF) => parent.into(), _ => token.into(), } } @@ -310,7 +310,7 @@ fn traverse( Some(parent) => { // We only care Name and Name_ref match (token.kind(), parent.kind()) { - (IDENT, NAME) | (IDENT, NAME_REF) => parent.into(), + (IDENT, NAME | NAME_REF) => parent.into(), _ => token.into(), } } -- cgit v1.2.3