Skip to content

Commit 6992937

Browse files
committed
Update for hir renamings in rustc
1 parent 8e92994 commit 6992937

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+181
-153
lines changed

clippy_lints/src/assign_ops.rs

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -142,9 +142,9 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for AssignOps {
142142
$cx:expr,
143143
$ty:expr,
144144
$rty:expr,
145-
$($trait_name:ident:$full_trait_name:ident),+) => {
145+
$($trait_name:ident),+) => {
146146
match $op {
147-
$(hir::$full_trait_name => {
147+
$(hir::BinOpKind::$trait_name => {
148148
let [krate, module] = crate::utils::paths::OPS_MODULE;
149149
let path = [krate, module, concat!(stringify!($trait_name), "Assign")];
150150
let trait_id = if let Some(trait_id) = get_trait_def_id($cx, &path) {
@@ -159,7 +159,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for AssignOps {
159159
if_chain! {
160160
if parent_impl != ast::CRATE_NODE_ID;
161161
if let hir::map::Node::NodeItem(item) = cx.tcx.hir.get(parent_impl);
162-
if let hir::Item_::ItemImpl(_, _, _, _, Some(ref trait_ref), _, _) =
162+
if let hir::ItemKind::Impl(_, _, _, _, Some(ref trait_ref), _, _) =
163163
item.node;
164164
if trait_ref.path.def.def_id() == trait_id;
165165
then { return; }
@@ -175,18 +175,18 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for AssignOps {
175175
cx,
176176
ty,
177177
rty.into(),
178-
Add: BinOpKind::Add,
179-
Sub: BinOpKind::Sub,
180-
Mul: BinOpKind::Mul,
181-
Div: BinOpKind::Div,
182-
Rem: BinOpKind::Rem,
183-
And: BinOpKind::And,
184-
Or: BinOpKind::Or,
185-
BitAnd: BinOpKind::BitAnd,
186-
BitOr: BinOpKind::BitOr,
187-
BitXor: BinOpKind::BitXor,
188-
Shr: BinOpKind::Shr,
189-
Shl: BinOpKind::Shl
178+
Add,
179+
Sub,
180+
Mul,
181+
Div,
182+
Rem,
183+
And,
184+
Or,
185+
BitAnd,
186+
BitOr,
187+
BitXor,
188+
Shr,
189+
Shl
190190
) {
191191
span_lint_and_then(
192192
cx,

clippy_lints/src/attrs.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -154,15 +154,15 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for AttrPass {
154154
check_attrs(cx, item.span, item.name, &item.attrs)
155155
}
156156
match item.node {
157-
ItemExternCrate(_) | ItemUse(_, _) => {
157+
ItemKind::ExternCrate(_) | ItemKind::Use(_, _) => {
158158
for attr in &item.attrs {
159159
if let Some(ref lint_list) = attr.meta_item_list() {
160160
match &*attr.name().as_str() {
161161
"allow" | "warn" | "deny" | "forbid" => {
162162
// whitelist `unused_imports` and `deprecated`
163163
for lint in lint_list {
164164
if is_word(lint, "unused_imports") || is_word(lint, "deprecated") {
165-
if let ItemUse(_, _) = item.node {
165+
if let ItemKind::Use(_, _) = item.node {
166166
return;
167167
}
168168
}
@@ -207,7 +207,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for AttrPass {
207207
}
208208

209209
fn is_relevant_item(tcx: TyCtxt, item: &Item) -> bool {
210-
if let ItemFn(_, _, _, eid) = item.node {
210+
if let ItemKind::Fn(_, _, _, eid) = item.node {
211211
is_relevant_expr(tcx, tcx.body_tables(eid), &tcx.hir.body(eid).value)
212212
} else {
213213
true

clippy_lints/src/derive.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ impl LintPass for Derive {
7070

7171
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Derive {
7272
fn check_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx Item) {
73-
if let ItemImpl(_, _, _, _, Some(ref trait_ref), _, _) = item.node {
73+
if let ItemKind::Impl(_, _, _, _, Some(ref trait_ref), _, _) = item.node {
7474
let ty = cx.tcx.type_of(cx.tcx.hir.local_def_id(item.id));
7575
let is_automatically_derived = is_automatically_derived(&*item.attrs);
7676

clippy_lints/src/empty_enum.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ impl LintPass for EmptyEnum {
3434
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for EmptyEnum {
3535
fn check_item(&mut self, cx: &LateContext, item: &Item) {
3636
let did = cx.tcx.hir.local_def_id(item.id);
37-
if let ItemEnum(..) = item.node {
37+
if let ItemKind::Enum(..) = item.node {
3838
let ty = cx.tcx.type_of(did);
3939
let adt = ty.ty_adt_def()
4040
.expect("already checked whether this is an enum");

clippy_lints/src/enum_clike.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UnportableVariant {
4747
if cx.tcx.data_layout.pointer_size.bits() != 64 {
4848
return;
4949
}
50-
if let ItemEnum(ref def, _) = item.node {
50+
if let ItemKind::Enum(ref def, _) = item.node {
5151
for var in &def.variants {
5252
let variant = &var.node;
5353
if let Some(ref anon_const) = variant.disr_expr {

clippy_lints/src/enum_glob_use.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ impl EnumGlobUse {
4747
if item.vis.node.is_pub() {
4848
return; // re-exports are fine
4949
}
50-
if let ItemUse(ref path, UseKind::Glob) = item.node {
50+
if let ItemKind::Use(ref path, UseKind::Glob) = item.node {
5151
if let Def::Enum(_) = path.def {
5252
span_lint(
5353
cx,

clippy_lints/src/escape.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ impl<'a, 'tcx> Delegate<'tcx> for EscapeDelegate<'a, 'tcx> {
111111
let id = map.hir_to_node_id(cmt.hir_id);
112112
if let Some(NodeStmt(st)) = map.find(map.get_parent_node(id)) {
113113
if let StmtKind::Decl(ref decl, _) = st.node {
114-
if let DeclLocal(ref loc) = decl.node {
114+
if let DeclKind::Local(ref loc) = decl.node {
115115
if let Some(ref ex) = loc.init {
116116
if let ExprKind::Box(..) = ex.node {
117117
if is_non_trait_box(cmt.ty) && !self.is_large_box(cmt.ty) {

clippy_lints/src/eval_order_dependence.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for EvalOrderDependence {
8383
fn check_stmt(&mut self, cx: &LateContext<'a, 'tcx>, stmt: &'tcx Stmt) {
8484
match stmt.node {
8585
StmtKind::Expr(ref e, _) | StmtKind::Semi(ref e, _) => DivergenceVisitor { cx }.maybe_walk_expr(e),
86-
StmtKind::Decl(ref d, _) => if let DeclLocal(ref local) = d.node {
86+
StmtKind::Decl(ref d, _) => if let DeclKind::Local(ref local) = d.node {
8787
if let Local {
8888
init: Some(ref e), ..
8989
} = **local
@@ -267,7 +267,7 @@ fn check_stmt<'a, 'tcx>(vis: &mut ReadVisitor<'a, 'tcx>, stmt: &'tcx Stmt) -> St
267267
// If the declaration is of a local variable, check its initializer
268268
// expression if it has one. Otherwise, keep going.
269269
let local = match decl.node {
270-
DeclLocal(ref local) => Some(local),
270+
DeclKind::Local(ref local) => Some(local),
271271
_ => None,
272272
};
273273
local

clippy_lints/src/fallible_impl_from.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for FallibleImplFrom {
3939
// check for `impl From<???> for ..`
4040
let impl_def_id = cx.tcx.hir.local_def_id(item.id);
4141
if_chain! {
42-
if let hir::ItemImpl(.., ref impl_items) = item.node;
42+
if let hir::ItemKind::Impl(.., ref impl_items) = item.node;
4343
if let Some(impl_trait_ref) = cx.tcx.impl_trait_ref(impl_def_id);
4444
if match_def_path(cx.tcx, impl_trait_ref.def_id, &FROM_TRAIT);
4545
then {

clippy_lints/src/functions.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Functions {
8686
use rustc::hir::map::Node::*;
8787

8888
let is_impl = if let Some(NodeItem(item)) = cx.tcx.hir.find(cx.tcx.hir.get_parent_node(nodeid)) {
89-
matches!(item.node, hir::ItemImpl(_, _, _, _, Some(_), _, _))
89+
matches!(item.node, hir::ItemKind::Impl(_, _, _, _, Some(_), _, _))
9090
} else {
9191
false
9292
};

0 commit comments

Comments
 (0)