Skip to content

Commit a9778c6

Browse files
committed
Simplify
1 parent 0b62b99 commit a9778c6

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

crates/ide/src/syntax_highlighting.rs

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -455,15 +455,10 @@ fn macro_call_range(macro_call: &ast::MacroCall) -> Option<TextRange> {
455455
}
456456

457457
fn is_possibly_unsafe(name_ref: &ast::NameRef) -> bool {
458-
name_ref
459-
.syntax()
460-
.parent()
461-
.and_then(|parent| {
462-
ast::FieldExpr::cast(parent.clone())
463-
.map(|_| true)
464-
.or_else(|| ast::RecordPatField::cast(parent).map(|_| true))
465-
})
466-
.unwrap_or(false)
458+
match name_ref.syntax().parent() {
459+
Some(parent) => matches!(parent.kind(), FIELD_EXPR | RECORD_PAT_FIELD),
460+
None => false,
461+
}
467462
}
468463

469464
fn highlight_element(

0 commit comments

Comments
 (0)