Skip to content

Commit ed90843

Browse files
authored
Merge pull request #2153 from rust-lang-nursery/rustup
rustup to rustc 1.22.0-nightly (b796087 2017-10-18)
2 parents f47e564 + 35b2669 commit ed90843

File tree

4 files changed

+18
-15
lines changed

4 files changed

+18
-15
lines changed

clippy_lints/src/escape.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass {
7171
};
7272

7373
let region_scope_tree = &cx.tcx.region_scope_tree(fn_def_id);
74-
ExprUseVisitor::new(&mut v, cx.tcx, cx.param_env, region_scope_tree, cx.tables).consume_body(body);
74+
ExprUseVisitor::new(&mut v, cx.tcx, cx.param_env, region_scope_tree, cx.tables, None).consume_body(body);
7575

7676
for node in v.set {
7777
span_lint(

clippy_lints/src/loops.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1390,7 +1390,7 @@ fn check_for_mutation(cx: &LateContext, body: &Expr, bound_ids: &[Option<NodeId>
13901390
let mut delegate = MutateDelegate { node_id_low: bound_ids[0], node_id_high: bound_ids[1], span_low: None, span_high: None };
13911391
let def_id = def_id::DefId::local(body.hir_id.owner);
13921392
let region_scope_tree = &cx.tcx.region_scope_tree(def_id);
1393-
ExprUseVisitor::new(&mut delegate, cx.tcx, cx.param_env, region_scope_tree, cx.tables).walk_expr(body);
1393+
ExprUseVisitor::new(&mut delegate, cx.tcx, cx.param_env, region_scope_tree, cx.tables, None).walk_expr(body);
13941394
delegate.mutation_span()
13951395
}
13961396

clippy_lints/src/methods.rs

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -821,18 +821,6 @@ fn lint_or_fun_call(cx: &LateContext, expr: &hir::Expr, name: &str, args: &[hir:
821821
or_has_args: bool,
822822
span: Span,
823823
) {
824-
// don't lint for constant values
825-
// FIXME: can we `expect` here instead of match?
826-
let promotable = cx.tcx
827-
.rvalue_promotable_to_static
828-
.borrow()
829-
.get(&arg.id)
830-
.cloned()
831-
.unwrap_or(true);
832-
if promotable {
833-
return;
834-
}
835-
836824
// (path, fn_has_argument, methods, suffix)
837825
let know_types: &[(&[_], _, &[_], _)] = &[
838826
(&paths::BTREEMAP_ENTRY, false, &["or_insert"], "with"),
@@ -841,6 +829,21 @@ fn lint_or_fun_call(cx: &LateContext, expr: &hir::Expr, name: &str, args: &[hir:
841829
(&paths::RESULT, true, &["or", "unwrap_or"], "else"),
842830
];
843831

832+
// early check if the name is one we care about
833+
if know_types.iter().all(|k| !k.2.contains(&name)) {
834+
return;
835+
}
836+
837+
// don't lint for constant values
838+
// FIXME: can we `expect` here instead of match?
839+
let owner_def = cx.tcx.hir.get_parent_did(arg.id);
840+
let promotable = cx.tcx
841+
.rvalue_promotable_map(owner_def)
842+
[&arg.hir_id.local_id];
843+
if promotable {
844+
return;
845+
}
846+
844847
let self_ty = cx.tables.expr_ty(self_expr);
845848

846849
let (fn_has_arguments, poss, suffix) = if let Some(&(_, fn_has_arguments, poss, suffix)) =

clippy_lints/src/needless_pass_by_value.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NeedlessPassByValue {
108108
} = {
109109
let mut ctx = MovedVariablesCtxt::new(cx);
110110
let region_scope_tree = &cx.tcx.region_scope_tree(fn_def_id);
111-
euv::ExprUseVisitor::new(&mut ctx, cx.tcx, cx.param_env, region_scope_tree, cx.tables).consume_body(body);
111+
euv::ExprUseVisitor::new(&mut ctx, cx.tcx, cx.param_env, region_scope_tree, cx.tables, None).consume_body(body);
112112
ctx
113113
};
114114

0 commit comments

Comments
 (0)