Skip to content

Commit a2642f5

Browse files
ojedajfvogel
authored andcommitted
rust: enable rustdoc::unescaped_backticks lint
commit bef8324 upstream. In Rust 1.71.0, `rustdoc` added the `unescaped_backticks` lint, which detects what are typically typos in Markdown formatting regarding inline code [1], e.g. from the Rust standard library: /// ... to `deref`/`deref_mut`` must ... /// ... use [`from_mut`]`. Specifically, ... It does not seem to have almost any false positives, from the experience of enabling it in the Rust standard library [2], which will be checked starting with Rust 1.82.0. The maintainers also confirmed it is ready to be used. Thus enable it. Link: https://doc.rust-lang.org/rustdoc/lints.html#unescaped_backticks [1] Link: rust-lang/rust#128307 [2] Reviewed-by: Trevor Gross <[email protected]> Reviewed-by: Alice Ryhl <[email protected]> Tested-by: Gary Guo <[email protected]> Reviewed-by: Gary Guo <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Miguel Ojeda <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]> (cherry picked from commit 85ad4713660f475f366bd73c951e21656758fcc3) Signed-off-by: Jack Vogel <[email protected]>
1 parent 26df273 commit a2642f5

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

Makefile

+2-1
Original file line numberDiff line numberDiff line change
@@ -464,7 +464,8 @@ export rust_common_flags := --edition=2021 \
464464
-Wclippy::undocumented_unsafe_blocks \
465465
-Wclippy::unnecessary_safety_comment \
466466
-Wclippy::unnecessary_safety_doc \
467-
-Wrustdoc::missing_crate_level_docs
467+
-Wrustdoc::missing_crate_level_docs \
468+
-Wrustdoc::unescaped_backticks
468469

469470
KBUILD_HOSTCFLAGS := $(KBUILD_USERHOSTCFLAGS) $(HOST_LFS_CFLAGS) \
470471
$(HOSTCFLAGS) -I $(srctree)/scripts/include

rust/Makefile

+4-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ alloc-cfgs = \
6161
quiet_cmd_rustdoc = RUSTDOC $(if $(rustdoc_host),H, ) $<
6262
cmd_rustdoc = \
6363
OBJTREE=$(abspath $(objtree)) \
64-
$(RUSTDOC) $(if $(rustdoc_host),$(rust_common_flags),$(rust_flags)) \
64+
$(RUSTDOC) $(filter-out $(skip_flags),$(if $(rustdoc_host),$(rust_common_flags),$(rust_flags))) \
6565
$(rustc_target_flags) -L$(objtree)/$(obj) \
6666
-Zunstable-options --generate-link-to-definition \
6767
--output $(rustdoc_output) \
@@ -98,6 +98,9 @@ rustdoc-macros: private rustc_target_flags = --crate-type proc-macro \
9898
rustdoc-macros: $(src)/macros/lib.rs FORCE
9999
+$(call if_changed,rustdoc)
100100

101+
# Starting with Rust 1.82.0, skipping `-Wrustdoc::unescaped_backticks` should
102+
# not be needed -- see https://github.com/rust-lang/rust/pull/128307.
103+
rustdoc-core: private skip_flags = -Wrustdoc::unescaped_backticks
101104
rustdoc-core: private rustc_target_flags = $(core-cfgs)
102105
rustdoc-core: $(RUST_LIB_SRC)/core/src/lib.rs FORCE
103106
+$(call if_changed,rustdoc)

0 commit comments

Comments
 (0)