Clean up code for unused_must_use lint
This commit is contained in:
parent
3212d70302
commit
9c3a08551a
1 changed files with 2 additions and 5 deletions
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue