aboutsummaryrefslogtreecommitdiff
path: root/crates/ide/src
diff options
context:
space:
mode:
authorLukas Wirth <[email protected]>2021-06-17 16:37:14 +0100
committerLukas Wirth <[email protected]>2021-06-17 16:37:14 +0100
commit95c8c65139c10e4de44367fead8dff88511e6d46 (patch)
tree4326d46ee282c133123f3a08aaee7d640f007050 /crates/ide/src
parentc82a9141abe6b6cbf5b55710dc8a315a3839081b (diff)
Nest all the or-patterns!
Diffstat (limited to 'crates/ide/src')
-rw-r--r--crates/ide/src/join_lines.rs2
-rw-r--r--crates/ide/src/references.rs3
-rw-r--r--crates/ide/src/syntax_highlighting.rs4
3 files changed, 4 insertions, 5 deletions
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
197} 197}
198 198
199fn is_trailing_comma(left: SyntaxKind, right: SyntaxKind) -> bool { 199fn is_trailing_comma(left: SyntaxKind, right: SyntaxKind) -> bool {
200 matches!((left, right), (T![,], T![')']) | (T![,], T![']'])) 200 matches!((left, right), (T![,], T![')'] | T![']']))
201} 201}
202 202
203fn compute_ws(left: SyntaxKind, right: SyntaxKind) -> &'static str { 203fn 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(
79 }); 79 });
80 usages.references.retain(|_, it| !it.is_empty()); 80 usages.references.retain(|_, it| !it.is_empty());
81 } 81 }
82 Definition::ModuleDef(hir::ModuleDef::Adt(_)) 82 Definition::ModuleDef(hir::ModuleDef::Adt(_) | hir::ModuleDef::Variant(_)) => {
83 | Definition::ModuleDef(hir::ModuleDef::Variant(_)) => {
84 refs.for_each(|it| { 83 refs.for_each(|it| {
85 it.retain(|reference| { 84 it.retain(|reference| {
86 reference.name.as_name_ref().map_or(false, is_lit_name_ref) 85 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(
294 Some(parent) => { 294 Some(parent) => {
295 // We only care Name and Name_ref 295 // We only care Name and Name_ref
296 match (token.kind(), parent.kind()) { 296 match (token.kind(), parent.kind()) {
297 (IDENT, NAME) | (IDENT, NAME_REF) => parent.into(), 297 (IDENT, NAME | NAME_REF) => parent.into(),
298 _ => token.into(), 298 _ => token.into(),
299 } 299 }
300 } 300 }
@@ -310,7 +310,7 @@ fn traverse(
310 Some(parent) => { 310 Some(parent) => {
311 // We only care Name and Name_ref 311 // We only care Name and Name_ref
312 match (token.kind(), parent.kind()) { 312 match (token.kind(), parent.kind()) {
313 (IDENT, NAME) | (IDENT, NAME_REF) => parent.into(), 313 (IDENT, NAME | NAME_REF) => parent.into(),
314 _ => token.into(), 314 _ => token.into(),
315 } 315 }
316 } 316 }