-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Fix json tuple struct enum variant #88391
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -56,6 +56,10 @@ crate trait DocFolder: Sized { | |
|| j.fields.iter().any(|f| f.is_stripped()); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [Self note (for future):] We can probably remove this part because variant fields always have inherited visibility. |
||
VariantItem(Variant::Struct(j)) | ||
} | ||
Variant::Tuple(fields) => { | ||
let fields = fields.into_iter().filter_map(|x| self.fold_item(x)).collect(); | ||
VariantItem(Variant::Tuple(fields)) | ||
} | ||
_ => VariantItem(i2), | ||
} | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -93,8 +93,8 @@ impl<'a> DocFolder for Stripper<'a> { | |
|
||
// implementations of traits are always public. | ||
clean::ImplItem(ref imp) if imp.trait_.is_some() => true, | ||
// Struct variant fields have inherited visibility | ||
clean::VariantItem(clean::Variant::Struct(..)) => true, | ||
// Variant fields have inherited visibility | ||
clean::VariantItem(clean::Variant::Struct(..) | clean::Variant::Tuple(..)) => true, | ||
Comment on lines
+96
to
+97
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This seems like an unrelated—but still good—fix, right? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah indeed, didn't even pay attention. But yes, bug fix! :) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Or actually it shouldn't have any effect on behavior, but it is a performance fix :) |
||
_ => false, | ||
}; | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// @has variant_struct.json "$.index[*][?(@.name=='EnumStruct')].visibility" \"public\" | ||
// @has - "$.index[*][?(@.name=='EnumStruct')].kind" \"enum\" | ||
pub enum EnumStruct { | ||
// @has - "$.index[*][?(@.name=='VariantS')].inner.variant_kind" \"struct\" | ||
// @has - "$.index[*][?(@.name=='x')]" | ||
// @has - "$.index[*][?(@.name=='y')]" | ||
VariantS { | ||
x: u32, | ||
y: String, | ||
}, | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
// @has variant_tuple_struct.json "$.index[*][?(@.name=='EnumTupleStruct')].visibility" \"public\" | ||
// @has - "$.index[*][?(@.name=='EnumTupleStruct')].kind" \"enum\" | ||
pub enum EnumTupleStruct { | ||
// @has - "$.index[*][?(@.name=='VariantA')].inner.variant_kind" \"tuple\" | ||
VariantA(u32, String), | ||
} |
Uh oh!
There was an error while loading. Please reload this page.