Skip to content

Commit f7090f7

Browse files
committed
Make it compile
1 parent 8295b31 commit f7090f7

File tree

8 files changed

+11
-12
lines changed

8 files changed

+11
-12
lines changed

clippy_lints/src/functions.rs

+1-1
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::{Res, DefKind};
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;

clippy_lints/src/let_if_seq.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use crate::utils::{snippet, span_lint_and_then};
22
use if_chain::if_chain;
33
use rustc::hir;
4-
use rustc::hir::def::{Res, DefKind};
4+
use rustc::hir::def::Res;
55
use rustc::hir::BindingAnnotation;
66
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
77
use rustc::{declare_lint_pass, declare_tool_lint};

clippy_lints/src/loops.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1774,7 +1774,7 @@ impl<'a, 'tcx> VarVisitor<'a, 'tcx> {
17741774
}
17751775
let res = self.cx.tables.qpath_res(seqpath, seqexpr.hir_id);
17761776
match res {
1777-
Res::Local(hir_id) | Res::Def(Res::Upvar(..), hir_id, ..) => {
1777+
Res::Local(hir_id) | Res::Upvar(hir_id, ..) => {
17781778
let parent_id = self.cx.tcx.hir().get_parent_item(expr.hir_id);
17791779
let parent_def_id = self.cx.tcx.hir().local_def_id_from_hir_id(parent_id);
17801780
let extent = self.cx.tcx.region_scope_tree(parent_def_id).var_scope(hir_id.local_id);
@@ -1835,7 +1835,7 @@ impl<'a, 'tcx> Visitor<'tcx> for VarVisitor<'a, 'tcx> {
18351835
if path.segments.len() == 1;
18361836
then {
18371837
match self.cx.tables.qpath_res(qpath, expr.hir_id) {
1838-
Res::Def(Res::Upvar(..), local_id, ..) => {
1838+
Res::Upvar(local_id, ..) => {
18391839
if local_id == self.var {
18401840
// we are not indexing anything, record that
18411841
self.nonindex = true;
@@ -2383,7 +2383,7 @@ impl<'a, 'tcx> VarCollectorVisitor<'a, 'tcx> {
23832383
let res = self.cx.tables.qpath_res(qpath, ex.hir_id);
23842384
then {
23852385
match res {
2386-
Res::Local(node_id) | Res::Def(Res::Upvar(..), node_id, ..) => {
2386+
Res::Local(node_id) | Res::Upvar(node_id, ..) => {
23872387
self.ids.insert(node_id);
23882388
},
23892389
Res::Def(DefKind::Static, def_id) => {

clippy_lints/src/methods/unnecessary_filter_map.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use crate::utils::paths;
22
use crate::utils::usage::mutated_variables;
33
use crate::utils::{match_qpath, match_trait_method, span_lint};
44
use rustc::hir;
5-
use rustc::hir::def::{Res, DefKind};
5+
use rustc::hir::def::Res;
66
use rustc::hir::intravisit::{walk_expr, NestedVisitorMap, Visitor};
77
use rustc::lint::LateContext;
88

clippy_lints/src/misc.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ use if_chain::if_chain;
22
use matches::matches;
33
use rustc::hir::intravisit::FnKind;
44
use rustc::hir::*;
5-
use rustc::hir::def::{Res, DefKind, CtorOf};
65
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
76
use rustc::ty;
87
use rustc::{declare_lint_pass, declare_tool_lint};
@@ -603,7 +602,7 @@ fn in_attributes_expansion(expr: &Expr) -> bool {
603602
/// Tests whether `res` is a variable defined outside a macro.
604603
fn non_macro_local(cx: &LateContext<'_, '_>, res: def::Res) -> bool {
605604
match res {
606-
def::Res::Local(id) | def::Res(Res::Upvar(..), id, _, _) => !in_macro(cx.tcx.hir().span_by_hir_id(id)),
605+
def::Res::Local(id) | def::Res::Upvar(id, ..) => !in_macro(cx.tcx.hir().span_by_hir_id(id)),
607606
_ => false,
608607
}
609608
}

clippy_lints/src/question_mark.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ impl QuestionMark {
117117
},
118118
ExprKind::Ret(Some(ref expr)) => Self::expression_returns_none(cx, expr),
119119
ExprKind::Path(ref qp) => {
120-
if let Res::Def(DefKind::Ctor(_, def::CtorOf::Variant), def_id) = cx.tables.qpath_res(qp, expression.hir_id) {
120+
if let Res::Def(DefKind::Ctor(def::CtorOf::Variant, def::CtorKind::Const), def_id) = cx.tables.qpath_res(qp, expression.hir_id) {
121121
return cx.match_def_path(def_id, &OPTION_NONE);
122122
}
123123

clippy_lints/src/use_self.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ impl<'a, 'tcx> Visitor<'tcx> for UseSelfVisitor<'a, 'tcx> {
223223
if path.segments.last().expect(SEGMENTS_MSG).ident.name != SelfUpper.name() {
224224
if self.item_path.res == path.res {
225225
span_use_self_lint(self.cx, path);
226-
} else if let Res::Def(DefKind::Ctor(def::CtorOf::Struct, ctor_did), CtorKind::Fn) = path.res {
226+
} else if let Res::Def(DefKind::Ctor(def::CtorOf::Struct, CtorKind::Fn), ctor_did) = path.res {
227227
if self.item_path.res.opt_def_id() == self.cx.tcx.parent(ctor_did) {
228228
span_use_self_lint(self.cx, path);
229229
}

clippy_lints/src/utils/usage.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use rustc::hir::def::{Res, DefKind};
1+
use rustc::hir::def::Res;
22
use rustc::hir::*;
33
use rustc::lint::LateContext;
44
use rustc::middle::expr_use_visitor::*;
@@ -30,7 +30,7 @@ pub fn is_potentially_mutated<'a, 'tcx: 'a>(
3030
cx: &'a LateContext<'a, 'tcx>,
3131
) -> bool {
3232
let id = match variable.res {
33-
Res::Local(id) | Res::Def(Res::Upvar(..), id, ..) => id,
33+
Res::Local(id) | Res::Upvar(id, ..) => id,
3434
_ => return true,
3535
};
3636
mutated_variables(expr, cx).map_or(true, |mutated| mutated.contains(&id))

0 commit comments

Comments
 (0)