Update to Rust 1.15.0-nightly (1c448574b 2016-11-28)

This commit is contained in:
Anthony Ramine 2016-11-12 12:55:51 +01:00
parent 7be32770b1
commit 1d56087188
14 changed files with 207 additions and 228 deletions

View file

@ -21,7 +21,7 @@ pub fn match_ty_unwrap<'a>(ty: &'a ast::Ty, segments: &[&str]) -> Option<&'a [P<
// I could muck around with the maps and find the full path
// however the more efficient way is to simply reverse the iterators and zip them
// which will compare them in reverse until one of them runs out of segments
if seg.iter().rev().zip(segments.iter().rev()).all(|(a, b)| a.identifier.name.as_str() == *b) {
if seg.iter().rev().zip(segments.iter().rev()).all(|(a, b)| &*a.identifier.name.as_str() == *b) {
match seg.last() {
Some(&ast::PathSegment { parameters: ast::PathParameters::AngleBracketed(ref a), .. }) => {
Some(&a.types)
@ -38,13 +38,8 @@ pub fn match_ty_unwrap<'a>(ty: &'a ast::Ty, segments: &[&str]) -> Option<&'a [P<
/// Checks if a type has a #[servo_lang = "str"] attribute
pub fn match_lang_ty(cx: &LateContext, ty: &hir::Ty, value: &str) -> bool {
match ty.node {
hir::TyPath(..) => {},
_ => return false,
}
let def = match cx.tcx.def_map.borrow().get(&ty.id) {
Some(&def::PathResolution { base_def: def, .. }) => def,
let def = match ty.node {
hir::TyPath(hir::QPath::Resolved(_, ref path)) => path.def,
_ => return false,
};
@ -57,17 +52,11 @@ pub fn match_lang_ty(cx: &LateContext, ty: &hir::Ty, value: &str) -> bool {
pub fn match_lang_did(cx: &LateContext, did: DefId, value: &str) -> bool {
cx.tcx.get_attrs(did).iter().any(|attr| {
match attr.node.value.node {
ast::MetaItemKind::NameValue(ref name, ref val) if &**name == "servo_lang" => {
match val.node {
ast::LitKind::Str(ref v, _) if &**v == value => {
mark_used(attr);
true
},
_ => false,
}
}
_ => false,
if attr.check_name("servo_lang") && attr.value_str().map_or(false, |v| v == value) {
mark_used(attr);
true
} else {
false
}
})
}
@ -91,7 +80,7 @@ pub fn match_def_path(cx: &LateContext, def_id: DefId, path: &[&str]) -> bool {
other.into_iter()
.map(|e| e.data)
.zip(path)
.all(|(nm, p)| nm.as_interned_str() == *p)
.all(|(nm, p)| &*nm.as_interned_str() == *p)
}
pub fn in_derive_expn(cx: &LateContext, span: Span) -> bool {