From c8db8ead90304a00cf32a12c2807bfd4b38aec69 Mon Sep 17 00:00:00 2001 From: Miguel Ojeda Date: Sun, 28 Jul 2024 16:37:58 +0200 Subject: [PATCH 1/2] Remove spurious backticks detected by `rustdoc::unescaped_backticks` There are only 3 cases across the crates rendered in the website (`core`, `alloc`, `std`, `proc_macro` and `test`), and they are all in `core`. Clean them up, so that the lint can be enabled in the next commit. Signed-off-by: Miguel Ojeda --- core/src/ops/deref.rs | 2 +- core/src/ptr/mod.rs | 2 +- core/src/slice/mod.rs | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/core/src/ops/deref.rs b/core/src/ops/deref.rs index 9849410d484c..f0d2c761ef35 100644 --- a/core/src/ops/deref.rs +++ b/core/src/ops/deref.rs @@ -282,7 +282,7 @@ impl DerefMut for &mut T { /// FIXME(deref_patterns): The precise semantics are undecided; the rough idea is that /// successive calls to `deref`/`deref_mut` without intermediate mutation should be /// idempotent, in the sense that they return the same value as far as pattern-matching -/// is concerned. Calls to `deref`/`deref_mut`` must leave the pointer itself likewise +/// is concerned. Calls to `deref`/`deref_mut` must leave the pointer itself likewise /// unchanged. #[unstable(feature = "deref_pure_trait", issue = "87121")] #[lang = "deref_pure"] diff --git a/core/src/ptr/mod.rs b/core/src/ptr/mod.rs index da6b541a9870..2566beeadac5 100644 --- a/core/src/ptr/mod.rs +++ b/core/src/ptr/mod.rs @@ -786,7 +786,7 @@ where /// /// The caller must also ensure that the memory the pointer (non-transitively) points to is never /// written to (except inside an `UnsafeCell`) using this pointer or any pointer derived from it. If -/// you need to mutate the pointee, use [`from_mut`]`. Specifically, to turn a mutable reference `m: +/// you need to mutate the pointee, use [`from_mut`]. Specifically, to turn a mutable reference `m: /// &mut T` into `*const T`, prefer `from_mut(m).cast_const()` to obtain a pointer that can later be /// used for mutation. /// diff --git a/core/src/slice/mod.rs b/core/src/slice/mod.rs index 5f75e1944122..067daa6a0d09 100644 --- a/core/src/slice/mod.rs +++ b/core/src/slice/mod.rs @@ -3452,8 +3452,8 @@ impl [T] { /// elements of the slice move to the end while the last `k` elements move /// to the front. /// - /// After calling `rotate_right`, the element previously at index `self.len() - /// - k` will become the first element in the slice. + /// After calling `rotate_right`, the element previously at index + /// `self.len() - k` will become the first element in the slice. /// /// # Panics /// From 80254cd2f120eb50cceb771a8fbe16812e41e543 Mon Sep 17 00:00:00 2001 From: Miguel Ojeda Date: Sun, 28 Jul 2024 16:37:58 +0200 Subject: [PATCH 2/2] Warn on `rustdoc::unescaped_backticks` for `core/alloc/std/test/proc_macro` They are all clean now, so enable the lint to keep them clean going forward. Signed-off-by: Miguel Ojeda --- alloc/src/lib.rs | 1 + core/src/lib.rs | 1 + proc_macro/src/lib.rs | 1 + std/src/lib.rs | 1 + test/src/lib.rs | 1 + 5 files changed, 5 insertions(+) diff --git a/alloc/src/lib.rs b/alloc/src/lib.rs index 3b039786eb5e..6c5859460500 100644 --- a/alloc/src/lib.rs +++ b/alloc/src/lib.rs @@ -86,6 +86,7 @@ #![warn(multiple_supertrait_upcastable)] #![allow(internal_features)] #![allow(rustdoc::redundant_explicit_links)] +#![warn(rustdoc::unescaped_backticks)] #![deny(ffi_unwind_calls)] // // Library features: diff --git a/core/src/lib.rs b/core/src/lib.rs index e8f08db94164..a3eca34a35cf 100644 --- a/core/src/lib.rs +++ b/core/src/lib.rs @@ -103,6 +103,7 @@ #![deny(ffi_unwind_calls)] // Do not check link redundancy on bootstraping phase #![allow(rustdoc::redundant_explicit_links)] +#![warn(rustdoc::unescaped_backticks)] // // Library features: // tidy-alphabetical-start diff --git a/proc_macro/src/lib.rs b/proc_macro/src/lib.rs index 57247359fbf2..10dcaa8cd3aa 100644 --- a/proc_macro/src/lib.rs +++ b/proc_macro/src/lib.rs @@ -37,6 +37,7 @@ #![recursion_limit = "256"] #![allow(internal_features)] #![deny(ffi_unwind_calls)] +#![warn(rustdoc::unescaped_backticks)] #[unstable(feature = "proc_macro_internals", issue = "27812")] #[doc(hidden)] diff --git a/std/src/lib.rs b/std/src/lib.rs index 353fd8d2de8c..7240605bfd65 100644 --- a/std/src/lib.rs +++ b/std/src/lib.rs @@ -254,6 +254,7 @@ #![deny(fuzzy_provenance_casts)] #![deny(unsafe_op_in_unsafe_fn)] #![allow(rustdoc::redundant_explicit_links)] +#![warn(rustdoc::unescaped_backticks)] // Ensure that std can be linked against panic_abort despite compiled with `-C panic=unwind` #![deny(ffi_unwind_calls)] // std may use features in a platform-specific way diff --git a/test/src/lib.rs b/test/src/lib.rs index 71cb796b9370..db87d923de0e 100644 --- a/test/src/lib.rs +++ b/test/src/lib.rs @@ -24,6 +24,7 @@ #![feature(panic_can_unwind)] #![feature(test)] #![allow(internal_features)] +#![warn(rustdoc::unescaped_backticks)] pub use self::bench::{black_box, Bencher}; pub use self::console::run_tests_console;