Skip to content

Commit 0475eae

Browse files
committed
Rustup to *rustc 1.14.0-nightly (3210fd5 2016-10-05)*
1 parent e851bc7 commit 0475eae

File tree

3 files changed

+10
-6
lines changed

3 files changed

+10
-6
lines changed

clippy_lints/src/enum_glob_use.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ impl EnumGlobUse {
6060
} else {
6161
let child = cx.sess().cstore.item_children(def.full_def().def_id());
6262
if let Some(child) = child.first() {
63-
if let Some(Def::Variant(..)) = cx.tcx.sess.cstore.describe_def(child.def_id) {
63+
if let Def::Variant(..) = child.def {
6464
span_lint(cx, ENUM_GLOB_USE, item.span, "don't use glob imports for enum variants");
6565
}
6666
}

clippy_lints/src/no_effect.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,9 @@ fn has_no_effect(cx: &LateContext, expr: &Expr) -> bool {
7171
let def = cx.tcx.def_map.borrow().get(&callee.id).map(|d| d.full_def());
7272
match def {
7373
Some(Def::Struct(..)) |
74-
Some(Def::Variant(..)) => args.iter().all(|arg| has_no_effect(cx, arg)),
74+
Some(Def::Variant(..)) |
75+
Some(Def::StructCtor(..)) |
76+
Some(Def::VariantCtor(..)) => args.iter().all(|arg| has_no_effect(cx, arg)),
7577
_ => false,
7678
}
7779
}
@@ -146,7 +148,9 @@ fn reduce_expression<'a>(cx: &LateContext, expr: &'a Expr) -> Option<Vec<&'a Exp
146148
Expr_::ExprCall(ref callee, ref args) => {
147149
match cx.tcx.def_map.borrow().get(&callee.id).map(PathResolution::full_def) {
148150
Some(Def::Struct(..)) |
149-
Some(Def::Variant(..)) => Some(args.iter().map(Deref::deref).collect()),
151+
Some(Def::Variant(..)) |
152+
Some(Def::StructCtor(..)) |
153+
Some(Def::VariantCtor(..)) => Some(args.iter().map(Deref::deref).collect()),
150154
_ => None,
151155
}
152156
}

clippy_lints/src/utils/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -234,10 +234,10 @@ pub fn path_to_def(cx: &LateContext, path: &[&str]) -> Option<def::Def> {
234234
for item in &mem::replace(&mut items, vec![]) {
235235
if item.name.as_str() == *segment {
236236
if path_it.peek().is_none() {
237-
return cx.tcx.sess.cstore.describe_def(item.def_id);
237+
return Some(item.def);
238238
}
239239

240-
items = cstore.item_children(item.def_id);
240+
items = cstore.item_children(item.def.def_id());
241241
break;
242242
}
243243
}
@@ -723,7 +723,7 @@ pub fn is_copy<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, ty: ty::Ty<'tcx>, env: Node
723723
/// Return whether a pattern is refutable.
724724
pub fn is_refutable(cx: &LateContext, pat: &Pat) -> bool {
725725
fn is_enum_variant(cx: &LateContext, did: NodeId) -> bool {
726-
matches!(cx.tcx.def_map.borrow().get(&did).map(|d| d.full_def()), Some(def::Def::Variant(..)))
726+
matches!(cx.tcx.def_map.borrow().get(&did).map(|d| d.full_def()), Some(def::Def::Variant(..)) | Some(def::Def::VariantCtor(..)))
727727
}
728728

729729
fn are_refutable<'a, I: Iterator<Item=&'a Pat>>(cx: &LateContext, mut i: I) -> bool {

0 commit comments

Comments
 (0)