Skip to content

Commit 596c54f

Browse files
committed
Auto merge of #5711 - flip1995:rustup, r=Manishearth
Rustup changelog: none
2 parents 7427065 + 08e044e commit 596c54f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+142
-169
lines changed

clippy_lints/src/atomic_ordering.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ fn match_ordering_def_path(cx: &LateContext<'_, '_>, did: DefId, orderings: &[&s
7070

7171
fn check_atomic_load_store(cx: &LateContext<'_, '_>, expr: &Expr<'_>) {
7272
if_chain! {
73-
if let ExprKind::MethodCall(ref method_path, _, args) = &expr.kind;
73+
if let ExprKind::MethodCall(ref method_path, _, args, _) = &expr.kind;
7474
let method = method_path.ident.name.as_str();
7575
if type_is_atomic(cx, &args[0]);
7676
if method == "load" || method == "store";

clippy_lints/src/booleans.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ fn simplify_not(cx: &LateContext<'_, '_>, expr: &Expr<'_>) -> Option<String> {
247247
))
248248
})
249249
},
250-
ExprKind::MethodCall(path, _, args) if args.len() == 1 => {
250+
ExprKind::MethodCall(path, _, args, _) if args.len() == 1 => {
251251
let type_of_receiver = cx.tables.expr_ty(&args[0]);
252252
if !is_type_diagnostic_item(cx, type_of_receiver, sym!(option_type))
253253
&& !is_type_diagnostic_item(cx, type_of_receiver, sym!(result_type))

clippy_lints/src/bytecount.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,10 @@ declare_lint_pass!(ByteCount => [NAIVE_BYTECOUNT]);
3838
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for ByteCount {
3939
fn check_expr(&mut self, cx: &LateContext<'_, '_>, expr: &Expr<'_>) {
4040
if_chain! {
41-
if let ExprKind::MethodCall(ref count, _, ref count_args) = expr.kind;
41+
if let ExprKind::MethodCall(ref count, _, ref count_args, _) = expr.kind;
4242
if count.ident.name == sym!(count);
4343
if count_args.len() == 1;
44-
if let ExprKind::MethodCall(ref filter, _, ref filter_args) = count_args[0].kind;
44+
if let ExprKind::MethodCall(ref filter, _, ref filter_args, _) = count_args[0].kind;
4545
if filter.ident.name == sym!(filter);
4646
if filter_args.len() == 2;
4747
if let ExprKind::Closure(_, _, body_id, _, _) = filter_args[1].kind;
@@ -66,7 +66,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for ByteCount {
6666
if ty::Uint(UintTy::U8) != walk_ptrs_ty(cx.tables.expr_ty(needle)).kind {
6767
return;
6868
}
69-
let haystack = if let ExprKind::MethodCall(ref path, _, ref args) =
69+
let haystack = if let ExprKind::MethodCall(ref path, _, ref args, _) =
7070
filter_args[0].kind {
7171
let p = path.ident.name;
7272
if (p == sym!(iter) || p == sym!(iter_mut)) && args.len() == 1 {

clippy_lints/src/consts.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -254,11 +254,11 @@ impl<'c, 'cc> ConstEvalLateContext<'c, 'cc> {
254254
if let ["core", "num", int_impl, "max_value"] = *def_path;
255255
then {
256256
let value = match int_impl {
257-
"<impl i8>" => i8::max_value() as u128,
258-
"<impl i16>" => i16::max_value() as u128,
259-
"<impl i32>" => i32::max_value() as u128,
260-
"<impl i64>" => i64::max_value() as u128,
261-
"<impl i128>" => i128::max_value() as u128,
257+
"<impl i8>" => i8::MAX as u128,
258+
"<impl i16>" => i16::MAX as u128,
259+
"<impl i32>" => i32::MAX as u128,
260+
"<impl i64>" => i64::MAX as u128,
261+
"<impl i128>" => i128::MAX as u128,
262262
_ => return None,
263263
};
264264
Some(Constant::Int(value))

clippy_lints/src/dereference.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Dereferencing {
4242
fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr<'_>) {
4343
if_chain! {
4444
if !expr.span.from_expansion();
45-
if let ExprKind::MethodCall(ref method_name, _, ref args) = &expr.kind;
45+
if let ExprKind::MethodCall(ref method_name, _, ref args, _) = &expr.kind;
4646
if args.len() == 1;
4747

4848
then {

clippy_lints/src/double_parens.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ impl EarlyLintPass for DoubleParens {
7070
}
7171
}
7272
},
73-
ExprKind::MethodCall(_, ref params) => {
73+
ExprKind::MethodCall(_, ref params, _) => {
7474
if params.len() == 2 {
7575
let param = &params[1];
7676
if let ExprKind::Paren(_) = param.kind {

clippy_lints/src/duration_subsec.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for DurationSubsec {
4242
fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr<'_>) {
4343
if_chain! {
4444
if let ExprKind::Binary(Spanned { node: BinOpKind::Div, .. }, ref left, ref right) = expr.kind;
45-
if let ExprKind::MethodCall(ref method_path, _ , ref args) = left.kind;
45+
if let ExprKind::MethodCall(ref method_path, _ , ref args, _) = left.kind;
4646
if match_type(cx, walk_ptrs_ty(cx.tables.expr_ty(&args[0])), &paths::DURATION);
4747
if let Some((Constant::Int(divisor), _)) = constant(cx, cx.tables, right);
4848
then {

clippy_lints/src/entry.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ fn check_cond<'a, 'tcx, 'b>(
103103
check: &'b Expr<'b>,
104104
) -> Option<(&'static str, &'b Expr<'b>, &'b Expr<'b>)> {
105105
if_chain! {
106-
if let ExprKind::MethodCall(ref path, _, ref params) = check.kind;
106+
if let ExprKind::MethodCall(ref path, _, ref params, _) = check.kind;
107107
if params.len() >= 2;
108108
if path.ident.name == sym!(contains_key);
109109
if let ExprKind::AddrOf(BorrowKind::Ref, _, ref key) = params[1].kind;
@@ -140,7 +140,7 @@ impl<'a, 'tcx, 'b> Visitor<'tcx> for InsertVisitor<'a, 'tcx, 'b> {
140140

141141
fn visit_expr(&mut self, expr: &'tcx Expr<'_>) {
142142
if_chain! {
143-
if let ExprKind::MethodCall(ref path, _, ref params) = expr.kind;
143+
if let ExprKind::MethodCall(ref path, _, ref params, _) = expr.kind;
144144
if params.len() == 3;
145145
if path.ident.name == sym!(insert);
146146
if get_item_name(self.cx, self.map) == get_item_name(self.cx, &params[0]);

clippy_lints/src/enum_clike.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UnportableVariant {
6565
continue;
6666
}
6767
},
68-
ty::Uint(UintTy::Usize) if val > u128::from(u32::max_value()) => {},
68+
ty::Uint(UintTy::Usize) if val > u128::from(u32::MAX) => {},
6969
_ => continue,
7070
}
7171
span_lint(

clippy_lints/src/eta_reduction.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for EtaReduction {
7171
}
7272

7373
match expr.kind {
74-
ExprKind::Call(_, args) | ExprKind::MethodCall(_, _, args) => {
74+
ExprKind::Call(_, args) | ExprKind::MethodCall(_, _, args, _) => {
7575
for arg in args {
7676
check_closure(cx, arg)
7777
}
@@ -120,7 +120,7 @@ fn check_closure(cx: &LateContext<'_, '_>, expr: &Expr<'_>) {
120120
);
121121

122122
if_chain!(
123-
if let ExprKind::MethodCall(ref path, _, ref args) = ex.kind;
123+
if let ExprKind::MethodCall(ref path, _, ref args, _) = ex.kind;
124124

125125
// Not the same number of arguments, there is no way the closure is the same as the function return;
126126
if args.len() == decl.inputs.len();

clippy_lints/src/explicit_write.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,11 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for ExplicitWrite {
3232
fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr<'_>) {
3333
if_chain! {
3434
// match call to unwrap
35-
if let ExprKind::MethodCall(ref unwrap_fun, _, ref unwrap_args) = expr.kind;
35+
if let ExprKind::MethodCall(ref unwrap_fun, _, ref unwrap_args, _) = expr.kind;
3636
if unwrap_fun.ident.name == sym!(unwrap);
3737
// match call to write_fmt
3838
if !unwrap_args.is_empty();
39-
if let ExprKind::MethodCall(ref write_fun, _, write_args) =
39+
if let ExprKind::MethodCall(ref write_fun, _, write_args, _) =
4040
unwrap_args[0].kind;
4141
if write_fun.ident.name == sym!(write_fmt);
4242
// match calls to std::io::stdout() / std::io::stderr ()

clippy_lints/src/floating_point_arithmetic.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ fn check_expm1(cx: &LateContext<'_, '_>, expr: &Expr<'_>) {
301301
if cx.tables.expr_ty(lhs).is_floating_point();
302302
if let Some((value, _)) = constant(cx, cx.tables, rhs);
303303
if F32(1.0) == value || F64(1.0) == value;
304-
if let ExprKind::MethodCall(ref path, _, ref method_args) = lhs.kind;
304+
if let ExprKind::MethodCall(ref path, _, ref method_args, _) = lhs.kind;
305305
if cx.tables.expr_ty(&method_args[0]).is_floating_point();
306306
if path.ident.name.as_str() == "exp";
307307
then {
@@ -481,7 +481,7 @@ fn check_custom_abs(cx: &LateContext<'_, '_>, expr: &Expr<'_>) {
481481

482482
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for FloatingPointArithmetic {
483483
fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr<'_>) {
484-
if let ExprKind::MethodCall(ref path, _, args) = &expr.kind {
484+
if let ExprKind::MethodCall(ref path, _, args, _) = &expr.kind {
485485
let recv_ty = cx.tables.expr_ty(&args[0]);
486486

487487
if recv_ty.is_floating_point() {

clippy_lints/src/format.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ fn on_argumentv1_new<'a, 'tcx>(
104104
}
105105
} else {
106106
let snip = snippet(cx, format_args.span, "<arg>");
107-
if let ExprKind::MethodCall(ref path, _, _) = format_args.kind {
107+
if let ExprKind::MethodCall(ref path, _, _, _) = format_args.kind {
108108
if path.ident.name == sym!(to_string) {
109109
return Some(format!("{}", snip));
110110
}

clippy_lints/src/functions.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -556,7 +556,7 @@ impl<'a, 'tcx> intravisit::Visitor<'tcx> for DerefVisitor<'a, 'tcx> {
556556
}
557557
}
558558
},
559-
hir::ExprKind::MethodCall(_, _, args) => {
559+
hir::ExprKind::MethodCall(_, _, args, _) => {
560560
let def_id = self.tables.type_dependent_def_id(expr.hir_id).unwrap();
561561
let base_type = self.cx.tcx.type_of(def_id);
562562

@@ -610,7 +610,7 @@ impl<'a, 'tcx> intravisit::Visitor<'tcx> for StaticMutVisitor<'a, 'tcx> {
610610
return;
611611
}
612612
match expr.kind {
613-
Call(_, args) | MethodCall(_, _, args) => {
613+
Call(_, args) | MethodCall(_, _, args, _) => {
614614
let mut tys = FxHashSet::default();
615615
for arg in args {
616616
let def_id = arg.hir_id.owner.to_def_id();

clippy_lints/src/get_last_with_len.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for GetLastWithLen {
4747
fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr<'_>) {
4848
if_chain! {
4949
// Is a method call
50-
if let ExprKind::MethodCall(ref path, _, ref args) = expr.kind;
50+
if let ExprKind::MethodCall(ref path, _, ref args, _) = expr.kind;
5151

5252
// Method name is "get"
5353
if path.ident.name == sym!(get);
@@ -69,7 +69,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for GetLastWithLen {
6969
) = &get_index_arg.kind;
7070

7171
// LHS of subtraction is "x.len()"
72-
if let ExprKind::MethodCall(arg_lhs_path, _, lhs_args) = &lhs.kind;
72+
if let ExprKind::MethodCall(arg_lhs_path, _, lhs_args, _) = &lhs.kind;
7373
if arg_lhs_path.ident.name == sym!(len);
7474
if let Some(arg_lhs_struct) = lhs_args.get(0);
7575

clippy_lints/src/if_let_mutex.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ impl<'tcx, 'l> ArmVisitor<'tcx, 'l> {
147147

148148
fn is_mutex_lock_call<'a>(cx: &LateContext<'a, '_>, expr: &'a Expr<'_>) -> Option<&'a Expr<'a>> {
149149
if_chain! {
150-
if let ExprKind::MethodCall(path, _span, args) = &expr.kind;
150+
if let ExprKind::MethodCall(path, _span, args, _) = &expr.kind;
151151
if path.ident.to_string() == "lock";
152152
let ty = cx.tables.expr_ty(&args[0]);
153153
if is_type_diagnostic_item(cx, ty, sym!(mutex_type));

clippy_lints/src/if_let_some_result.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for OkIfLet {
4242
if_chain! { //begin checking variables
4343
if let ExprKind::Match(ref op, ref body, source) = expr.kind; //test if expr is a match
4444
if let MatchSource::IfLetDesugar { .. } = source; //test if it is an If Let
45-
if let ExprKind::MethodCall(_, ok_span, ref result_types) = op.kind; //check is expr.ok() has type Result<T,E>.ok()
45+
if let ExprKind::MethodCall(_, ok_span, ref result_types, _) = op.kind; //check is expr.ok() has type Result<T,E>.ok(, _)
4646
if let PatKind::TupleStruct(QPath::Resolved(_, ref x), ref y, _) = body[0].pat.kind; //get operation
4747
if method_chain_args(op, &["ok"]).is_some(); //test to see if using ok() methoduse std::marker::Sized;
4848
if is_type_diagnostic_item(cx, cx.tables.expr_ty(&result_types[0]), sym!(result_type));

clippy_lints/src/infinite_iter.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ const HEURISTICS: [(&str, usize, Heuristic, Finiteness); 19] = [
142142

143143
fn is_infinite(cx: &LateContext<'_, '_>, expr: &Expr<'_>) -> Finiteness {
144144
match expr.kind {
145-
ExprKind::MethodCall(ref method, _, ref args) => {
145+
ExprKind::MethodCall(ref method, _, ref args, _) => {
146146
for &(name, len, heuristic, cap) in &HEURISTICS {
147147
if method.ident.name.as_str() == name && args.len() == len {
148148
return (match heuristic {
@@ -218,7 +218,7 @@ const INFINITE_COLLECTORS: [&[&str]; 8] = [
218218

219219
fn complete_infinite_iter(cx: &LateContext<'_, '_>, expr: &Expr<'_>) -> Finiteness {
220220
match expr.kind {
221-
ExprKind::MethodCall(ref method, _, ref args) => {
221+
ExprKind::MethodCall(ref method, _, ref args, _) => {
222222
for &(name, len) in &COMPLETING_METHODS {
223223
if method.ident.name.as_str() == name && args.len() == len {
224224
return is_infinite(cx, &args[0]);

clippy_lints/src/len_zero.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,8 @@ fn check_impl_items(cx: &LateContext<'_, '_>, item: &Item<'_>, impl_items: &[Imp
211211
}
212212

213213
fn check_cmp(cx: &LateContext<'_, '_>, span: Span, method: &Expr<'_>, lit: &Expr<'_>, op: &str, compare_to: u32) {
214-
if let (&ExprKind::MethodCall(ref method_path, _, ref args), &ExprKind::Lit(ref lit)) = (&method.kind, &lit.kind) {
214+
if let (&ExprKind::MethodCall(ref method_path, _, ref args, _), &ExprKind::Lit(ref lit)) = (&method.kind, &lit.kind)
215+
{
215216
// check if we are in an is_empty() method
216217
if let Some(name) = get_item_name(cx, method) {
217218
if name.as_str() == "is_empty" {

clippy_lints/src/loops.rs

+11-11
Original file line numberDiff line numberDiff line change
@@ -526,7 +526,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Loops {
526526
let pat = &arms[0].pat.kind;
527527
if let (
528528
&PatKind::TupleStruct(ref qpath, ref pat_args, _),
529-
&ExprKind::MethodCall(ref method_path, _, ref method_args),
529+
&ExprKind::MethodCall(ref method_path, _, ref method_args, _),
530530
) = (pat, &match_expr.kind)
531531
{
532532
let iter_expr = &method_args[0];
@@ -654,7 +654,7 @@ fn never_loop_expr(expr: &Expr<'_>, main_loop_id: HirId) -> NeverLoopResult {
654654
| ExprKind::Struct(_, _, Some(ref e))
655655
| ExprKind::Repeat(ref e, _)
656656
| ExprKind::DropTemps(ref e) => never_loop_expr(e, main_loop_id),
657-
ExprKind::Array(ref es) | ExprKind::MethodCall(_, _, ref es) | ExprKind::Tup(ref es) => {
657+
ExprKind::Array(ref es) | ExprKind::MethodCall(_, _, ref es, _) | ExprKind::Tup(ref es) => {
658658
never_loop_expr_all(&mut es.iter(), main_loop_id)
659659
},
660660
ExprKind::Call(ref e, ref es) => never_loop_expr_all(&mut once(&**e).chain(es.iter()), main_loop_id),
@@ -806,7 +806,7 @@ fn is_slice_like<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, ty: Ty<'_>) -> bool {
806806

807807
fn fetch_cloned_expr<'tcx>(expr: &'tcx Expr<'tcx>) -> &'tcx Expr<'tcx> {
808808
if_chain! {
809-
if let ExprKind::MethodCall(method, _, args) = expr.kind;
809+
if let ExprKind::MethodCall(method, _, args, _) = expr.kind;
810810
if method.ident.name == sym!(clone);
811811
if args.len() == 1;
812812
if let Some(arg) = args.get(0);
@@ -915,7 +915,7 @@ fn build_manual_memcpy_suggestion<'a, 'tcx>(
915915

916916
let print_limit = |end: &Expr<'_>, offset: Offset, var: &Expr<'_>| {
917917
if_chain! {
918-
if let ExprKind::MethodCall(method, _, len_args) = end.kind;
918+
if let ExprKind::MethodCall(method, _, len_args, _) = end.kind;
919919
if method.ident.name == sym!(len);
920920
if len_args.len() == 1;
921921
if let Some(arg) = len_args.get(0);
@@ -1190,7 +1190,7 @@ fn check_for_loop_range<'a, 'tcx>(
11901190

11911191
fn is_len_call(expr: &Expr<'_>, var: Name) -> bool {
11921192
if_chain! {
1193-
if let ExprKind::MethodCall(ref method, _, ref len_args) = expr.kind;
1193+
if let ExprKind::MethodCall(ref method, _, ref len_args, _) = expr.kind;
11941194
if len_args.len() == 1;
11951195
if method.ident.name == sym!(len);
11961196
if let ExprKind::Path(QPath::Resolved(_, ref path)) = len_args[0].kind;
@@ -1244,7 +1244,7 @@ fn lint_iter_method(cx: &LateContext<'_, '_>, args: &[Expr<'_>], arg: &Expr<'_>,
12441244

12451245
fn check_for_loop_arg(cx: &LateContext<'_, '_>, pat: &Pat<'_>, arg: &Expr<'_>, expr: &Expr<'_>) {
12461246
let mut next_loop_linted = false; // whether or not ITER_NEXT_LOOP lint was used
1247-
if let ExprKind::MethodCall(ref method, _, ref args) = arg.kind {
1247+
if let ExprKind::MethodCall(ref method, _, ref args, _) = arg.kind {
12481248
// just the receiver, no arguments
12491249
if args.len() == 1 {
12501250
let method_name = &*method.ident.as_str();
@@ -1718,7 +1718,7 @@ impl<'a, 'tcx> Visitor<'tcx> for VarVisitor<'a, 'tcx> {
17181718
fn visit_expr(&mut self, expr: &'tcx Expr<'_>) {
17191719
if_chain! {
17201720
// a range index op
1721-
if let ExprKind::MethodCall(ref meth, _, ref args) = expr.kind;
1721+
if let ExprKind::MethodCall(ref meth, _, ref args, _) = expr.kind;
17221722
if (meth.ident.name == sym!(index) && match_trait_method(self.cx, expr, &paths::INDEX))
17231723
|| (meth.ident.name == sym!(index_mut) && match_trait_method(self.cx, expr, &paths::INDEX_MUT));
17241724
if !self.check(&args[1], &args[0], expr);
@@ -1776,7 +1776,7 @@ impl<'a, 'tcx> Visitor<'tcx> for VarVisitor<'a, 'tcx> {
17761776
self.visit_expr(expr);
17771777
}
17781778
},
1779-
ExprKind::MethodCall(_, _, args) => {
1779+
ExprKind::MethodCall(_, _, args, _) => {
17801780
let def_id = self.cx.tables.type_dependent_def_id(expr.hir_id).unwrap();
17811781
for (ty, expr) in self.cx.tcx.fn_sig(def_id).inputs().skip_binder().iter().zip(args) {
17821782
self.prefer_mutable = false;
@@ -2369,8 +2369,8 @@ const NEEDLESS_COLLECT_MSG: &str = "avoid using `collect()` when not needed";
23692369

23702370
fn check_needless_collect<'a, 'tcx>(expr: &'tcx Expr<'_>, cx: &LateContext<'a, 'tcx>) {
23712371
if_chain! {
2372-
if let ExprKind::MethodCall(ref method, _, ref args) = expr.kind;
2373-
if let ExprKind::MethodCall(ref chain_method, _, _) = args[0].kind;
2372+
if let ExprKind::MethodCall(ref method, _, ref args, _) = expr.kind;
2373+
if let ExprKind::MethodCall(ref chain_method, _, _, _) = args[0].kind;
23742374
if chain_method.ident.name == sym!(collect) && match_trait_method(cx, &args[0], &paths::ITERATOR);
23752375
if let Some(ref generic_args) = chain_method.args;
23762376
if let Some(GenericArg::Type(ref ty)) = generic_args.args.get(0);
@@ -2437,7 +2437,7 @@ fn check_needless_collect<'a, 'tcx>(expr: &'tcx Expr<'_>, cx: &LateContext<'a, '
24372437

24382438
fn shorten_span(expr: &Expr<'_>, target_fn_name: Symbol) -> Span {
24392439
let mut current_expr = expr;
2440-
while let ExprKind::MethodCall(ref path, ref span, ref args) = current_expr.kind {
2440+
while let ExprKind::MethodCall(ref path, ref span, ref args, _) = current_expr.kind {
24412441
if path.ident.name == target_fn_name {
24422442
return expr.span.with_lo(span.lo());
24432443
}

0 commit comments

Comments
 (0)