Skip to content

Commit

Permalink
Support rustdoc v30 JSON format.
Browse files Browse the repository at this point in the history
  • Loading branch information
obi1kenobi committed Jun 10, 2024
1 parent 9fb656a commit 22ce9b9
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 12 deletions.
6 changes: 3 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "trustfall-rustdoc-adapter"
version = "29.0.0"
version = "30.0.0"
edition = "2021"
authors = ["Predrag Gruevski <[email protected]>"]
license = "Apache-2.0 OR MIT"
Expand All @@ -12,7 +12,7 @@ readme = "./README.md"

[dependencies]
trustfall = "0.7.1"
rustdoc-types = "0.25.0"
rustdoc-types = "0.26.0"

[dev-dependencies]
anyhow = "1.0.58"
Expand Down
2 changes: 1 addition & 1 deletion src/adapter/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ pub(crate) fn supported_item_kind(item: &Item) -> bool {
| rustdoc_types::ItemEnum::Function(..)
| rustdoc_types::ItemEnum::Impl(..)
| rustdoc_types::ItemEnum::Trait(..)
| rustdoc_types::ItemEnum::Constant(..)
| rustdoc_types::ItemEnum::Constant { .. }
| rustdoc_types::ItemEnum::Static(..)
| rustdoc_types::ItemEnum::AssocType { .. }
| rustdoc_types::ItemEnum::Module { .. }
Expand Down
6 changes: 3 additions & 3 deletions src/adapter/properties.rs
Original file line number Diff line number Diff line change
Expand Up @@ -533,7 +533,7 @@ pub(crate) fn resolve_constant_property<'a, V: AsVertex<Vertex<'a>> + 'a>(
"expr" => resolve_property_with(

Check warning on line 533 in src/adapter/properties.rs

View workflow job for this annotation

GitHub Actions / Check lint and rustfmt

Diff in /home/runner/work/trustfall-rustdoc-adapter/trustfall-rustdoc-adapter/src/adapter/properties.rs
contexts,
field_property!(as_item, inner, {
let ItemEnum::Constant(c) = &inner else {
let ItemEnum::Constant{ const_: c, .. } = &inner else {
unreachable!("expected to have a Constant")
};
c.expr.clone().into()
Expand All @@ -542,7 +542,7 @@ pub(crate) fn resolve_constant_property<'a, V: AsVertex<Vertex<'a>> + 'a>(
"value" => resolve_property_with(

Check warning on line 542 in src/adapter/properties.rs

View workflow job for this annotation

GitHub Actions / Check lint and rustfmt

Diff in /home/runner/work/trustfall-rustdoc-adapter/trustfall-rustdoc-adapter/src/adapter/properties.rs
contexts,
field_property!(as_item, inner, {
let ItemEnum::Constant(c) = &inner else {
let ItemEnum::Constant{ const_: c, .. } = &inner else {
unreachable!("expected to have a Constant")
};
c.value.clone().into()
Expand All @@ -551,7 +551,7 @@ pub(crate) fn resolve_constant_property<'a, V: AsVertex<Vertex<'a>> + 'a>(
"is_literal" => resolve_property_with(

Check warning on line 551 in src/adapter/properties.rs

View workflow job for this annotation

GitHub Actions / Check lint and rustfmt

Diff in /home/runner/work/trustfall-rustdoc-adapter/trustfall-rustdoc-adapter/src/adapter/properties.rs
contexts,
field_property!(as_item, inner, {
let ItemEnum::Constant(c) = &inner else {
let ItemEnum::Constant{ const_: c, .. } = &inner else {
unreachable!("expected to have a Constant")
};
c.is_literal.into()
Expand Down
4 changes: 2 additions & 2 deletions src/adapter/vertex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ impl<'a> Typename for Vertex<'a> {
rustdoc_types::ItemEnum::StructField(..) => "StructField",
rustdoc_types::ItemEnum::Impl(..) => "Impl",
rustdoc_types::ItemEnum::Trait(..) => "Trait",
rustdoc_types::ItemEnum::Constant(..) => "Constant",
rustdoc_types::ItemEnum::Constant { .. } => "Constant",
rustdoc_types::ItemEnum::Static(..) => "Static",
rustdoc_types::ItemEnum::AssocType { .. } => "AssociatedType",
_ => unreachable!("unexpected item.inner for item: {item:?}"),
Expand Down Expand Up @@ -215,7 +215,7 @@ impl<'a> Vertex<'a> {

pub(super) fn as_constant(&self) -> Option<&'a Constant> {
self.as_item().and_then(|item| match &item.inner {
rustdoc_types::ItemEnum::Constant(c) => Some(c),
rustdoc_types::ItemEnum::Constant { const_, .. } => Some(const_),
_ => None,
})
}
Expand Down
2 changes: 1 addition & 1 deletion src/visibility_tracker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ fn get_names_for_item<'a>(
}
ItemEnum::Variant(..)
| ItemEnum::Function(..)
| ItemEnum::Constant(..)
| ItemEnum::Constant { .. }
| ItemEnum::Static(..) => {
let item_name = item.name.as_deref().expect("item did not have a name");
[Some(NamespacedName::Values(item_name)), None]
Expand Down

0 comments on commit 22ce9b9

Please sign in to comment.