5812: Minor cleanups
 r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
This commit is contained in:
bors[bot] 2020-08-19 11:51:47 +00:00 committed by GitHub
commit 422856d70f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -613,14 +613,13 @@ impl<'db> SemanticsImpl<'db> {
InFile::new(file_id, node) InFile::new(file_id, node)
} }
pub fn is_unsafe_method_call(&self, method_call_expr: &ast::MethodCallExpr) -> bool { fn is_unsafe_method_call(&self, method_call_expr: &ast::MethodCallExpr) -> bool {
method_call_expr method_call_expr
.expr() .expr()
.and_then(|expr| { .and_then(|expr| {
let field_expr = if let ast::Expr::FieldExpr(field_expr) = expr { let field_expr = match expr {
field_expr ast::Expr::FieldExpr(field_expr) => field_expr,
} else { _ => return None,
return None;
}; };
let ty = self.type_of_expr(&field_expr.expr()?)?; let ty = self.type_of_expr(&field_expr.expr()?)?;
if !ty.is_packed(self.db) { if !ty.is_packed(self.db) {
@ -635,7 +634,7 @@ impl<'db> SemanticsImpl<'db> {
.unwrap_or(false) .unwrap_or(false)
} }
pub fn is_unsafe_ref_expr(&self, ref_expr: &ast::RefExpr) -> bool { fn is_unsafe_ref_expr(&self, ref_expr: &ast::RefExpr) -> bool {
ref_expr ref_expr
.expr() .expr()
.and_then(|expr| { .and_then(|expr| {
@ -654,7 +653,7 @@ impl<'db> SemanticsImpl<'db> {
// more than it should with the current implementation. // more than it should with the current implementation.
} }
pub fn is_unsafe_ident_pat(&self, ident_pat: &ast::IdentPat) -> bool { fn is_unsafe_ident_pat(&self, ident_pat: &ast::IdentPat) -> bool {
if !ident_pat.ref_token().is_some() { if !ident_pat.ref_token().is_some() {
return false; return false;
} }