Refactor: VariantIdx::from_u32(0) -> FIRST_VARIANT
Since structs are always `VariantIdx(0)`, there's a bunch of files where the only reason they had `VariantIdx` or `vec::Idx` imported at all was to get the first variant. So this uses a constant for that, and adds some doc-comments to `VariantIdx` while I'm there, since it doesn't have any today.
This commit is contained in:
@@ -785,7 +785,7 @@ fn codegen_stmt<'tcx>(
|
||||
let variant_dest = lval.downcast_variant(fx, variant_index);
|
||||
(variant_index, variant_dest, active_field_index)
|
||||
}
|
||||
_ => (VariantIdx::from_u32(0), lval, None),
|
||||
_ => (FIRST_VARIANT, lval, None),
|
||||
};
|
||||
if active_field_index.is_some() {
|
||||
assert_eq!(operands.len(), 1);
|
||||
|
||||
Reference in New Issue
Block a user