Skip to content

Commit e12d9ee

Browse files
committed
fix: remove is_normalizable() check
`is_normalizable()` was originally used because `layout_of()` would panic if the type wasn't normalizable. `layout_of()` was later fixed, so the check isn't necessary anymore. See rust-lang/rust-clippy#14717 for details.
1 parent 842f0a7 commit e12d9ee

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

bevy_lint/src/lints/nursery/zst_query.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ use crate::{
5656
};
5757
use clippy_utils::{
5858
diagnostics::span_lint_and_help,
59-
ty::{is_normalizable, match_type, ty_from_hir_ty},
59+
ty::{match_type, ty_from_hir_ty},
6060
};
6161
use rustc_abi::Size;
6262
use rustc_hir::AmbigArg;
@@ -155,11 +155,6 @@ impl QueryKind {
155155
/// - `Some(false)` if the type is most likely not a ZST
156156
/// - `None` if we cannot determine the size (e.g., type is not normalizable)
157157
fn is_zero_sized<'tcx>(cx: &LateContext<'tcx>, ty: Ty<'tcx>) -> Option<bool> {
158-
// `cx.layout_of()` panics if the type is not normalizable.
159-
if !is_normalizable(cx, cx.param_env, ty) {
160-
return None;
161-
}
162-
163158
// Note: we don't use `approx_ty_size` from `clippy_utils` here
164159
// because it will return `0` as the default value if the type is not
165160
// normalizable, which will put us at risk of emitting more false positives.

0 commit comments

Comments
 (0)