aboutsummaryrefslogtreecommitdiff
path: root/crates/hir/src
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2020-08-19 12:46:34 +0100
committerAleksey Kladov <[email protected]>2020-08-19 12:46:34 +0100
commita3b0a3aeb8061fc65951dd540bc92b94a96b4f2b (patch)
tree78fa29f5d455f29224ef2d8342835d404240d14f /crates/hir/src
parent63ac896655b75bc42d488cb5d4153ba770535ac5 (diff)
Minor cleanups
Diffstat (limited to 'crates/hir/src')
-rw-r--r--crates/hir/src/semantics.rs13
1 files changed, 6 insertions, 7 deletions
diff --git a/crates/hir/src/semantics.rs b/crates/hir/src/semantics.rs
index aff0e73da..621ebcbe3 100644
--- a/crates/hir/src/semantics.rs
+++ b/crates/hir/src/semantics.rs
@@ -613,14 +613,13 @@ impl<'db> SemanticsImpl<'db> {
613 InFile::new(file_id, node) 613 InFile::new(file_id, node)
614 } 614 }
615 615
616 pub fn is_unsafe_method_call(&self, method_call_expr: &ast::MethodCallExpr) -> bool { 616 fn is_unsafe_method_call(&self, method_call_expr: &ast::MethodCallExpr) -> bool {
617 method_call_expr 617 method_call_expr
618 .expr() 618 .expr()
619 .and_then(|expr| { 619 .and_then(|expr| {
620 let field_expr = if let ast::Expr::FieldExpr(field_expr) = expr { 620 let field_expr = match expr {
621 field_expr 621 ast::Expr::FieldExpr(field_expr) => field_expr,
622 } else { 622 _ => return None,
623 return None;
624 }; 623 };
625 let ty = self.type_of_expr(&field_expr.expr()?)?; 624 let ty = self.type_of_expr(&field_expr.expr()?)?;
626 if !ty.is_packed(self.db) { 625 if !ty.is_packed(self.db) {
@@ -635,7 +634,7 @@ impl<'db> SemanticsImpl<'db> {
635 .unwrap_or(false) 634 .unwrap_or(false)
636 } 635 }
637 636
638 pub fn is_unsafe_ref_expr(&self, ref_expr: &ast::RefExpr) -> bool { 637 fn is_unsafe_ref_expr(&self, ref_expr: &ast::RefExpr) -> bool {
639 ref_expr 638 ref_expr
640 .expr() 639 .expr()
641 .and_then(|expr| { 640 .and_then(|expr| {
@@ -654,7 +653,7 @@ impl<'db> SemanticsImpl<'db> {
654 // more than it should with the current implementation. 653 // more than it should with the current implementation.
655 } 654 }
656 655
657 pub fn is_unsafe_ident_pat(&self, ident_pat: &ast::IdentPat) -> bool { 656 fn is_unsafe_ident_pat(&self, ident_pat: &ast::IdentPat) -> bool {
658 if !ident_pat.ref_token().is_some() { 657 if !ident_pat.ref_token().is_some() {
659 return false; 658 return false;
660 } 659 }