Skip to content

Commit 7b9999c

Browse files
committed
Fix clippy.
1 parent 05dc82a commit 7b9999c

File tree

4 files changed

+4
-5
lines changed

4 files changed

+4
-5
lines changed

src/tools/clippy/clippy_lints/src/functions.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ impl<'tcx> LateLintPass<'tcx> for Functions {
255255
intravisit::FnKind::Closure(_) => return,
256256
};
257257

258-
let span = cx.tcx.hir().span(hir_id);
258+
let span = cx.tcx.hir().span_with_body(hir_id);
259259

260260
// don't warn for implementations, it's not their fault
261261
if !is_trait_impl_item(cx, hir_id) {

src/tools/clippy/clippy_lints/src/missing_const_for_fn.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ impl<'tcx> LateLintPass<'tcx> for MissingConstForFn {
100100
}
101101

102102
let def_id = cx.tcx.hir().local_def_id(hir_id);
103-
let span = cx.tcx.hir().span(hir_id);
103+
let span = cx.tcx.hir().span_with_body(hir_id);
104104

105105
if in_external_macro(cx.tcx.sess, span) || is_entrypoint_fn(cx, def_id.to_def_id()) {
106106
return;

src/tools/clippy/clippy_lints/src/panic_in_result_fn.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ impl<'tcx> LateLintPass<'tcx> for PanicInResultFn {
4545
if !matches!(fn_kind, FnKind::Closure(_))
4646
&& is_type_diagnostic_item(cx, return_ty(cx, hir_id), sym::result_type)
4747
{
48-
let span = cx.tcx.hir().span(hir_id);
48+
let span = cx.tcx.hir().span_with_body(hir_id);
4949
lint_impl_body(cx, span, body);
5050
}
5151
}

src/tools/clippy/clippy_lints/src/unnecessary_wraps.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -108,11 +108,10 @@ impl<'tcx> LateLintPass<'tcx> for UnnecessaryWraps {
108108
});
109109

110110
if can_sugg && !suggs.is_empty() {
111-
let span = cx.tcx.hir().span(hir_id);
112111
span_lint_and_then(
113112
cx,
114113
UNNECESSARY_WRAPS,
115-
span,
114+
cx.tcx.hir().span_with_body(hir_id),
116115
format!(
117116
"this function's return value is unnecessarily wrapped by `{}`",
118117
return_type

0 commit comments

Comments
 (0)