diff options
| author | Erik Desjardins <erikdesjardins@users.noreply.github.com> | 2020-07-10 19:02:10 -0400 |
|---|---|---|
| committer | Erik Desjardins <erikdesjardins@users.noreply.github.com> | 2020-07-10 19:02:10 -0400 |
| commit | 23d7b3f6f1a345ad95f0812c85613627164b6c39 (patch) | |
| tree | 73855b5ad50f0809a4fae68078bd184243418715 /src | |
| parent | 0cd7ff7ddfb75a38dca81ad3e76b1e984129e939 (diff) | |
| download | rust-23d7b3f6f1a345ad95f0812c85613627164b6c39.tar.gz rust-23d7b3f6f1a345ad95f0812c85613627164b6c39.zip | |
Remove an unwrap in layout computation
Diffstat (limited to 'src')
| -rw-r--r-- | src/librustc_middle/ty/layout.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/librustc_middle/ty/layout.rs b/src/librustc_middle/ty/layout.rs index 39b8566e7a8..efdb5f27afb 100644 --- a/src/librustc_middle/ty/layout.rs +++ b/src/librustc_middle/ty/layout.rs @@ -774,12 +774,12 @@ impl<'tcx> LayoutCx<'tcx, TyCtxt<'tcx>> { (present_variants.next(), present_variants.next()) }; let present_first = match present_first { - present_first @ Some(_) => present_first, + Some(present_first) => present_first, // Uninhabited because it has no variants, or only absent ones. None if def.is_enum() => return tcx.layout_raw(param_env.and(tcx.types.never)), // If it's a struct, still compute a layout so that we can still compute the // field offsets. - None => Some(VariantIdx::new(0)), + None => VariantIdx::new(0), }; let is_struct = !def.is_enum() || @@ -791,7 +791,7 @@ impl<'tcx> LayoutCx<'tcx, TyCtxt<'tcx>> { // Struct, or univariant enum equivalent to a struct. // (Typechecking will reject discriminant-sizing attrs.) - let v = present_first.unwrap(); + let v = present_first; let kind = if def.is_enum() || variants[v].is_empty() { StructKind::AlwaysSized } else { |
