summaryrefslogtreecommitdiff
path: root/src/codegen/mod.rs
diff options
context:
space:
mode:
authorNick Fitzgerald <fitzgen@gmail.com>2017-03-09 14:42:16 -0800
committerNick Fitzgerald <fitzgen@gmail.com>2017-03-09 14:42:16 -0800
commit8b17b65d8cb107e481b5b922c06f5a7c7edee369 (patch)
treecde66394075ce6361bb81f4d63641469a9dcf6cc /src/codegen/mod.rs
parent5bda3aa54f7016d408e5b0c418c5cf9fa1f70125 (diff)
Replace if let / else return with match
It reads a little bit better this way, but is exactly equivalent.
Diffstat (limited to 'src/codegen/mod.rs')
-rw-r--r--src/codegen/mod.rs24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/codegen/mod.rs b/src/codegen/mod.rs
index 3024a819..28bab1c7 100644
--- a/src/codegen/mod.rs
+++ b/src/codegen/mod.rs
@@ -2379,18 +2379,18 @@ impl ToRustTy for TemplateInstantiation {
}
}
- let decl_params = if let Some(params) =
- decl.self_template_params(ctx) {
- params
- } else {
- // This can happen if we generated an opaque type for a
- // partial template specialization, in which case we just
- // use the opaque type's layout. If we don't have a layout,
- // we cross our fingers and hope for the best :-/
- debug_assert!(ctx.resolve_type_through_type_refs(decl)
- .is_opaque());
- let layout = self_ty.layout(ctx).unwrap_or(Layout::zero());
- return BlobTyBuilder::new(layout).build();
+ let decl_params = match decl.self_template_params(ctx) {
+ Some(params) => params,
+ None => {
+ // This can happen if we generated an opaque type for a
+ // partial template specialization, in which case we just
+ // use the opaque type's layout. If we don't have a layout,
+ // we cross our fingers and hope for the best :-/
+ debug_assert!(ctx.resolve_type_through_type_refs(decl)
+ .is_opaque());
+ let layout = self_ty.layout(ctx).unwrap_or(Layout::zero());
+ return BlobTyBuilder::new(layout).build();
+ }
};
// TODO: If the decl type is a template class/struct