From 9a58a73bc62d3250cc459f7cb4b89056880dfa28 Mon Sep 17 00:00:00 2001 From: Bill Fraser Date: Sat, 13 Jul 2024 20:33:12 -0700 Subject: [PATCH] upgrade rustdoc-types --- Cargo.lock | 6 +++--- Cargo.toml | 4 ++-- src/analysis.rs | 3 ++- src/browser_rustdoc.rs | 5 +++-- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 6c8e2d5..a2ddb48 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -616,7 +616,7 @@ dependencies = [ [[package]] name = "rsbrowse" -version = "0.2.7" +version = "0.2.8" dependencies = [ "anyhow", "clap", @@ -632,9 +632,9 @@ dependencies = [ [[package]] name = "rustdoc-types" -version = "0.24.0" +version = "0.27.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0904b9147011800e63763fb9e49bbeaf76c1b6ab8982824c659dce5433712559" +checksum = "cbe3d9a9818bcf1e08f3ce06b359260921c2271d2c650b3589a43f0fd020774a" dependencies = [ "serde", ] diff --git a/Cargo.toml b/Cargo.toml index f1295c9..c6af5ff 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rsbrowse" -version = "0.2.7" +version = "0.2.8" authors = ["Bill Fraser "] description = "an interactive browser for the contents of Rust crates" edition = "2021" @@ -12,7 +12,7 @@ indicatif = "0.17.7" lazy_static = "1" log = "0.4" rayon = "1.8.0" -rustdoc-types = "0.24.0" +rustdoc-types = "0.27.0" serde_json = "1.0" tempfile = "3.8.1" diff --git a/src/analysis.rs b/src/analysis.rs index 227bb6a..0965fd6 100644 --- a/src/analysis.rs +++ b/src/analysis.rs @@ -201,7 +201,7 @@ impl Analysis { } TypeAlias(ty) => type_ids(&ty.type_), OpaqueTy(_) => vec![], - Constant(_) => vec![], + Constant { type_, .. } => type_ids(type_), Static(_) => vec![], ForeignType => vec![], Macro(_) => vec![], @@ -326,6 +326,7 @@ pub fn type_ids(ty: &rustdoc_types::Type) -> Vec<&rustdoc_types::Id> { from_self } } + Pat { type_, .. } => type_ids(type_), } } diff --git a/src/browser_rustdoc.rs b/src/browser_rustdoc.rs index f149f04..df734d6 100644 --- a/src/browser_rustdoc.rs +++ b/src/browser_rustdoc.rs @@ -64,7 +64,7 @@ impl RustdocBrowser { } TypeAlias(_) => "type", OpaqueTy(_) => "opaque type", - Constant(c) => return format!("const {}: {}", name, type_label(&c.type_)), + Constant { type_, const_: _ } => return format!("const {}: {}", name, type_label(type_)), Static(s) => return format!("static {}: {}", name, type_label(&s.type_)), ForeignType => "extern type", Macro(_) => "macro", @@ -228,7 +228,7 @@ impl<'a> Browser for &'a RustdocBrowser { match item { Item::Item(item) => { if let Some(docs) = &item.docs { - txt += &docs; + txt += docs; txt.push('\n'); } if let Some(span) = &item.span { @@ -454,5 +454,6 @@ fn type_label(ty: &rustdoc_types::Type) -> String { format!("{}::{name}", type_label(self_type)) } } + Pat { type_, .. } => type_label(type_), } }