Allow unused imports in generated code
This commit is contained in:
+6
-3
@@ -401,7 +401,8 @@ pub fn generate_rust_code(
|
||||
let rust_file_name = format!("{}.rs", proto_name.replace(".proto", ""));
|
||||
|
||||
let mut output = String::new();
|
||||
output.push_str("// @generated by protoc-gen-roto — do not edit\n\n");
|
||||
output.push_str("// @generated by protoc-gen-roto — do not edit\n");
|
||||
output.push_str("#![allow(unused_imports)]\n\n");
|
||||
output.push_str("use crate::{ProtoAccessor, ProtoBuilder, Result, RotoError, read_varint, RepeatedFieldIterator};\n");
|
||||
output.push_str("use std::str;\n\n");
|
||||
|
||||
@@ -462,7 +463,8 @@ pub fn generate_rust_code(
|
||||
}
|
||||
|
||||
let mut root_mod_content = String::new();
|
||||
root_mod_content.push_str("// @generated by protoc-gen-roto — do not edit\n\n");
|
||||
root_mod_content.push_str("// @generated by protoc-gen-roto — do not edit\n");
|
||||
root_mod_content.push_str("#![allow(unused_imports)]\n\n");
|
||||
let mut sorted_root_mods: Vec<_> = root_mods.into_iter().collect();
|
||||
sorted_root_mods.sort();
|
||||
for m in sorted_root_mods {
|
||||
@@ -472,7 +474,8 @@ pub fn generate_rust_code(
|
||||
|
||||
for (mod_path, sub_mods) in mod_files {
|
||||
let mut content = String::new();
|
||||
content.push_str("// @generated by protoc-gen-roto — do not edit\n\n");
|
||||
content.push_str("// @generated by protoc-gen-roto — do not edit\n");
|
||||
content.push_str("#![allow(unused_imports)]\n\n");
|
||||
let mut sorted_subs: Vec<_> = sub_mods.into_iter().collect();
|
||||
sorted_subs.sort();
|
||||
for sub in sorted_subs {
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
// @generated by protoc-gen-roto — do not edit
|
||||
#![allow(unused_imports)]
|
||||
|
||||
use crate::{ProtoAccessor, ProtoBuilder, Result, RotoError, read_varint, RepeatedFieldIterator};
|
||||
use std::str;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
// @generated by protoc-gen-roto — do not edit
|
||||
#![allow(unused_imports)]
|
||||
|
||||
use crate::{ProtoAccessor, ProtoBuilder, Result, RotoError, read_varint, RepeatedFieldIterator};
|
||||
use std::str;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
// @generated by protoc-gen-roto — do not edit
|
||||
#![allow(unused_imports)]
|
||||
|
||||
use crate::{ProtoAccessor, ProtoBuilder, Result, RotoError, read_varint, RepeatedFieldIterator};
|
||||
use std::str;
|
||||
|
||||
Reference in New Issue
Block a user