-use rustc::hir::def::Def;
+use rustc::hir::def::{Def, DefKind};
use rustc::hir::def_id::DefId;
use rustc::lint;
use rustc::ty;
let mut fn_warned = false;
let mut op_warned = false;
- let maybe_def = match expr.node {
+ let maybe_def_id = match expr.node {
hir::ExprKind::Call(ref callee, _) => {
match callee.node {
hir::ExprKind::Path(ref qpath) => {
let def = cx.tables.qpath_def(qpath, callee.hir_id);
match def {
- Def::Fn(_) | Def::Method(_) => Some(def),
+ Def::Def(DefKind::Fn, def_id)
+ | Def::Def(DefKind::Method, def_id) => Some(def_id),
// `Def::Local` if it was a closure, for which we
// do not currently support must-use linting
_ => None
}
},
hir::ExprKind::MethodCall(..) => {
- cx.tables.type_dependent_def(expr.hir_id)
+ cx.tables.type_dependent_def_id(expr.hir_id)
},
_ => None
};
- if let Some(def) = maybe_def {
- let def_id = def.def_id();
+ if let Some(def_id) = maybe_def_id {
fn_warned = check_must_use(cx, def_id, s.span, "return value of ", "");
} else if type_permits_lack_of_use {
// We don't warn about unused unit or uninhabited types.
self.check_unused_parens_expr(cx, &value, msg, followed_by_block);
}
- fn check_pat(&mut self, cx: &EarlyContext<'_>, p: &ast::Pat, _: &mut bool) {
+ fn check_pat(&mut self, cx: &EarlyContext<'_>, p: &ast::Pat) {
use ast::PatKind::{Paren, Range};
// The lint visitor will visit each subpattern of `p`. We do not want to lint any range
// pattern no matter where it occurs in the pattern. For something like `&(a..=b)`, there