codgen: don't generate traits/builders mod if they are empty
@@ -71,15 +71,20 @@ pub fn generate_mod_rs(
general::start_comments(w, &env.config)?;
general::write_vec(w, mod_rs)?;
writeln!(w)?;
+ if !traits.is_empty() {
writeln!(w, "#[doc(hidden)]")?;
writeln!(w, "pub mod traits {{")?;
general::write_vec(w, traits)?;
writeln!(w, "}}")?;
+ }
+ if !builders.is_empty() {
writeln!(w, "#[doc(hidden)]")?;
writeln!(w, "pub mod builders {{")?;
general::write_vec(w, builders)?;
- writeln!(w, "}}")
+ writeln!(w, "}}")?;
+ }
+ Ok(())
});
}
