From 1376c5a617be5c25655d0d7cb63e3beaa5a6e026 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:20:39 +0200 Subject: Merging upstream version 1.70.0+dfsg1. Signed-off-by: Daniel Baumann --- src/tools/jsondoclint/Cargo.toml | 1 + src/tools/jsondoclint/src/item_kind.rs | 4 ++-- src/tools/jsondoclint/src/main.rs | 6 +++--- src/tools/jsondoclint/src/validator/tests.rs | 29 ++++++++++++++-------------- 4 files changed, 20 insertions(+), 20 deletions(-) (limited to 'src/tools/jsondoclint') diff --git a/src/tools/jsondoclint/Cargo.toml b/src/tools/jsondoclint/Cargo.toml index 8990310a4..1318a1f44 100644 --- a/src/tools/jsondoclint/Cargo.toml +++ b/src/tools/jsondoclint/Cargo.toml @@ -9,6 +9,7 @@ edition = "2021" anyhow = "1.0.62" clap = { version = "4.0.15", features = ["derive"] } fs-err = "2.8.1" +rustc-hash = "1.1.0" rustdoc-json-types = { version = "0.1.0", path = "../../rustdoc-json-types" } serde = { version = "1.0", features = ["derive"] } serde_json = "1.0.85" diff --git a/src/tools/jsondoclint/src/item_kind.rs b/src/tools/jsondoclint/src/item_kind.rs index b395c6e7d..45a9c93ee 100644 --- a/src/tools/jsondoclint/src/item_kind.rs +++ b/src/tools/jsondoclint/src/item_kind.rs @@ -1,6 +1,6 @@ use rustdoc_json_types::{Item, ItemEnum, ItemKind, ItemSummary}; -/// A univeral way to represent an [`ItemEnum`] or [`ItemKind`] +/// A universal way to represent an [`ItemEnum`] or [`ItemKind`] #[derive(Debug, Clone, Copy)] pub(crate) enum Kind { Module, @@ -53,7 +53,7 @@ impl Kind { Primitive => true, ForeignType => true, - // FIXME(adotinthevoid): I'm not sure if these are corrent + // FIXME(adotinthevoid): I'm not sure if these are correct Keyword => false, OpaqueTy => false, ProcAttribute => false, diff --git a/src/tools/jsondoclint/src/main.rs b/src/tools/jsondoclint/src/main.rs index 05e938f4f..ee163ddfd 100644 --- a/src/tools/jsondoclint/src/main.rs +++ b/src/tools/jsondoclint/src/main.rs @@ -72,7 +72,7 @@ fn main() -> Result<()> { ) } [sel] => eprintln!( - "{} not in index or paths, but refered to at '{}'", + "{} not in index or paths, but referred to at '{}'", err.id.0, json_find::to_jsonpath(&sel) ), @@ -85,12 +85,12 @@ fn main() -> Result<()> { .collect::>() .join(", "); eprintln!( - "{} not in index or paths, but refered to at {sels}", + "{} not in index or paths, but referred to at {sels}", err.id.0 ); } else { eprintln!( - "{} not in index or paths, but refered to at '{}' and {} more", + "{} not in index or paths, but referred to at '{}' and {} more", err.id.0, json_find::to_jsonpath(&sel), sels.len() - 1, diff --git a/src/tools/jsondoclint/src/validator/tests.rs b/src/tools/jsondoclint/src/validator/tests.rs index 1ef41ff12..95a56a9df 100644 --- a/src/tools/jsondoclint/src/validator/tests.rs +++ b/src/tools/jsondoclint/src/validator/tests.rs @@ -1,5 +1,4 @@ -use std::collections::HashMap; - +use rustc_hash::FxHashMap; use rustdoc_json_types::{Crate, Item, ItemKind, ItemSummary, Visibility, FORMAT_VERSION}; use crate::json_find::SelectorPart; @@ -27,7 +26,7 @@ fn errors_on_missing_links() { root: id("0"), crate_version: None, includes_private: false, - index: HashMap::from_iter([( + index: FxHashMap::from_iter([( id("0"), Item { name: Some("root".to_owned()), @@ -36,7 +35,7 @@ fn errors_on_missing_links() { span: None, visibility: Visibility::Public, docs: None, - links: HashMap::from_iter([("Not Found".to_owned(), id("1"))]), + links: FxHashMap::from_iter([("Not Found".to_owned(), id("1"))]), attrs: vec![], deprecation: None, inner: ItemEnum::Module(Module { @@ -46,8 +45,8 @@ fn errors_on_missing_links() { }), }, )]), - paths: HashMap::new(), - external_crates: HashMap::new(), + paths: FxHashMap::default(), + external_crates: FxHashMap::default(), format_version: rustdoc_json_types::FORMAT_VERSION, }; @@ -73,7 +72,7 @@ fn errors_on_local_in_paths_and_not_index() { root: id("0:0:1572"), crate_version: None, includes_private: false, - index: HashMap::from_iter([ + index: FxHashMap::from_iter([ ( id("0:0:1572"), Item { @@ -83,7 +82,7 @@ fn errors_on_local_in_paths_and_not_index() { span: None, visibility: Visibility::Public, docs: None, - links: HashMap::from_iter([(("prim@i32".to_owned(), id("0:1:1571")))]), + links: FxHashMap::from_iter([(("prim@i32".to_owned(), id("0:1:1571")))]), attrs: Vec::new(), deprecation: None, inner: ItemEnum::Module(Module { @@ -102,14 +101,14 @@ fn errors_on_local_in_paths_and_not_index() { span: None, visibility: Visibility::Public, docs: None, - links: HashMap::default(), + links: FxHashMap::default(), attrs: Vec::new(), deprecation: None, inner: ItemEnum::Primitive(Primitive { name: "i32".to_owned(), impls: vec![] }), }, ), ]), - paths: HashMap::from_iter([( + paths: FxHashMap::from_iter([( id("0:1:1571"), ItemSummary { crate_id: 0, @@ -117,7 +116,7 @@ fn errors_on_local_in_paths_and_not_index() { kind: ItemKind::Primitive, }, )]), - external_crates: HashMap::default(), + external_crates: FxHashMap::default(), format_version: rustdoc_json_types::FORMAT_VERSION, }; @@ -137,7 +136,7 @@ fn checks_local_crate_id_is_correct() { root: id("root"), crate_version: None, includes_private: false, - index: HashMap::from_iter([( + index: FxHashMap::from_iter([( id("root"), Item { id: id("root"), @@ -146,7 +145,7 @@ fn checks_local_crate_id_is_correct() { span: None, visibility: Visibility::Public, docs: None, - links: HashMap::default(), + links: FxHashMap::default(), attrs: Vec::new(), deprecation: None, inner: ItemEnum::Module(Module { @@ -156,8 +155,8 @@ fn checks_local_crate_id_is_correct() { }), }, )]), - paths: HashMap::default(), - external_crates: HashMap::default(), + paths: FxHashMap::default(), + external_crates: FxHashMap::default(), format_version: FORMAT_VERSION, }; check(&krate, &[]); -- cgit v1.2.3