Skip to content

Commit

Permalink
prost-build: replace parse_syn() with remaining syn::parse_str
Browse files Browse the repository at this point in the history
  • Loading branch information
gibbz00 committed Apr 20, 2024
1 parent 1f93cd8 commit 10ca7c3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
6 changes: 3 additions & 3 deletions prost-build/src/code_generator/enums.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,11 @@ impl CodeGenerator<'_> {
let field_attributes =
code_generator.resolve_field_attributes(fq_proto_enum_name, variant.proto_name);

let variant = syn::parse_str::<syn::Variant>(&format!(
let variant = format!(
"{} = {}",
variant.generated_variant_name, variant.proto_number
))
.expect("unable to parse enum variant");
)
.parse_syn::<syn::Variant>();

variants.push(quote! {
#(#documentation)*
Expand Down
3 changes: 1 addition & 2 deletions prost-build/src/code_generator/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,6 @@ impl<'a> CodeGenerator<'a> {
}

fn prost_type_path(&self, item: &str) -> TypePath {
syn::parse_str(&format!("{}::{}", self.resolve_prost_path(), item))
.expect("unable to parse prost type path")
format!("{}::{}", self.resolve_prost_path(), item).parse_syn()
}
}

0 comments on commit 10ca7c3

Please sign in to comment.