Skip to content

Commit 8b17b65

Browse files
committed
Replace if let / else return with match
It reads a little bit better this way, but is exactly equivalent.
1 parent 5bda3aa commit 8b17b65

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

src/codegen/mod.rs

+12-12
Original file line numberDiff line numberDiff line change
@@ -2379,18 +2379,18 @@ impl ToRustTy for TemplateInstantiation {
23792379
}
23802380
}
23812381

2382-
let decl_params = if let Some(params) =
2383-
decl.self_template_params(ctx) {
2384-
params
2385-
} else {
2386-
// This can happen if we generated an opaque type for a
2387-
// partial template specialization, in which case we just
2388-
// use the opaque type's layout. If we don't have a layout,
2389-
// we cross our fingers and hope for the best :-/
2390-
debug_assert!(ctx.resolve_type_through_type_refs(decl)
2391-
.is_opaque());
2392-
let layout = self_ty.layout(ctx).unwrap_or(Layout::zero());
2393-
return BlobTyBuilder::new(layout).build();
2382+
let decl_params = match decl.self_template_params(ctx) {
2383+
Some(params) => params,
2384+
None => {
2385+
// This can happen if we generated an opaque type for a
2386+
// partial template specialization, in which case we just
2387+
// use the opaque type's layout. If we don't have a layout,
2388+
// we cross our fingers and hope for the best :-/
2389+
debug_assert!(ctx.resolve_type_through_type_refs(decl)
2390+
.is_opaque());
2391+
let layout = self_ty.layout(ctx).unwrap_or(Layout::zero());
2392+
return BlobTyBuilder::new(layout).build();
2393+
}
23942394
};
23952395

23962396
// TODO: If the decl type is a template class/struct

0 commit comments

Comments
 (0)