Skip to content

Commit

Permalink
Merge pull request tafia#188 from yzsolt/ignore-deprecated-oneof-fields
Browse files Browse the repository at this point in the history
Ignore deprecated OneOf fields in the enum definition too
  • Loading branch information
tafia authored Mar 16, 2021
2 parents 87878e3 + 338e642 commit f87b5eb
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pb-rs/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1571,7 +1571,7 @@ impl OneOf {
} else {
writeln!(w, "pub enum OneOf{} {{", self.name)?;
}
for f in &self.fields {
for f in self.fields.iter().filter(|f| !f.deprecated) {
let rust_type = f.typ.rust_type(desc)?;
if f.boxed {
writeln!(w, " {}(Box<{}>),", f.name, rust_type)?;
Expand All @@ -1596,7 +1596,7 @@ impl OneOf {
) -> Result<()> {
// For the first of each enumeration type, generate an impl From<> for it.
let mut handled_fields = Vec::new();
for f in &self.fields {
for f in self.fields.iter().filter(|f| !f.deprecated) {
let rust_type = f.typ.rust_type(desc)?;
if handled_fields.contains(&rust_type) {
continue;
Expand Down

0 comments on commit f87b5eb

Please sign in to comment.