We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents a45feda + 79e31cb commit 7cf96daCopy full SHA for 7cf96da
clippy_lints/src/default_union_representation.rs
@@ -69,6 +69,9 @@ impl<'tcx> LateLintPass<'tcx> for DefaultUnionRepresentation {
69
}
70
71
/// Returns true if the given item is a union with at least two non-ZST fields.
72
+/// (ZST fields having an arbitrary offset is completely inconsequential, and
73
+/// if there is only one field left after ignoring ZST fields then the offset
74
+/// of that field does not matter either.)
75
fn is_union_with_two_non_zst_fields(cx: &LateContext<'_>, item: &Item<'_>) -> bool {
76
if let ItemKind::Union(data, _) = &item.kind {
77
data.fields().iter().filter(|f| !is_zst(cx, f.ty)).count() >= 2
0 commit comments