feat: Provide an '.item_kind()' method on ItemEnum#153279
feat: Provide an '.item_kind()' method on ItemEnum#153279rust-bors[bot] merged 1 commit intorust-lang:mainfrom
Conversation
|
rustdoc-json-types is a public (although nightly-only) API. If possible, consider changing |
|
|
This comment has been minimized.
This comment has been minimized.
04b869b to
931e2c4
Compare
There was a problem hiding this comment.
API makes sense. We do something like this in https://github.com/rust-lang/rust/blob/ec818fda361ca216eb186f5cf45131bd9c776bb4/src/tools/jsondoclint/src/item_kind.rs, which could probably be eliminated after this lands.
| } | ||
|
|
||
| impl ItemEnum { | ||
| /// Returns the [`ItemKind`] of this item. |
There was a problem hiding this comment.
NIT: This doc comment doesn't say anything that isn't in the function signature. Maybe add a sentance or an example about why you'd want to do this.
There was a problem hiding this comment.
It's one of those methods where it's difficult to be insightful in doc comments 😅
| ItemEnum::Static(_) => ItemKind::Static, | ||
| ItemEnum::ExternType => ItemKind::ExternType, | ||
| ItemEnum::Macro(_) => ItemKind::Macro, | ||
| ItemEnum::ProcMacro(pm) => match pm.kind { |
There was a problem hiding this comment.
Hmmm, maybe we should merge these in ItemKind, or split them in ItemEnum. (But not in this PR)
There was a problem hiding this comment.
Yeah, it does violate the overall ItemEnum variant <> ItemKind variant symmetry a bit.
|
@bors r+ rollup |
…aDotInTheVoid feat: Provide an '.item_kind()' method on ItemEnum A little helper method which I found myself adding over and over again in all the projects I maintain which depend on `rustdoc-json-types`. r? @aDotInTheVoid
…uwer Rollup of 12 pull requests Successful merges: - #152941 (prefer actual ABI-controling fields over target.abi when making ABI decisions) - #153227 (Don’t report missing fields in struct exprs with syntax errors.) - #153265 (Clarified doc comments + added tests confirming current behavior for intersperse/intersperse_with) - #152966 (Migrate 11 tests from tests/ui/issues to specific directories) - #153003 (rustdoc: make `--emit` and `--out-dir` mimic rustc) - #153034 (Remove unhelpful hint from trivial bound errors) - #153152 (Migration of LintDiagnostic - part 5) - #153177 (disable the ptr_fragment_in_final test on s390x) - #153221 (Add release notes for 1.94.0) - #153279 (feat: Provide an '.item_kind()' method on ItemEnum) - #153297 (Update the name of the Hermit operating system) - #153309 (Cleanup of c-variadic link test)
Rollup merge of #153279 - LukeMathWalker:add-kind-method, r=aDotInTheVoid feat: Provide an '.item_kind()' method on ItemEnum A little helper method which I found myself adding over and over again in all the projects I maintain which depend on `rustdoc-json-types`. r? @aDotInTheVoid
|
Published in v0.57.1 |
A little helper method which I found myself adding over and over again in all the projects I maintain which depend on
rustdoc-json-types.r? @aDotInTheVoid