style: fix warnings

This commit is contained in:
appflowy
2022-02-09 18:35:50 +08:00
parent 4b63170e56
commit 7cceafa432
10 changed files with 35 additions and 64 deletions

View File

@ -15,7 +15,7 @@ impl DartEventCodeGen {
let event_crates = parse_dart_event_files(self.rust_sources.clone());
let event_ast = event_crates
.iter()
.map(|event_crate| parse_event_crate(event_crate))
.map(parse_event_crate)
.flatten()
.collect::<Vec<_>>();
@ -62,7 +62,7 @@ pub fn parse_dart_event_files(roots: Vec<String>) -> Vec<DartEventCrate> {
.into_iter()
.filter_entry(|e| !is_hidden(e))
.filter_map(|e| e.ok())
.filter(|e| is_crate_dir(e))
.filter(is_crate_dir)
.flat_map(|e| parse_crate_config_from(&e))
.map(|crate_config| DartEventCrate::from_config(&crate_config))
.collect::<Vec<DartEventCrate>>();

View File

@ -10,7 +10,7 @@ fn main() {
let matches = app().get_matches();
if let Some(ref matches) = matches.subcommand_matches("pb-gen") {
if let Some(matches) = matches.subcommand_matches("pb-gen") {
let rust_sources: Vec<String> = matches
.values_of("rust_sources")
.unwrap()
@ -27,7 +27,7 @@ fn main() {
.gen();
}
if let Some(ref matches) = matches.subcommand_matches("dart-event") {
if let Some(matches) = matches.subcommand_matches("dart-event") {
let rust_sources: Vec<String> = matches
.values_of("rust_sources")
.unwrap()

View File

@ -59,7 +59,7 @@ fn parse_files_protobuf(proto_crate_path: &str, proto_output_dir: &str) -> Vec<P
.iter()
.filter(|f| f.attrs.pb_index().is_some())
.for_each(|f| {
struct_template.set_field(&f);
struct_template.set_field(f);
});
let s = struct_template.render().unwrap();
@ -70,7 +70,7 @@ fn parse_files_protobuf(proto_crate_path: &str, proto_output_dir: &str) -> Vec<P
let enums = get_ast_enums(&ast);
enums.iter().for_each(|e| {
let mut enum_template = EnumTemplate::new();
enum_template.set_message_enum(&e);
enum_template.set_message_enum(e);
let s = enum_template.render().unwrap();
proto_file_content.push_str(s.as_ref());
proto_file_content.push('\n');