diff --git a/src/codegen/sys/lib_.rs b/src/codegen/sys/lib_.rs index 87c05ef35..65d0d5bdd 100644 --- a/src/codegen/sys/lib_.rs +++ b/src/codegen/sys/lib_.rs @@ -312,6 +312,7 @@ fn generate_enums(w: &mut Write, env: &Env, items: &[&Enumeration]) -> Result<() } fn generate_unions(w: &mut Write, env: &Env, items: &[&Union]) -> Result<()> { + if !items.is_empty() { try!(writeln!(w, "// Unions")); } @@ -363,8 +364,11 @@ fn generate_unions(w: &mut Write, env: &Env, items: &[&Union]) -> Result<()> { } } } - if !items.is_empty() { - try!(writeln!(w, "")); + #[cfg(not(feature = "use_unions"))] + { + if !items.is_empty() { + try!(writeln!(w, "")); + } } Ok(()) @@ -530,7 +534,7 @@ fn generate_fields(env: &Env, struct_name: &str, fields: &[Field]) -> (Vec (Vec