From 9c3a08551ae9c0ee230616e2a40c2b0382276d8a Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Tue, 16 Sep 2014 22:53:19 +0530 Subject: [PATCH] Clean up code for unused_must_use lint --- src/librustc/lint/builtin.rs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/librustc/lint/builtin.rs b/src/librustc/lint/builtin.rs index 58c05bee44373..1af6fbbfbf90c 100644 --- a/src/librustc/lint/builtin.rs +++ b/src/librustc/lint/builtin.rs @@ -689,11 +689,7 @@ impl LintPass for UnusedResult { 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 @@ impl LintPass for UnusedResult { 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) {