Reduce indentation in write_data_structures
diff --git a/gen/src/write.rs b/gen/src/write.rs
index 370dac4..dcb7850 100644
--- a/gen/src/write.rs
+++ b/gen/src/write.rs
@@ -119,34 +119,36 @@
}
}
+ if out.header {
+ return;
+ }
+
out.set_namespace(Default::default());
- if !out.header {
- // MSVC workaround for "C linkage function cannot return C++ class" error.
- // Apparently the compiler fails to perform implicit instantiations as part
- // of an extern declaration return type. Instead we instantiate explicitly.
- // See https://stackoverflow.com/a/57429504/6086311.
- out.next_section();
- let mut slice_in_return_position = OrderedSet::new();
- for api in apis {
- if let Api::CxxFunction(efn) | Api::RustFunction(efn) = api {
- if let Some(ty @ Type::SliceRef(_)) = &efn.ret {
- slice_in_return_position.insert(ty);
- }
+ // MSVC workaround for "C linkage function cannot return C++ class" error.
+ // Apparently the compiler fails to perform implicit instantiations as part
+ // of an extern declaration return type. Instead we instantiate explicitly.
+ // See https://stackoverflow.com/a/57429504/6086311.
+ out.next_section();
+ let mut slice_in_return_position = OrderedSet::new();
+ for api in apis {
+ if let Api::CxxFunction(efn) | Api::RustFunction(efn) = api {
+ if let Some(ty @ Type::SliceRef(_)) = &efn.ret {
+ slice_in_return_position.insert(ty);
}
}
- for ty in &slice_in_return_position {
- write!(out, "template class ");
- write_type(out, ty);
- writeln!(out, ";");
- }
+ }
+ for ty in &slice_in_return_position {
+ write!(out, "template class ");
+ write_type(out, ty);
+ writeln!(out, ";");
+ }
- out.next_section();
- for api in apis {
- if let Api::TypeAlias(ety) = api {
- if let Some(reasons) = out.types.required_trivial.get(&ety.name.rust) {
- check_trivial_extern_type(out, ety, reasons)
- }
+ out.next_section();
+ for api in apis {
+ if let Api::TypeAlias(ety) = api {
+ if let Some(reasons) = out.types.required_trivial.get(&ety.name.rust) {
+ check_trivial_extern_type(out, ety, reasons)
}
}
}