fix various rustup failures

This commit is contained in:
Oliver Schneider 2017-04-06 16:48:48 +02:00
parent 7c94a62048
commit 6d921b4734
3 changed files with 5 additions and 3 deletions

View File

@ -108,7 +108,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for LetIfSeq {
cond=snippet(cx, cond.span, "_"), cond=snippet(cx, cond.span, "_"),
then=if then.stmts.len() > 1 { " ..;" } else { "" }, then=if then.stmts.len() > 1 { " ..;" } else { "" },
else=if default_multi_stmts { " ..;" } else { "" }, else=if default_multi_stmts { " ..;" } else { "" },
value=snippet(cx, then.span, "<value>"), value=snippet(cx, value.span, "<value>"),
default=snippet(cx, default.span, "<default>"), default=snippet(cx, default.span, "<default>"),
); );
span_lint_and_then(cx, span_lint_and_then(cx,

View File

@ -357,6 +357,9 @@ pub fn method_chain_args<'a>(expr: &'a Expr, methods: &[&str]) -> Option<Vec<&'a
// method chains are stored last -> first // method chains are stored last -> first
if let ExprMethodCall(ref name, _, ref args) = current.node { if let ExprMethodCall(ref name, _, ref args) = current.node {
if name.node == *method_name { if name.node == *method_name {
if args.iter().any(|e| in_macro(e.span)) {
return None;
}
matched.push(&**args); // build up `matched` backwards matched.push(&**args); // build up `matched` backwards
current = &args[0] // go to parent expression current = &args[0] // go to parent expression
} else { } else {

View File

@ -20,13 +20,12 @@ fn main() {
lazy_static! { lazy_static! {
static ref MUT_MAP : HashMap<usize, &'static str> = { static ref MUT_MAP : HashMap<usize, &'static str> = {
let mut m = HashMap::new(); let mut m = HashMap::new();
let mut zero = &mut &mut "zero";
m.insert(0, "zero"); m.insert(0, "zero");
m m
}; };
static ref MUT_COUNT : usize = MUT_MAP.len(); static ref MUT_COUNT : usize = MUT_MAP.len();
} }
assert!(*MUT_COUNT == 1); assert_eq!(*MUT_COUNT, 1);
// FIXME: don't lint in array length, requires `check_body` // FIXME: don't lint in array length, requires `check_body`
//let _ = [""; (42.0 < std::f32::NAN) as usize]; //let _ = [""; (42.0 < std::f32::NAN) as usize];
} }