aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide
diff options
context:
space:
mode:
authorPaul Daniel Faria <[email protected]>2020-07-23 23:31:28 +0100
committerPaul Daniel Faria <[email protected]>2020-08-10 13:46:34 +0100
commit39fdd41df4052cef5da4876067ae28615012476b (patch)
treec6b004f63d75ad1cdd53543d0f818bf0386631b6 /crates/ra_ide
parenta6af0272f7bf129a3063cdd7096f685fc58438e6 (diff)
Return bool from is_unsafe_method_call and cleanup usages
Diffstat (limited to 'crates/ra_ide')
-rw-r--r--crates/ra_ide/src/syntax_highlighting.rs11
1 files changed, 6 insertions, 5 deletions
diff --git a/crates/ra_ide/src/syntax_highlighting.rs b/crates/ra_ide/src/syntax_highlighting.rs
index e29f65a78..4527885e9 100644
--- a/crates/ra_ide/src/syntax_highlighting.rs
+++ b/crates/ra_ide/src/syntax_highlighting.rs
@@ -730,8 +730,9 @@ fn highlight_name(
730 let is_unsafe = name_ref 730 let is_unsafe = name_ref
731 .and_then(|name_ref| name_ref.syntax().parent()) 731 .and_then(|name_ref| name_ref.syntax().parent())
732 .and_then(ast::MethodCallExpr::cast) 732 .and_then(ast::MethodCallExpr::cast)
733 .and_then(|method_call_expr| sema.is_unsafe_method_call(method_call_expr)); 733 .map(|method_call_expr| sema.is_unsafe_method_call(method_call_expr))
734 if is_unsafe.is_some() { 734 .unwrap_or(false);
735 if is_unsafe {
735 h |= HighlightModifier::Unsafe; 736 h |= HighlightModifier::Unsafe;
736 } 737 }
737 } 738 }
@@ -809,9 +810,9 @@ fn highlight_name_ref_by_syntax(name: ast::NameRef, sema: &Semantics<RootDatabas
809 METHOD_CALL_EXPR => { 810 METHOD_CALL_EXPR => {
810 let mut h = Highlight::new(HighlightTag::Function); 811 let mut h = Highlight::new(HighlightTag::Function);
811 let is_unsafe = ast::MethodCallExpr::cast(parent) 812 let is_unsafe = ast::MethodCallExpr::cast(parent)
812 .and_then(|method_call_expr| sema.is_unsafe_method_call(method_call_expr)); 813 .map(|method_call_expr| sema.is_unsafe_method_call(method_call_expr))
813 814 .unwrap_or(false);
814 if is_unsafe.is_some() { 815 if is_unsafe {
815 h |= HighlightModifier::Unsafe; 816 h |= HighlightModifier::Unsafe;
816 } 817 }
817 818