diff options
author | Aleksey Kladov <[email protected]> | 2020-08-19 16:37:19 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2020-08-19 16:37:19 +0100 |
commit | a9778c6d73c1ae609d9068a5aeb3e225d8154f59 (patch) | |
tree | 7523752f98e5be2324487536e1796f559617d91a | |
parent | 0b62b990ba69efd23f26218d0461a2cef15e593a (diff) |
Simplify
-rw-r--r-- | crates/ide/src/syntax_highlighting.rs | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/crates/ide/src/syntax_highlighting.rs b/crates/ide/src/syntax_highlighting.rs index 38546ead3..0a5f7a247 100644 --- a/crates/ide/src/syntax_highlighting.rs +++ b/crates/ide/src/syntax_highlighting.rs | |||
@@ -455,15 +455,10 @@ fn macro_call_range(macro_call: &ast::MacroCall) -> Option<TextRange> { | |||
455 | } | 455 | } |
456 | 456 | ||
457 | fn is_possibly_unsafe(name_ref: &ast::NameRef) -> bool { | 457 | fn is_possibly_unsafe(name_ref: &ast::NameRef) -> bool { |
458 | name_ref | 458 | match name_ref.syntax().parent() { |
459 | .syntax() | 459 | Some(parent) => matches!(parent.kind(), FIELD_EXPR | RECORD_PAT_FIELD), |
460 | .parent() | 460 | None => false, |
461 | .and_then(|parent| { | 461 | } |
462 | ast::FieldExpr::cast(parent.clone()) | ||
463 | .map(|_| true) | ||
464 | .or_else(|| ast::RecordPatField::cast(parent).map(|_| true)) | ||
465 | }) | ||
466 | .unwrap_or(false) | ||
467 | } | 462 | } |
468 | 463 | ||
469 | fn highlight_element( | 464 | fn highlight_element( |