Rustup to *rustc 1.14.0-nightly (3210fd5c2
2016-10-05)*
This commit is contained in:
parent
e851bc7404
commit
0475eae1fa
@ -60,7 +60,7 @@ fn lint_item(&self, cx: &LateContext, item: &Item) {
|
||||
} else {
|
||||
let child = cx.sess().cstore.item_children(def.full_def().def_id());
|
||||
if let Some(child) = child.first() {
|
||||
if let Some(Def::Variant(..)) = cx.tcx.sess.cstore.describe_def(child.def_id) {
|
||||
if let Def::Variant(..) = child.def {
|
||||
span_lint(cx, ENUM_GLOB_USE, item.span, "don't use glob imports for enum variants");
|
||||
}
|
||||
}
|
||||
|
@ -71,7 +71,9 @@ fn has_no_effect(cx: &LateContext, expr: &Expr) -> bool {
|
||||
let def = cx.tcx.def_map.borrow().get(&callee.id).map(|d| d.full_def());
|
||||
match def {
|
||||
Some(Def::Struct(..)) |
|
||||
Some(Def::Variant(..)) => args.iter().all(|arg| has_no_effect(cx, arg)),
|
||||
Some(Def::Variant(..)) |
|
||||
Some(Def::StructCtor(..)) |
|
||||
Some(Def::VariantCtor(..)) => args.iter().all(|arg| has_no_effect(cx, arg)),
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
@ -146,7 +148,9 @@ fn reduce_expression<'a>(cx: &LateContext, expr: &'a Expr) -> Option<Vec<&'a Exp
|
||||
Expr_::ExprCall(ref callee, ref args) => {
|
||||
match cx.tcx.def_map.borrow().get(&callee.id).map(PathResolution::full_def) {
|
||||
Some(Def::Struct(..)) |
|
||||
Some(Def::Variant(..)) => Some(args.iter().map(Deref::deref).collect()),
|
||||
Some(Def::Variant(..)) |
|
||||
Some(Def::StructCtor(..)) |
|
||||
Some(Def::VariantCtor(..)) => Some(args.iter().map(Deref::deref).collect()),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
@ -234,10 +234,10 @@ pub fn path_to_def(cx: &LateContext, path: &[&str]) -> Option<def::Def> {
|
||||
for item in &mem::replace(&mut items, vec![]) {
|
||||
if item.name.as_str() == *segment {
|
||||
if path_it.peek().is_none() {
|
||||
return cx.tcx.sess.cstore.describe_def(item.def_id);
|
||||
return Some(item.def);
|
||||
}
|
||||
|
||||
items = cstore.item_children(item.def_id);
|
||||
items = cstore.item_children(item.def.def_id());
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -723,7 +723,7 @@ pub fn is_copy<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, ty: ty::Ty<'tcx>, env: Node
|
||||
/// Return whether a pattern is refutable.
|
||||
pub fn is_refutable(cx: &LateContext, pat: &Pat) -> bool {
|
||||
fn is_enum_variant(cx: &LateContext, did: NodeId) -> bool {
|
||||
matches!(cx.tcx.def_map.borrow().get(&did).map(|d| d.full_def()), Some(def::Def::Variant(..)))
|
||||
matches!(cx.tcx.def_map.borrow().get(&did).map(|d| d.full_def()), Some(def::Def::Variant(..)) | Some(def::Def::VariantCtor(..)))
|
||||
}
|
||||
|
||||
fn are_refutable<'a, I: Iterator<Item=&'a Pat>>(cx: &LateContext, mut i: I) -> bool {
|
||||
|
Loading…
Reference in New Issue
Block a user