]> git.lizzy.rs Git - rust.git/blobdiff - src/expr.rs
Disallow combining a method call with prefix or suffix
[rust.git] / src / expr.rs
index ea3ac5f58f28e61372bb879a06c632c7e95c8a02..ca2d78b03c4a56bf17aa9eeceb567a5c0d51d685 100644 (file)
@@ -2172,3 +2172,15 @@ fn can_be_overflowed(&self, _: &RewriteContext, _: usize) -> bool {
         false
     }
 }
+
+pub fn is_method_call(expr: &ast::Expr) -> bool {
+    match expr.node {
+        ast::ExprKind::MethodCall(..) => true,
+        ast::ExprKind::AddrOf(_, ref expr)
+        | ast::ExprKind::Box(ref expr)
+        | ast::ExprKind::Cast(ref expr, _)
+        | ast::ExprKind::Try(ref expr)
+        | ast::ExprKind::Unary(_, ref expr) => is_method_call(expr),
+        _ => false,
+    }
+}