Skip to content

Commit d618637

Browse files
matthiaskrgrManishearth
authored andcommitted
Rustup to rustc 1.36.0-nightly (13fde05 2019-05-03)
1 parent 19316b4 commit d618637

39 files changed

+121
-117
lines changed

clippy_lints/src/assign_ops.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for AssignOps {
9999
let parent_fn = cx.tcx.hir().get_parent_item(e.hir_id);
100100
if_chain! {
101101
if let Some(trait_ref) = trait_ref_of_method(cx, parent_fn);
102-
if trait_ref.path.def.def_id() == trait_id;
102+
if trait_ref.path.res.def_id() == trait_id;
103103
then { return; }
104104
}
105105
implements_trait($cx, $ty, trait_id, &[$rty])

clippy_lints/src/attrs.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,7 @@ fn is_relevant_expr(cx: &LateContext<'_, '_>, tables: &ty::TypeckTables<'_>, exp
394394
ExprKind::Ret(None) | ExprKind::Break(_, None) => false,
395395
ExprKind::Call(path_expr, _) => {
396396
if let ExprKind::Path(qpath) = &path_expr.node {
397-
if let Some(fun_id) = tables.qpath_def(qpath, path_expr.hir_id).opt_def_id() {
397+
if let Some(fun_id) = tables.qpath_res(qpath, path_expr.hir_id).opt_def_id() {
398398
!cx.match_def_path(fun_id, &paths::BEGIN_PANIC)
399399
} else {
400400
true

clippy_lints/src/consts.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
use crate::utils::{clip, sext, unsext};
44
use if_chain::if_chain;
5-
use rustc::hir::def::Def;
5+
use rustc::hir::def::{DefKind, Res};
66
use rustc::hir::*;
77
use rustc::lint::LateContext;
88
use rustc::ty::subst::{Subst, SubstsRef};
@@ -247,8 +247,8 @@ impl<'c, 'cc> ConstEvalLateContext<'c, 'cc> {
247247
if_chain! {
248248
if args.is_empty();
249249
if let ExprKind::Path(qpath) = &callee.node;
250-
let def = self.tables.qpath_def(qpath, callee.hir_id);
251-
if let Some(def_id) = def.opt_def_id();
250+
let res = self.tables.qpath_res(qpath, callee.hir_id);
251+
if let Some(def_id) = res.opt_def_id();
252252
let def_path = self.lcx.get_def_path(def_id)
253253
.iter()
254254
.map(LocalInternedString::get)
@@ -322,9 +322,9 @@ impl<'c, 'cc> ConstEvalLateContext<'c, 'cc> {
322322
fn fetch_path(&mut self, qpath: &QPath, id: HirId) -> Option<Constant> {
323323
use rustc::mir::interpret::GlobalId;
324324

325-
let def = self.tables.qpath_def(qpath, id);
326-
match def {
327-
Def::Const(def_id) | Def::AssociatedConst(def_id) => {
325+
let res = self.tables.qpath_res(qpath, id);
326+
match res {
327+
Res::Def(DefKind::Const, def_id) | Res::Def(DefKind::AssociatedConst, def_id) => {
328328
let substs = self.tables.node_substs(id);
329329
let substs = if self.substs.is_empty() {
330330
substs
@@ -338,11 +338,11 @@ impl<'c, 'cc> ConstEvalLateContext<'c, 'cc> {
338338
};
339339

340340
let result = self.lcx.tcx.const_eval(self.param_env.and(gid)).ok()?;
341-
let ret = miri_to_const(self.lcx.tcx, &result);
342-
if ret.is_some() {
341+
let result = miri_to_const(self.lcx.tcx, &result);
342+
if result.is_some() {
343343
self.needed_resolution = true;
344344
}
345-
ret
345+
result
346346
},
347347
// FIXME: cover all usable cases.
348348
_ => None,

clippy_lints/src/default_trait_access.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for DefaultTraitAccess {
3636
if let ExprKind::Call(ref path, ..) = expr.node;
3737
if !any_parent_is_automatically_derived(cx.tcx, expr.hir_id);
3838
if let ExprKind::Path(ref qpath) = path.node;
39-
if let Some(def_id) = cx.tables.qpath_def(qpath, path.hir_id).opt_def_id();
39+
if let Some(def_id) = cx.tables.qpath_res(qpath, path.hir_id).opt_def_id();
4040
if cx.match_def_path(def_id, &paths::DEFAULT_TRAIT_METHOD);
4141
then {
4242
match qpath {

clippy_lints/src/drop_bounds.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for DropBounds {
5555
fn lint_bound<'a, 'tcx>(cx: &rustc::lint::LateContext<'a, 'tcx>, bound: &'tcx GenericBound) {
5656
if_chain! {
5757
if let GenericBound::Trait(t, _) = bound;
58-
if let Some(def_id) = t.trait_ref.path.def.opt_def_id();
58+
if let Some(def_id) = t.trait_ref.path.res.opt_def_id();
5959
if cx.match_def_path(def_id, &paths::DROP_TRAIT);
6060
then {
6161
span_lint(

clippy_lints/src/drop_forget_ref.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for DropForgetRef {
114114
if let ExprKind::Call(ref path, ref args) = expr.node;
115115
if let ExprKind::Path(ref qpath) = path.node;
116116
if args.len() == 1;
117-
if let Some(def_id) = cx.tables.qpath_def(qpath, path.hir_id).opt_def_id();
117+
if let Some(def_id) = cx.tables.qpath_res(qpath, path.hir_id).opt_def_id();
118118
then {
119119
let lint;
120120
let msg;

clippy_lints/src/enum_glob_use.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//! lint on `use`ing all variants of an enum
22
33
use crate::utils::span_lint;
4-
use rustc::hir::def::Def;
4+
use rustc::hir::def::{DefKind, Res};
55
use rustc::hir::*;
66
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
77
use rustc::{declare_lint_pass, declare_tool_lint};
@@ -43,7 +43,7 @@ impl EnumGlobUse {
4343
return; // re-exports are fine
4444
}
4545
if let ItemKind::Use(ref path, UseKind::Glob) = item.node {
46-
if let Def::Enum(_) = path.def {
46+
if let Res::Def(DefKind::Enum, _) = path.res {
4747
span_lint(cx, ENUM_GLOB_USE, item.span, "don't use glob imports for enum variants");
4848
}
4949
}

clippy_lints/src/eval_order_dependence.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for EvalOrderDependence {
6363
if let ExprKind::Path(ref qpath) = lhs.node {
6464
if let QPath::Resolved(_, ref path) = *qpath {
6565
if path.segments.len() == 1 {
66-
if let def::Def::Local(var) = cx.tables.qpath_def(qpath, lhs.hir_id) {
66+
if let def::Res::Local(var) = cx.tables.qpath_res(qpath, lhs.hir_id) {
6767
let mut visitor = ReadVisitor {
6868
cx,
6969
var,
@@ -295,7 +295,7 @@ impl<'a, 'tcx> Visitor<'tcx> for ReadVisitor<'a, 'tcx> {
295295
if_chain! {
296296
if let QPath::Resolved(None, ref path) = *qpath;
297297
if path.segments.len() == 1;
298-
if let def::Def::Local(local_id) = self.cx.tables.qpath_def(qpath, expr.hir_id);
298+
if let def::Res::Local(local_id) = self.cx.tables.qpath_res(qpath, expr.hir_id);
299299
if local_id == self.var;
300300
// Check that this is a read, not a write.
301301
if !is_in_assignment_position(self.cx, expr);

clippy_lints/src/fallible_impl_from.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ fn lint_impl_body<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, impl_span: Span, impl_it
6161
if_chain! {
6262
if let ExprKind::Call(ref func_expr, _) = expr.node;
6363
if let ExprKind::Path(QPath::Resolved(_, ref path)) = func_expr.node;
64-
if let Some(path_def_id) = path.def.opt_def_id();
64+
if let Some(path_def_id) = path.res.opt_def_id();
6565
if self.lcx.match_def_path(path_def_id, &BEGIN_PANIC) ||
6666
self.lcx.match_def_path(path_def_id, &BEGIN_PANIC_FMT);
6767
if is_expn_of(expr.span, "unreachable").is_none();

clippy_lints/src/functions.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use std::convert::TryFrom;
33
use crate::utils::{iter_input_pats, snippet, snippet_opt, span_lint, type_is_unsafe_function};
44
use matches::matches;
55
use rustc::hir;
6-
use rustc::hir::def::Def;
6+
use rustc::hir::def::Res;
77
use rustc::hir::intravisit;
88
use rustc::lint::{in_external_macro, LateContext, LateLintPass, LintArray, LintContext, LintPass};
99
use rustc::ty;
@@ -333,7 +333,7 @@ impl<'a, 'tcx> hir::intravisit::Visitor<'tcx> for DerefVisitor<'a, 'tcx> {
333333
impl<'a, 'tcx: 'a> DerefVisitor<'a, 'tcx> {
334334
fn check_arg(&self, ptr: &hir::Expr) {
335335
if let hir::ExprKind::Path(ref qpath) = ptr.node {
336-
if let Def::Local(id) = self.cx.tables.qpath_def(qpath, ptr.hir_id) {
336+
if let Res::Local(id) = self.cx.tables.qpath_res(qpath, ptr.hir_id) {
337337
if self.ptrs.contains(&id) {
338338
span_lint(
339339
self.cx,

0 commit comments

Comments
 (0)