Skip to content

Commit 31fc027

Browse files
committed
use cx.tcx.def_span
as recommended in rust-lang#15461 (comment)
1 parent c0f379e commit 31fc027

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

clippy_lints/src/functions/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -502,7 +502,7 @@ impl<'tcx> LateLintPass<'tcx> for Functions {
502502
def_id: LocalDefId,
503503
) {
504504
let hir_id = cx.tcx.local_def_id_to_hir_id(def_id);
505-
too_many_arguments::check_fn(cx, kind, decl, span, hir_id, self.too_many_arguments_threshold);
505+
too_many_arguments::check_fn(cx, kind, decl, hir_id, def_id, self.too_many_arguments_threshold);
506506
too_many_lines::check_fn(cx, kind, span, body, self.too_many_lines_threshold);
507507
not_unsafe_ptr_arg_deref::check_fn(cx, kind, decl, body, def_id);
508508
misnamed_getters::check_fn(cx, kind, decl, body, span);

clippy_lints/src/functions/too_many_arguments.rs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
use rustc_abi::ExternAbi;
22
use rustc_hir as hir;
3+
use rustc_hir::def_id::LocalDefId;
34
use rustc_hir::intravisit::FnKind;
45
use rustc_lint::LateContext;
56
use rustc_span::Span;
@@ -13,21 +14,16 @@ pub(super) fn check_fn(
1314
cx: &LateContext<'_>,
1415
kind: FnKind<'_>,
1516
decl: &hir::FnDecl<'_>,
16-
span: Span,
1717
hir_id: hir::HirId,
18+
def_id: LocalDefId,
1819
too_many_arguments_threshold: u64,
1920
) {
2021
// don't warn for implementations, it's not their fault
2122
if !is_trait_impl_item(cx, hir_id)
2223
// don't lint extern functions decls, it's not their fault either
2324
&& kind.header().is_some_and(|header| header.abi == ExternAbi::Rust)
2425
{
25-
check_arg_number(
26-
cx,
27-
decl,
28-
span.with_hi(decl.output.span().hi()),
29-
too_many_arguments_threshold,
30-
);
26+
check_arg_number(cx, decl, cx.tcx.def_span(def_id), too_many_arguments_threshold);
3127
}
3228
}
3329

0 commit comments

Comments
 (0)