]> git.lizzy.rs Git - rust.git/blobdiff - crates/ra_ide/src/syntax_highlighting.rs
Fix type names broken by rebase, redo expected test because of rebase
[rust.git] / crates / ra_ide / src / syntax_highlighting.rs
index e29f65a7849e3c125a54e766aae06cd44c444667..c62bb3f1abcca61d151a66de3184c91084189509 100644 (file)
@@ -662,9 +662,9 @@ fn highlight_element(
                 }
                 T![ref] => element
                     .parent()
-                    .and_then(ast::BindPat::cast)
-                    .and_then(|bind_pat| {
-                        if sema.is_unsafe_bind_pat(&bind_pat) {
+                    .and_then(ast::IdentPat::cast)
+                    .and_then(|ident_pat| {
+                        if sema.is_unsafe_ident_pat(&ident_pat) {
                             Some(HighlightModifier::Unsafe)
                         } else {
                             None
@@ -730,8 +730,9 @@ fn highlight_name(
                     let is_unsafe = name_ref
                         .and_then(|name_ref| name_ref.syntax().parent())
                         .and_then(ast::MethodCallExpr::cast)
-                        .and_then(|method_call_expr| sema.is_unsafe_method_call(method_call_expr));
-                    if is_unsafe.is_some() {
+                        .map(|method_call_expr| sema.is_unsafe_method_call(method_call_expr))
+                        .unwrap_or(false);
+                    if is_unsafe {
                         h |= HighlightModifier::Unsafe;
                     }
                 }
@@ -809,9 +810,9 @@ fn highlight_name_ref_by_syntax(name: ast::NameRef, sema: &Semantics<RootDatabas
         METHOD_CALL_EXPR => {
             let mut h = Highlight::new(HighlightTag::Function);
             let is_unsafe = ast::MethodCallExpr::cast(parent)
-                .and_then(|method_call_expr| sema.is_unsafe_method_call(method_call_expr));
-
-            if is_unsafe.is_some() {
+                .map(|method_call_expr| sema.is_unsafe_method_call(method_call_expr))
+                .unwrap_or(false);
+            if is_unsafe {
                 h |= HighlightModifier::Unsafe;
             }