Skip to content

Commit

Permalink
remove unnecessary const error handling in missing_const_for_fn
Browse files Browse the repository at this point in the history
  • Loading branch information
y21 committed Jun 7, 2024
1 parent 973f318 commit c3d3a3f
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions clippy_lints/src/missing_const_for_fn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,11 +147,7 @@ impl<'tcx> LateLintPass<'tcx> for MissingConstForFn {

let mir = cx.tcx.optimized_mir(def_id);

if let Err((span, err)) = is_min_const_fn(cx.tcx, mir, &self.msrv) {
if cx.tcx.is_const_fn_raw(def_id.to_def_id()) {
cx.tcx.dcx().span_err(span, err);
}
} else {
if let Ok(()) = is_min_const_fn(cx.tcx, mir, &self.msrv) {
span_lint(cx, MISSING_CONST_FOR_FN, span, "this could be a `const fn`");
}
}
Expand Down

0 comments on commit c3d3a3f

Please sign in to comment.