Skip to content

Commit fbb3a47

Browse files
committed
Auto merge of #3961 - rust-lang:rustup, r=matthiaskrgr
Rust upgrade to rustc 1.35.0-nightly (9cd61f0 2019-04-14) Handles breakages from rust-lang/rust#59877 r? @oli-obk @matthiaskrgr
2 parents 6505794 + 2156f67 commit fbb3a47

File tree

9 files changed

+21
-24
lines changed

9 files changed

+21
-24
lines changed

Diff for: clippy_lints/src/eval_order_dependence.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ use rustc::hir::*;
55
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
66
use rustc::ty;
77
use rustc::{declare_tool_lint, lint_array};
8-
use syntax::ast;
98

109
declare_clippy_lint! {
1110
/// **What it does:** Checks for a read and a write to the same variable where
@@ -287,7 +286,7 @@ fn check_stmt<'a, 'tcx>(vis: &mut ReadVisitor<'a, 'tcx>, stmt: &'tcx Stmt) -> St
287286
struct ReadVisitor<'a, 'tcx: 'a> {
288287
cx: &'a LateContext<'a, 'tcx>,
289288
/// The ID of the variable we're looking for.
290-
var: ast::NodeId,
289+
var: HirId,
291290
/// The expressions where the write to the variable occurred (for reporting
292291
/// in the lint).
293292
write_expr: &'tcx Expr,

Diff for: clippy_lints/src/functions.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ impl<'a, 'tcx: 'a> DerefVisitor<'a, 'tcx> {
327327
fn check_arg(&self, ptr: &hir::Expr) {
328328
if let hir::ExprKind::Path(ref qpath) = ptr.node {
329329
if let Def::Local(id) = self.cx.tables.qpath_def(qpath, ptr.hir_id) {
330-
if self.ptrs.contains(&self.cx.tcx.hir().node_to_hir_id(id)) {
330+
if self.ptrs.contains(&id) {
331331
span_lint(
332332
self.cx,
333333
NOT_UNSAFE_PTR_ARG_DEREF,

Diff for: clippy_lints/src/let_if_seq.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ impl<'a, 'tcx> hir::intravisit::Visitor<'tcx> for UsedVisitor<'a, 'tcx> {
150150
if_chain! {
151151
if let hir::ExprKind::Path(ref qpath) = expr.node;
152152
if let Def::Local(local_id) = self.cx.tables.qpath_def(qpath, expr.hir_id);
153-
if self.id == self.cx.tcx.hir().node_to_hir_id(local_id);
153+
if self.id == local_id;
154154
then {
155155
self.used = true;
156156
return;
@@ -175,7 +175,7 @@ fn check_assign<'a, 'tcx>(
175175
if let hir::ExprKind::Assign(ref var, ref value) = expr.node;
176176
if let hir::ExprKind::Path(ref qpath) = var.node;
177177
if let Def::Local(local_id) = cx.tables.qpath_def(qpath, var.hir_id);
178-
if decl == cx.tcx.hir().node_to_hir_id(local_id);
178+
if decl == local_id;
179179
then {
180180
let mut v = UsedVisitor {
181181
cx,

Diff for: clippy_lints/src/loops.rs

+8-10
Original file line numberDiff line numberDiff line change
@@ -790,7 +790,7 @@ fn same_var<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, expr: &Expr, var: HirId) -> bo
790790
if path.segments.len() == 1;
791791
if let Def::Local(local_id) = cx.tables.qpath_def(qpath, expr.hir_id);
792792
// our variable!
793-
if cx.tcx.hir().node_to_hir_id(local_id) == var;
793+
if local_id == var;
794794
then {
795795
return true;
796796
}
@@ -1657,13 +1657,13 @@ fn check_for_mutability(cx: &LateContext<'_, '_>, bound: &Expr) -> Option<HirId>
16571657
then {
16581658
let def = cx.tables.qpath_def(qpath, bound.hir_id);
16591659
if let Def::Local(node_id) = def {
1660-
let node_str = cx.tcx.hir().get(node_id);
1660+
let node_str = cx.tcx.hir().get_by_hir_id(node_id);
16611661
if_chain! {
16621662
if let Node::Binding(pat) = node_str;
16631663
if let PatKind::Binding(bind_ann, ..) = pat.node;
16641664
if let BindingAnnotation::Mutable = bind_ann;
16651665
then {
1666-
return Some(cx.tcx.hir().node_to_hir_id(node_id));
1666+
return Some(node_id);
16671667
}
16681668
}
16691669
}
@@ -1792,9 +1792,7 @@ impl<'a, 'tcx> VarVisitor<'a, 'tcx> {
17921792
}
17931793
let def = self.cx.tables.qpath_def(seqpath, seqexpr.hir_id);
17941794
match def {
1795-
Def::Local(node_id) | Def::Upvar(node_id, ..) => {
1796-
let hir_id = self.cx.tcx.hir().node_to_hir_id(node_id);
1797-
1795+
Def::Local(hir_id) | Def::Upvar(hir_id, ..) => {
17981796
let parent_id = self.cx.tcx.hir().get_parent_item(expr.hir_id);
17991797
let parent_def_id = self.cx.tcx.hir().local_def_id_from_hir_id(parent_id);
18001798
let extent = self.cx.tcx.region_scope_tree(parent_def_id).var_scope(hir_id.local_id);
@@ -1856,15 +1854,15 @@ impl<'a, 'tcx> Visitor<'tcx> for VarVisitor<'a, 'tcx> {
18561854
then {
18571855
match self.cx.tables.qpath_def(qpath, expr.hir_id) {
18581856
Def::Upvar(local_id, ..) => {
1859-
if self.cx.tcx.hir().node_to_hir_id(local_id) == self.var {
1857+
if local_id == self.var {
18601858
// we are not indexing anything, record that
18611859
self.nonindex = true;
18621860
}
18631861
}
18641862
Def::Local(local_id) =>
18651863
{
18661864

1867-
if self.cx.tcx.hir().node_to_hir_id(local_id) == self.var {
1865+
if local_id == self.var {
18681866
self.nonindex = true;
18691867
} else {
18701868
// not the correct variable, but still a variable
@@ -2209,7 +2207,7 @@ fn var_def_id(cx: &LateContext<'_, '_>, expr: &Expr) -> Option<HirId> {
22092207
if let ExprKind::Path(ref qpath) = expr.node {
22102208
let path_res = cx.tables.qpath_def(qpath, expr.hir_id);
22112209
if let Def::Local(node_id) = path_res {
2212-
return Some(cx.tcx.hir().node_to_hir_id(node_id));
2210+
return Some(node_id);
22132211
}
22142212
}
22152213
None
@@ -2404,7 +2402,7 @@ impl<'a, 'tcx> VarCollectorVisitor<'a, 'tcx> {
24042402
then {
24052403
match def {
24062404
Def::Local(node_id) | Def::Upvar(node_id, ..) => {
2407-
self.ids.insert(self.cx.tcx.hir().node_to_hir_id(node_id));
2405+
self.ids.insert(node_id);
24082406
},
24092407
Def::Static(def_id, mutable) => {
24102408
self.def_ids.insert(def_id, mutable);

Diff for: clippy_lints/src/methods/unnecessary_filter_map.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ fn check_expression<'a, 'tcx: 'a>(
6868
if let hir::ExprKind::Path(path) = &args[0].node;
6969
if let Def::Local(ref local) = cx.tables.qpath_def(path, args[0].hir_id);
7070
then {
71-
if arg_id == cx.tcx.hir().node_to_hir_id(*local) {
71+
if arg_id == *local {
7272
return (false, false)
7373
}
7474
}

Diff for: clippy_lints/src/misc.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -612,7 +612,7 @@ fn in_attributes_expansion(expr: &Expr) -> bool {
612612
/// Tests whether `def` is a variable defined outside a macro.
613613
fn non_macro_local(cx: &LateContext<'_, '_>, def: &def::Def) -> bool {
614614
match *def {
615-
def::Def::Local(id) | def::Def::Upvar(id, _, _) => !in_macro(cx.tcx.hir().span(id)),
615+
def::Def::Local(id) | def::Def::Upvar(id, _, _) => !in_macro(cx.tcx.hir().span_by_hir_id(id)),
616616
_ => false,
617617
}
618618
}

Diff for: clippy_lints/src/unused_io_amount.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UnusedIoAmount {
5050
};
5151

5252
match expr.node {
53-
hir::ExprKind::Match(ref res, _, _) if is_try(cx, expr).is_some() => {
53+
hir::ExprKind::Match(ref res, _, _) if is_try(expr).is_some() => {
5454
if let hir::ExprKind::Call(ref func, ref args) = res.node {
5555
if let hir::ExprKind::Path(ref path) = func.node {
5656
if match_qpath(path, &paths::TRY_INTO_RESULT) && args.len() == 1 {

Diff for: clippy_lints/src/utils/mod.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -950,15 +950,15 @@ pub fn iter_input_pats<'tcx>(decl: &FnDecl, body: &'tcx Body) -> impl Iterator<I
950950

951951
/// Checks if a given expression is a match expression expanded from the `?`
952952
/// operator or the `try` macro.
953-
pub fn is_try<'a>(cx: &'_ LateContext<'_, '_>, expr: &'a Expr) -> Option<&'a Expr> {
954-
fn is_ok(cx: &'_ LateContext<'_, '_>, arm: &Arm) -> bool {
953+
pub fn is_try(expr: &Expr) -> Option<&Expr> {
954+
fn is_ok(arm: &Arm) -> bool {
955955
if_chain! {
956956
if let PatKind::TupleStruct(ref path, ref pat, None) = arm.pats[0].node;
957957
if match_qpath(path, &paths::RESULT_OK[1..]);
958958
if let PatKind::Binding(_, hir_id, _, None) = pat[0].node;
959959
if let ExprKind::Path(QPath::Resolved(None, ref path)) = arm.body.node;
960960
if let Def::Local(lid) = path.def;
961-
if cx.tcx.hir().node_to_hir_id(lid) == hir_id;
961+
if lid == hir_id;
962962
then {
963963
return true;
964964
}
@@ -984,8 +984,8 @@ pub fn is_try<'a>(cx: &'_ LateContext<'_, '_>, expr: &'a Expr) -> Option<&'a Exp
984984
if arms.len() == 2;
985985
if arms[0].pats.len() == 1 && arms[0].guard.is_none();
986986
if arms[1].pats.len() == 1 && arms[1].guard.is_none();
987-
if (is_ok(cx, &arms[0]) && is_err(&arms[1])) ||
988-
(is_ok(cx, &arms[1]) && is_err(&arms[0]));
987+
if (is_ok(&arms[0]) && is_err(&arms[1])) ||
988+
(is_ok(&arms[1]) && is_err(&arms[0]));
989989
then {
990990
return Some(expr);
991991
}

Diff for: clippy_lints/src/utils/usage.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ pub fn is_potentially_mutated<'a, 'tcx: 'a>(
3333
Def::Local(id) | Def::Upvar(id, ..) => id,
3434
_ => return true,
3535
};
36-
mutated_variables(expr, cx).map_or(true, |mutated| mutated.contains(&cx.tcx.hir().node_to_hir_id(id)))
36+
mutated_variables(expr, cx).map_or(true, |mutated| mutated.contains(&id))
3737
}
3838

3939
struct MutVarsDelegate {

0 commit comments

Comments
 (0)