Fix unnecessary imports

This commit is contained in:
Martin Dahl 2020-04-07 09:50:12 +02:00
parent 9275c15258
commit bc8fc7bd74
1 changed files with 7 additions and 8 deletions

View File

@ -32,22 +32,21 @@ fn main() {
for (prefix, msgs) in prefixes {
codegen.push_str(&format!(" pub mod {} {{\n", prefix));
for msg in msgs {
if prefix == &"srv" {
for msg in msgs {
codegen.push_str("#[allow(non_snake_case)]\n");
codegen.push_str(&format!(" pub mod {} {{\n", msg));
codegen.push_str(" use super::super::super::*;\n");
for s in &["Request", "Response"] {
let msgname = format!("{}_{}", msg, s);
codegen.push_str("#[allow(unused_imports)]\n");
codegen.push_str(" use super::super::super::*;\n");
codegen.push_str(&generate_rust_msg(module, prefix, &msgname));
println!("cargo:rustc-cfg=r2r__{}__{}__{}", module, prefix, msg);
}
codegen.push_str(" }\n");
}
} else {
// the need to allow unused seems to be a compiler bug...
codegen.push_str("#[allow(unused_imports)]\n");
codegen.push_str(" use super::super::*;\n");
for msg in msgs {
codegen.push_str(&generate_rust_msg(module, prefix, msg));
println!("cargo:rustc-cfg=r2r__{}__{}__{}", module, prefix, msg);
}