Skip to content

Commit 82f613e

Browse files
committed
Remove a span from hir::ExprKind::MethodCall
1 parent ec00cf8 commit 82f613e

File tree

91 files changed

+162
-168
lines changed

Some content is hidden

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

91 files changed

+162
-168
lines changed

clippy_lints/src/blocks_in_if_conditions.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ impl<'a, 'tcx> Visitor<'tcx> for ExVisitor<'a, 'tcx> {
5959
// do not lint if the closure is called using an iterator (see #1141)
6060
if_chain! {
6161
if let Some(parent) = get_parent_expr(self.cx, expr);
62-
if let ExprKind::MethodCall(_, _, [self_arg, ..], _) = &parent.kind;
62+
if let ExprKind::MethodCall(_, [self_arg, ..], _) = &parent.kind;
6363
let caller = self.cx.typeck_results().expr_ty(self_arg);
6464
if let Some(iter_id) = self.cx.tcx.get_diagnostic_item(sym::Iterator);
6565
if implements_trait(self.cx, caller, iter_id, &[]);

clippy_lints/src/booleans.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ fn simplify_not(cx: &LateContext<'_>, expr: &Expr<'_>) -> Option<String> {
259259
))
260260
})
261261
},
262-
ExprKind::MethodCall(path, _, args, _) if args.len() == 1 => {
262+
ExprKind::MethodCall(path, args, _) if args.len() == 1 => {
263263
let type_of_receiver = cx.typeck_results().expr_ty(&args[0]);
264264
if !is_type_diagnostic_item(cx, type_of_receiver, sym::Option)
265265
&& !is_type_diagnostic_item(cx, type_of_receiver, sym::Result)

clippy_lints/src/bytecount.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@ declare_lint_pass!(ByteCount => [NAIVE_BYTECOUNT]);
4141
impl<'tcx> LateLintPass<'tcx> for ByteCount {
4242
fn check_expr(&mut self, cx: &LateContext<'_>, expr: &Expr<'_>) {
4343
if_chain! {
44-
if let ExprKind::MethodCall(count, _, [count_recv], _) = expr.kind;
44+
if let ExprKind::MethodCall(count, [count_recv], _) = expr.kind;
4545
if count.ident.name == sym::count;
46-
if let ExprKind::MethodCall(filter, _, [filter_recv, filter_arg], _) = count_recv.kind;
46+
if let ExprKind::MethodCall(filter, [filter_recv, filter_arg], _) = count_recv.kind;
4747
if filter.ident.name == sym!(filter);
4848
if let ExprKind::Closure(_, _, body_id, _, _) = filter_arg.kind;
4949
let body = cx.tcx.hir().body(body_id);
@@ -68,7 +68,7 @@ impl<'tcx> LateLintPass<'tcx> for ByteCount {
6868
if ty::Uint(UintTy::U8) == *cx.typeck_results().expr_ty(needle).peel_refs().kind();
6969
if !is_local_used(cx, needle, arg_id);
7070
then {
71-
let haystack = if let ExprKind::MethodCall(path, _, args, _) =
71+
let haystack = if let ExprKind::MethodCall(path, args, _) =
7272
filter_recv.kind {
7373
let p = path.ident.name;
7474
if (p == sym::iter || p == sym!(iter_mut)) && args.len() == 1 {

clippy_lints/src/case_sensitive_file_extension_comparisons.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ declare_lint_pass!(CaseSensitiveFileExtensionComparisons => [CASE_SENSITIVE_FILE
3737

3838
fn check_case_sensitive_file_extension_comparison(ctx: &LateContext<'_>, expr: &Expr<'_>) -> Option<Span> {
3939
if_chain! {
40-
if let ExprKind::MethodCall(PathSegment { ident, .. }, _, [obj, extension, ..], span) = expr.kind;
40+
if let ExprKind::MethodCall(PathSegment { ident, .. }, [obj, extension, ..], span) = expr.kind;
4141
if ident.as_str() == "ends_with";
4242
if let ExprKind::Lit(Spanned { node: LitKind::Str(ext_literal, ..), ..}) = extension.kind;
4343
if (2..=6).contains(&ext_literal.as_str().len());

clippy_lints/src/casts/cast_possible_truncation.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ fn apply_reductions(cx: &LateContext<'_>, nbits: u64, expr: &Expr<'_>, signed: b
4343
},
4444
_ => nbits,
4545
},
46-
ExprKind::MethodCall(method, _, [left, right], _) => {
46+
ExprKind::MethodCall(method, [left, right], _) => {
4747
if signed {
4848
return nbits;
4949
}
@@ -54,7 +54,7 @@ fn apply_reductions(cx: &LateContext<'_>, nbits: u64, expr: &Expr<'_>, signed: b
5454
};
5555
apply_reductions(cx, nbits, left, signed).min(max_bits.unwrap_or(u64::max_value()))
5656
},
57-
ExprKind::MethodCall(method, _, [_, lo, hi], _) => {
57+
ExprKind::MethodCall(method, [_, lo, hi], _) => {
5858
if method.ident.as_str() == "clamp" {
5959
//FIXME: make this a diagnostic item
6060
if let (Some(lo_bits), Some(hi_bits)) = (get_constant_bits(cx, lo), get_constant_bits(cx, hi)) {
@@ -63,7 +63,7 @@ fn apply_reductions(cx: &LateContext<'_>, nbits: u64, expr: &Expr<'_>, signed: b
6363
}
6464
nbits
6565
},
66-
ExprKind::MethodCall(method, _, [_value], _) => {
66+
ExprKind::MethodCall(method, [_value], _) => {
6767
if method.ident.name.as_str() == "signum" {
6868
0 // do not lint if cast comes from a `signum` function
6969
} else {

clippy_lints/src/casts/cast_ptr_alignment.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ pub(super) fn check(cx: &LateContext<'_>, expr: &Expr<'_>) {
1919
cx.typeck_results().expr_ty(expr),
2020
);
2121
lint_cast_ptr_alignment(cx, expr, cast_from, cast_to);
22-
} else if let ExprKind::MethodCall(method_path, _, [self_arg, ..], _) = &expr.kind {
22+
} else if let ExprKind::MethodCall(method_path, [self_arg, ..], _) = &expr.kind {
2323
if_chain! {
2424
if method_path.ident.name == sym!(cast);
2525
if let Some(generic_args) = method_path.args;

clippy_lints/src/casts/cast_sign_loss.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,14 @@ fn should_lint(cx: &LateContext<'_>, cast_op: &Expr<'_>, cast_from: Ty<'_>, cast
4141
}
4242

4343
// Don't lint for the result of methods that always return non-negative values.
44-
if let ExprKind::MethodCall(path, _, _, _) = cast_op.kind {
44+
if let ExprKind::MethodCall(path, _, _) = cast_op.kind {
4545
let mut method_name = path.ident.name.as_str();
4646
let allowed_methods = ["abs", "checked_abs", "rem_euclid", "checked_rem_euclid"];
4747

4848
if_chain! {
4949
if method_name == "unwrap";
5050
if let Some(arglist) = method_chain_args(cast_op, &["unwrap"]);
51-
if let ExprKind::MethodCall(inner_path, _, _, _) = &arglist[0][0].kind;
51+
if let ExprKind::MethodCall(inner_path, _, _) = &arglist[0][0].kind;
5252
then {
5353
method_name = inner_path.ident.name.as_str();
5454
}

clippy_lints/src/default_numeric_fallback.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ impl<'a, 'tcx> Visitor<'tcx> for NumericFallbackVisitor<'a, 'tcx> {
131131
}
132132
},
133133

134-
ExprKind::MethodCall(_, _, args, _) => {
134+
ExprKind::MethodCall(_, args, _) => {
135135
if let Some(def_id) = self.cx.typeck_results().type_dependent_def_id(expr.hir_id) {
136136
let fn_sig = self.cx.tcx.fn_sig(def_id).skip_binder();
137137
for (expr, bound) in iter::zip(*args, fn_sig.inputs()) {

clippy_lints/src/dereference.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@ fn try_parse_ref_op<'tcx>(
361361
expr: &'tcx Expr<'_>,
362362
) -> Option<(RefOp, &'tcx Expr<'tcx>)> {
363363
let (def_id, arg) = match expr.kind {
364-
ExprKind::MethodCall(_, _, [arg], _) => (typeck.type_dependent_def_id(expr.hir_id)?, arg),
364+
ExprKind::MethodCall(_, [arg], _) => (typeck.type_dependent_def_id(expr.hir_id)?, arg),
365365
ExprKind::Call(
366366
Expr {
367367
kind: ExprKind::Path(path),
@@ -408,7 +408,7 @@ fn is_linted_explicit_deref_position(parent: Option<Node<'_>>, child_id: HirId,
408408
match parent.kind {
409409
// Leave deref calls in the middle of a method chain.
410410
// e.g. x.deref().foo()
411-
ExprKind::MethodCall(_, _, [self_arg, ..], _) if self_arg.hir_id == child_id => false,
411+
ExprKind::MethodCall(_, [self_arg, ..], _) if self_arg.hir_id == child_id => false,
412412

413413
// Leave deref calls resulting in a called function
414414
// e.g. (x.deref())()

clippy_lints/src/duration_subsec.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ impl<'tcx> LateLintPass<'tcx> for DurationSubsec {
4545
fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) {
4646
if_chain! {
4747
if let ExprKind::Binary(Spanned { node: BinOpKind::Div, .. }, left, right) = expr.kind;
48-
if let ExprKind::MethodCall(method_path, _ , args, _) = left.kind;
48+
if let ExprKind::MethodCall(method_path, args, _) = left.kind;
4949
if match_type(cx, cx.typeck_results().expr_ty(&args[0]).peel_refs(), &paths::DURATION);
5050
if let Some((Constant::Int(divisor), _)) = constant(cx, cx.typeck_results(), right);
5151
then {

0 commit comments

Comments
 (0)