From d68e549205cf7585b00a9ccb1484c0b4e40c2bf3 Mon Sep 17 00:00:00 2001 From: Wilfred Hughes Date: Thu, 13 Jun 2024 17:29:10 -0700 Subject: [PATCH] internal: Fix rustdoc warnings `cargo doc` generates a bunch of warnings on rust-analyzer. Fix all the bare URL and empty code block warnings. --- crates/hir-def/src/hir.rs | 6 +++--- crates/hir-def/src/nameres.rs | 4 ++-- crates/hir-expand/src/hygiene.rs | 2 +- crates/hir/src/has_source.rs | 2 +- crates/hir/src/semantics/source_to_def.rs | 20 +++++++++---------- .../src/completions/env_vars.rs | 3 ++- crates/ide-db/src/famous_defs.rs | 2 +- crates/parser/src/grammar.rs | 2 +- crates/rust-analyzer/src/tracing/hprof.rs | 4 ++-- crates/salsa/src/lib.rs | 2 +- crates/span/src/hygiene.rs | 2 +- crates/stdx/src/anymap.rs | 4 ++-- crates/test-utils/src/fixture.rs | 6 +++--- crates/test-utils/src/lib.rs | 2 +- crates/toolchain/src/lib.rs | 4 ++-- 15 files changed, 33 insertions(+), 32 deletions(-) diff --git a/crates/hir-def/src/hir.rs b/crates/hir-def/src/hir.rs index 2f7ebbfec1..fd6f4a3d08 100644 --- a/crates/hir-def/src/hir.rs +++ b/crates/hir-def/src/hir.rs @@ -503,11 +503,11 @@ impl BindingAnnotation { #[derive(Debug, Clone, Eq, PartialEq)] pub enum BindingProblems { - /// https://doc.rust-lang.org/stable/error_codes/E0416.html + /// BoundMoreThanOnce, - /// https://doc.rust-lang.org/stable/error_codes/E0409.html + /// BoundInconsistently, - /// https://doc.rust-lang.org/stable/error_codes/E0408.html + /// NotBoundAcrossAll, } diff --git a/crates/hir-def/src/nameres.rs b/crates/hir-def/src/nameres.rs index 256a37f6ec..162b6429c3 100644 --- a/crates/hir-def/src/nameres.rs +++ b/crates/hir-def/src/nameres.rs @@ -16,8 +16,8 @@ //! //! This happens in the `raw` module, which parses a single source file into a //! set of top-level items. Nested imports are desugared to flat imports in this -//! phase. Macro calls are represented as a triple of (Path, Option, -//! TokenTree). +//! phase. Macro calls are represented as a triple of `(Path, Option, +//! TokenTree)`. //! //! ## Collecting Modules //! diff --git a/crates/hir-expand/src/hygiene.rs b/crates/hir-expand/src/hygiene.rs index 097e760c70..cc02332207 100644 --- a/crates/hir-expand/src/hygiene.rs +++ b/crates/hir-expand/src/hygiene.rs @@ -4,7 +4,7 @@ //! Expansion, and Definition Contexts,” *Journal of Functional Programming* 22, no. 2 //! (March 1, 2012): 181–216, . //! -//! Also see https://rustc-dev-guide.rust-lang.org/macro-expansion.html#hygiene-and-hierarchies +//! Also see //! //! # The Expansion Order Hierarchy //! diff --git a/crates/hir/src/has_source.rs b/crates/hir/src/has_source.rs index 4b3b7ff4c4..929c8b3c09 100644 --- a/crates/hir/src/has_source.rs +++ b/crates/hir/src/has_source.rs @@ -26,7 +26,7 @@ pub trait HasSource { /// /// The current some implementations can return `InFile` instead of `Option`. /// But we made this method `Option` to support rlib in the future - /// by https://github.com/rust-lang/rust-analyzer/issues/6913 + /// by fn source(self, db: &dyn HirDatabase) -> Option>; } diff --git a/crates/hir/src/semantics/source_to_def.rs b/crates/hir/src/semantics/source_to_def.rs index 13dba8805a..df17a35734 100644 --- a/crates/hir/src/semantics/source_to_def.rs +++ b/crates/hir/src/semantics/source_to_def.rs @@ -26,19 +26,19 @@ //! //! The actual algorithm to resolve syntax to def is curious in two aspects: //! -//! * It is recursive -//! * It uses the inverse algorithm (what is the syntax for this def?) +//! * It is recursive +//! * It uses the inverse algorithm (what is the syntax for this def?) //! //! Specifically, the algorithm goes like this: //! -//! 1. Find the syntactic container for the syntax. For example, field's -//! container is the struct, and structs container is a module. -//! 2. Recursively get the def corresponding to container. -//! 3. Ask the container def for all child defs. These child defs contain -//! the answer and answer's siblings. -//! 4. For each child def, ask for it's source. -//! 5. The child def whose source is the syntax node we've started with -//! is the answer. +//! 1. Find the syntactic container for the syntax. For example, field's +//! container is the struct, and structs container is a module. +//! 2. Recursively get the def corresponding to container. +//! 3. Ask the container def for all child defs. These child defs contain +//! the answer and answer's siblings. +//! 4. For each child def, ask for it's source. +//! 5. The child def whose source is the syntax node we've started with +//! is the answer. //! //! It's interesting that both Roslyn and Kotlin contain very similar code //! shape. diff --git a/crates/ide-completion/src/completions/env_vars.rs b/crates/ide-completion/src/completions/env_vars.rs index 4005753773..23d93d3b74 100644 --- a/crates/ide-completion/src/completions/env_vars.rs +++ b/crates/ide-completion/src/completions/env_vars.rs @@ -1,4 +1,5 @@ -//! Completes environment variables defined by Cargo (https://doc.rust-lang.org/cargo/reference/environment-variables.html) +//! Completes environment variables defined by Cargo +//! () use hir::MacroFileIdExt; use ide_db::syntax_helpers::node_ext::macro_call_for_string_token; use syntax::{ diff --git a/crates/ide-db/src/famous_defs.rs b/crates/ide-db/src/famous_defs.rs index e445e9fb68..51ac0b7191 100644 --- a/crates/ide-db/src/famous_defs.rs +++ b/crates/ide-db/src/famous_defs.rs @@ -15,7 +15,7 @@ use crate::RootDatabase; /// you'd want to include minicore (see `test_utils::MiniCore`) declaration at /// the start of your tests: /// -/// ``` +/// ```text /// //- minicore: iterator, ord, derive /// ``` pub struct FamousDefs<'a, 'b>(pub &'a Semantics<'b, RootDatabase>, pub Crate); diff --git a/crates/parser/src/grammar.rs b/crates/parser/src/grammar.rs index b342e35488..2930190cb3 100644 --- a/crates/parser/src/grammar.rs +++ b/crates/parser/src/grammar.rs @@ -13,7 +13,7 @@ //! Code in this module also contains inline tests, which start with //! `// test name-of-the-test` comment and look like this: //! -//! ``` +//! ```text //! // test function_with_zero_parameters //! // fn foo() {} //! ``` diff --git a/crates/rust-analyzer/src/tracing/hprof.rs b/crates/rust-analyzer/src/tracing/hprof.rs index 978dcd67fa..2d1604e70b 100644 --- a/crates/rust-analyzer/src/tracing/hprof.rs +++ b/crates/rust-analyzer/src/tracing/hprof.rs @@ -1,8 +1,8 @@ //! Consumer of `tracing` data, which prints a hierarchical profile. //! -//! Based on https://github.com/davidbarsky/tracing-tree, but does less, while +//! Based on , but does less, while //! actually printing timings for spans by default. The code here is vendored from -//! https://github.com/matklad/tracing-span-tree. +//! . //! //! Usage: //! diff --git a/crates/salsa/src/lib.rs b/crates/salsa/src/lib.rs index 9219a55634..4292054cf6 100644 --- a/crates/salsa/src/lib.rs +++ b/crates/salsa/src/lib.rs @@ -284,7 +284,7 @@ pub trait ParallelDatabase: Database + Send { /// series of queries in parallel and arranging the results. Using /// this method for that purpose ensures that those queries will /// see a consistent view of the database (it is also advisable - /// for those queries to use the [`Runtime::unwind_if_cancelled`] + /// for those queries to use the [`Database::unwind_if_cancelled`] /// method to check for cancellation). /// /// # Panics diff --git a/crates/span/src/hygiene.rs b/crates/span/src/hygiene.rs index e4b0a26a6f..e8c558355c 100644 --- a/crates/span/src/hygiene.rs +++ b/crates/span/src/hygiene.rs @@ -4,7 +4,7 @@ //! Expansion, and Definition Contexts,” *Journal of Functional Programming* 22, no. 2 //! (March 1, 2012): 181–216, . //! -//! Also see https://rustc-dev-guide.rust-lang.org/macro-expansion.html#hygiene-and-hierarchies +//! Also see //! //! # The Expansion Order Hierarchy //! diff --git a/crates/stdx/src/anymap.rs b/crates/stdx/src/anymap.rs index d47b3d1647..d189b56a46 100644 --- a/crates/stdx/src/anymap.rs +++ b/crates/stdx/src/anymap.rs @@ -1,6 +1,6 @@ -//! This file is a port of only the necessary features from https://github.com/chris-morgan/anymap version 1.0.0-beta.2 for use within rust-analyzer. +//! This file is a port of only the necessary features from version 1.0.0-beta.2 for use within rust-analyzer. //! Copyright © 2014–2022 Chris Morgan. -//! COPYING: https://github.com/chris-morgan/anymap/blob/master/COPYING +//! COPYING: //! Note that the license is changed from Blue Oak Model 1.0.0 or MIT or Apache-2.0 to MIT OR Apache-2.0 //! //! This implementation provides a safe and convenient store for one value of each type. diff --git a/crates/test-utils/src/fixture.rs b/crates/test-utils/src/fixture.rs index 9871fd2cf0..54c9db7aac 100644 --- a/crates/test-utils/src/fixture.rs +++ b/crates/test-utils/src/fixture.rs @@ -143,14 +143,14 @@ pub struct FixtureWithProjectMeta { /// Specifies LLVM data layout to be used. /// /// You probably don't want to manually specify this. See LLVM manual for the - /// syntax, if you must: https://llvm.org/docs/LangRef.html#data-layout + /// syntax, if you must: pub target_data_layout: String, } impl FixtureWithProjectMeta { /// Parses text which looks like this: /// - /// ```not_rust + /// ```text /// //- some meta /// line 1 /// line 2 @@ -159,7 +159,7 @@ impl FixtureWithProjectMeta { /// /// Fixture can also start with a proc_macros and minicore declaration (in that order): /// - /// ``` + /// ```text /// //- toolchain: nightly /// //- proc_macros: identity /// //- minicore: sized diff --git a/crates/test-utils/src/lib.rs b/crates/test-utils/src/lib.rs index b750107803..43f62d0d1e 100644 --- a/crates/test-utils/src/lib.rs +++ b/crates/test-utils/src/lib.rs @@ -224,7 +224,7 @@ pub fn add_cursor(text: &str, offset: TextSize) -> String { /// Annotations point to the last line that actually was long enough for the /// range, not counting annotations themselves. So overlapping annotations are /// possible: -/// ```no_run +/// ```text /// // stuff other stuff /// // ^^ 'st' /// // ^^^^^ 'stuff' diff --git a/crates/toolchain/src/lib.rs b/crates/toolchain/src/lib.rs index b577723612..2591ed1691 100644 --- a/crates/toolchain/src/lib.rs +++ b/crates/toolchain/src/lib.rs @@ -23,7 +23,7 @@ impl Tool { /// /// The current implementation checks three places for an executable to use: /// 1) `$CARGO_HOME/bin/` - /// where $CARGO_HOME defaults to ~/.cargo (see https://doc.rust-lang.org/cargo/guide/cargo-home.html) + /// where $CARGO_HOME defaults to ~/.cargo (see ) /// example: for cargo, this tries $CARGO_HOME/bin/cargo, or ~/.cargo/bin/cargo if $CARGO_HOME is unset. /// It seems that this is a reasonable place to try for cargo, rustc, and rustup /// 2) Appropriate environment variable (erroring if this is set but not a usable executable) @@ -45,7 +45,7 @@ impl Tool { /// example: for cargo, this tries all paths in $PATH with appended `cargo`, returning the /// first that exists /// 3) `$CARGO_HOME/bin/` - /// where $CARGO_HOME defaults to ~/.cargo (see https://doc.rust-lang.org/cargo/guide/cargo-home.html) + /// where $CARGO_HOME defaults to ~/.cargo (see ) /// example: for cargo, this tries $CARGO_HOME/bin/cargo, or ~/.cargo/bin/cargo if $CARGO_HOME is unset. /// It seems that this is a reasonable place to try for cargo, rustc, and rustup /// 4) If all else fails, we just try to use the executable name directly