Skip to content

Commit

Permalink
Fix clippy.
Browse files Browse the repository at this point in the history
  • Loading branch information
cjgillot committed Jan 6, 2021
1 parent 05dc82a commit 7b9999c
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/tools/clippy/clippy_lints/src/functions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ impl<'tcx> LateLintPass<'tcx> for Functions {
intravisit::FnKind::Closure(_) => return,
};

let span = cx.tcx.hir().span(hir_id);
let span = cx.tcx.hir().span_with_body(hir_id);

// don't warn for implementations, it's not their fault
if !is_trait_impl_item(cx, hir_id) {
Expand Down
2 changes: 1 addition & 1 deletion src/tools/clippy/clippy_lints/src/missing_const_for_fn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ impl<'tcx> LateLintPass<'tcx> for MissingConstForFn {
}

let def_id = cx.tcx.hir().local_def_id(hir_id);
let span = cx.tcx.hir().span(hir_id);
let span = cx.tcx.hir().span_with_body(hir_id);

if in_external_macro(cx.tcx.sess, span) || is_entrypoint_fn(cx, def_id.to_def_id()) {
return;
Expand Down
2 changes: 1 addition & 1 deletion src/tools/clippy/clippy_lints/src/panic_in_result_fn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ impl<'tcx> LateLintPass<'tcx> for PanicInResultFn {
if !matches!(fn_kind, FnKind::Closure(_))
&& is_type_diagnostic_item(cx, return_ty(cx, hir_id), sym::result_type)
{
let span = cx.tcx.hir().span(hir_id);
let span = cx.tcx.hir().span_with_body(hir_id);
lint_impl_body(cx, span, body);
}
}
Expand Down
3 changes: 1 addition & 2 deletions src/tools/clippy/clippy_lints/src/unnecessary_wraps.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,10 @@ impl<'tcx> LateLintPass<'tcx> for UnnecessaryWraps {
});

if can_sugg && !suggs.is_empty() {
let span = cx.tcx.hir().span(hir_id);
span_lint_and_then(
cx,
UNNECESSARY_WRAPS,
span,
cx.tcx.hir().span_with_body(hir_id),
format!(
"this function's return value is unnecessarily wrapped by `{}`",
return_type
Expand Down

0 comments on commit 7b9999c

Please sign in to comment.