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) {