Fix dogfood

This commit is contained in:
mcarton 2016-12-02 22:33:16 +01:00
parent 65ff2df7e7
commit 1ba8ed96cf
No known key found for this signature in database
GPG Key ID: 5E427C794CBA45E8
3 changed files with 4 additions and 7 deletions

View File

@ -241,7 +241,7 @@ impl<'v, 't> RefVisitor<'v, 't> {
fn collect_anonymous_lifetimes(&mut self, qpath: &QPath, ty: &Ty) {
let last_path_segment = &last_path_segment(qpath).parameters;
if let &AngleBracketedParameters(ref params) = last_path_segment {
if let AngleBracketedParameters(ref params) = *last_path_segment {
if params.lifetimes.is_empty() {
match self.cx.tcx.tables().qpath_def(qpath, ty.id) {
Def::TyAlias(def_id) |

View File

@ -77,7 +77,7 @@ impl LateLintPass for TypePass {
if let TyPath(ref qpath) = ast_ty.node {
let def = cx.tcx.tables().qpath_def(qpath, ast_ty.id);
if let Some(def_id) = opt_def_id(def) {
if def_id == cx.tcx.lang_items.owned_box().unwrap() {
if Some(def_id) == cx.tcx.lang_items.owned_box() {
let last = last_path_segment(qpath);
if_let_chain! {[
let PathParameters::AngleBracketedParameters(ref ag) = last.parameters,

View File

@ -159,9 +159,6 @@ pub fn match_def_path(cx: &LateContext, def_id: DefId, path: &[&str]) -> bool {
let mut apb = AbsolutePathBuffer { names: vec![] };
cx.tcx.push_item_path(&mut apb, def_id);
if path == paths::VEC_FROM_ELEM {
println!("{:#?} == {:#?}", apb.names, path);
}
apb.names.len() == path.len() &&
apb.names.iter().zip(path.iter()).all(|(a, &b)| &**a == b)
@ -214,7 +211,7 @@ pub fn last_path_segment(path: &QPath) -> &PathSegment {
QPath::Resolved(_, ref path) => path.segments
.last()
.expect("A path must have at least one segment"),
QPath::TypeRelative(_, ref seg) => &seg,
QPath::TypeRelative(_, ref seg) => seg,
}
}
@ -222,7 +219,7 @@ pub fn single_segment_path(path: &QPath) -> Option<&PathSegment> {
match *path {
QPath::Resolved(_, ref path) if path.segments.len() == 1 => Some(&path.segments[0]),
QPath::Resolved(..) => None,
QPath::TypeRelative(_, ref seg) => Some(&seg),
QPath::TypeRelative(_, ref seg) => Some(seg),
}
}