remove unnecessary const error handling in missing_const_for_fn

This commit is contained in:
y21 2024-06-07 21:54:33 +02:00
parent 973f318514
commit c3d3a3f301

View File

@ -147,11 +147,7 @@ fn check_fn(
let mir = cx.tcx.optimized_mir(def_id); let mir = cx.tcx.optimized_mir(def_id);
if let Err((span, err)) = is_min_const_fn(cx.tcx, mir, &self.msrv) { if let Ok(()) = 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 {
span_lint(cx, MISSING_CONST_FOR_FN, span, "this could be a `const fn`"); span_lint(cx, MISSING_CONST_FOR_FN, span, "this could be a `const fn`");
} }
} }