]> git.lizzy.rs Git - rust.git/commitdiff
Clean up code for unused_must_use lint
authorManish Goregaokar <manishsmail@gmail.com>
Tue, 16 Sep 2014 17:23:19 +0000 (22:53 +0530)
committerManish Goregaokar <manishsmail@gmail.com>
Tue, 16 Sep 2014 17:23:19 +0000 (22:53 +0530)
src/librustc/lint/builtin.rs

index 58c05bee443737b51279bd4ac69426b1df5faca9..1af6fbbfbf90c3897fcfbe497801533eaacd38c1 100644 (file)
@@ -689,11 +689,7 @@ fn check_stmt(&mut self, cx: &Context, s: &ast::Stmt) {
             ast::StmtSemi(ref expr, _) => &**expr,
             _ => return
         };
-        let t = ty::expr_ty(cx.tcx, expr);
-        match ty::get(t).sty {
-            ty::ty_nil | ty::ty_bot | ty::ty_bool => return,
-            _ => {}
-        }
+
         match expr.node {
             ast::ExprRet(..) => return,
             _ => {}
@@ -702,6 +698,7 @@ fn check_stmt(&mut self, cx: &Context, s: &ast::Stmt) {
         let t = ty::expr_ty(cx.tcx, expr);
         let mut warned = false;
         match ty::get(t).sty {
+            ty::ty_nil | ty::ty_bot | ty::ty_bool => return,
             ty::ty_struct(did, _) |
             ty::ty_enum(did, _) => {
                 if ast_util::is_local(did) {