Remove a span from hir::ExprKind::MethodCall
This commit is contained in:
parent
84e918971d
commit
b11733534d
112 changed files with 211 additions and 220 deletions
|
@ -61,7 +61,7 @@ impl<'tcx> LateLintPass<'tcx> for ArrayIntoIter {
|
|||
}
|
||||
|
||||
// We only care about method call expressions.
|
||||
if let hir::ExprKind::MethodCall(call, span, args, _) = &expr.kind {
|
||||
if let hir::ExprKind::MethodCall(call, args, _) = &expr.kind {
|
||||
if call.ident.name != sym::into_iter {
|
||||
return;
|
||||
}
|
||||
|
@ -119,7 +119,7 @@ impl<'tcx> LateLintPass<'tcx> for ArrayIntoIter {
|
|||
// to an array or to a slice.
|
||||
_ => bug!("array type coerced to something other than array or slice"),
|
||||
};
|
||||
cx.struct_span_lint(ARRAY_INTO_ITER, *span, |lint| {
|
||||
cx.struct_span_lint(ARRAY_INTO_ITER, call.ident.span, |lint| {
|
||||
let mut diag = lint.build(&format!(
|
||||
"this method call resolves to `<&{} as IntoIterator>::into_iter` \
|
||||
(due to backwards compatibility), \
|
||||
|
|
|
@ -2494,7 +2494,7 @@ impl<'tcx> LateLintPass<'tcx> for InvalidValue {
|
|||
_ => {}
|
||||
}
|
||||
}
|
||||
} else if let hir::ExprKind::MethodCall(_, _, ref args, _) = expr.kind {
|
||||
} else if let hir::ExprKind::MethodCall(_, ref args, _) = expr.kind {
|
||||
// Find problematic calls to `MaybeUninit::assume_init`.
|
||||
let def_id = cx.typeck_results().type_dependent_def_id(expr.hir_id)?;
|
||||
if cx.tcx.is_diagnostic_item(sym::assume_init, def_id) {
|
||||
|
|
|
@ -44,7 +44,7 @@ fn in_macro(span: Span) -> bool {
|
|||
fn first_method_call<'tcx>(
|
||||
expr: &'tcx Expr<'tcx>,
|
||||
) -> Option<(&'tcx PathSegment<'tcx>, &'tcx [Expr<'tcx>])> {
|
||||
if let ExprKind::MethodCall(path, _, args, _) = &expr.kind {
|
||||
if let ExprKind::MethodCall(path, args, _) = &expr.kind {
|
||||
if args.iter().any(|e| e.span.from_expansion()) { None } else { Some((path, *args)) }
|
||||
} else {
|
||||
None
|
||||
|
|
|
@ -40,7 +40,7 @@ declare_lint_pass!(NoopMethodCall => [NOOP_METHOD_CALL]);
|
|||
impl<'tcx> LateLintPass<'tcx> for NoopMethodCall {
|
||||
fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) {
|
||||
// We only care about method calls.
|
||||
let ExprKind::MethodCall(call, _, elements, _) = &expr.kind else {
|
||||
let ExprKind::MethodCall(call, elements, _) = &expr.kind else {
|
||||
return
|
||||
};
|
||||
// We only care about method calls corresponding to the `Clone`, `Deref` and `Borrow`
|
||||
|
|
|
@ -1464,7 +1464,7 @@ impl InvalidAtomicOrdering {
|
|||
sym::AtomicI128,
|
||||
];
|
||||
if_chain! {
|
||||
if let ExprKind::MethodCall(ref method_path, _, args, _) = &expr.kind;
|
||||
if let ExprKind::MethodCall(ref method_path, args, _) = &expr.kind;
|
||||
if recognized_names.contains(&method_path.ident.name);
|
||||
if let Some(m_def_id) = cx.typeck_results().type_dependent_def_id(expr.hir_id);
|
||||
if let Some(impl_did) = cx.tcx.impl_of_method(m_def_id);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue