diff --git a/Cargo.lock b/Cargo.lock index 4a7cbab..12f86c1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -845,7 +845,7 @@ dependencies = [ [[package]] name = "pilota-build" -version = "0.11.23" +version = "0.11.24" dependencies = [ "ahash", "anyhow", diff --git a/pilota-build/Cargo.toml b/pilota-build/Cargo.toml index a878c4b..f94853e 100644 --- a/pilota-build/Cargo.toml +++ b/pilota-build/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pilota-build" -version = "0.11.23" +version = "0.11.24" edition = "2021" description = "Compile thrift and protobuf idl into rust code at compile-time." documentation = "https://docs.rs/pilota-build" diff --git a/pilota-build/src/parser/thrift/mod.rs b/pilota-build/src/parser/thrift/mod.rs index 9564202..10fb9da 100644 --- a/pilota-build/src/parser/thrift/mod.rs +++ b/pilota-build/src/parser/thrift/mod.rs @@ -126,16 +126,15 @@ impl ThriftLower { service.name.to_upper_camel_case() }; - let mut function_names: FxHashMap> = FxHashMap::default(); + let mut function_names: FxHashMap> = FxHashMap::default(); service.functions.iter().for_each(|func| { let name = self .extract_tags(&func.annotations) .get::() .map(|name| name.0.to_string()) .unwrap_or_else(|| func.name.to_string()); - let ident = Ident::from(name.clone()); function_names - .entry(ident.to_upper_camel_case()) + .entry(name.as_str().upper_camel_ident()) .or_default() .push(name); }); @@ -192,7 +191,7 @@ impl ThriftLower { .map(|name| name.0.clone()) .unwrap_or_else(|| FastStr::new(f.name.0.clone())); - let upper_camel_ident = f.name.as_str().upper_camel_ident(); + let upper_camel_ident = name.as_str().upper_camel_ident(); let method_name = if function_name_duplicates.contains(upper_camel_ident.as_str()) { name } else { @@ -303,7 +302,7 @@ impl ThriftLower { .map(|name| name.0.clone()) .unwrap_or_else(|| FastStr::new(method.name.0.clone())); - let upper_camel_ident = method.name.as_str().upper_camel_ident(); + let upper_camel_ident = name.as_str().upper_camel_ident(); let method_name = if function_name_duplicates.contains(upper_camel_ident.as_str()) { name } else {