Skip to content

Commit bef8324

Browse files
committed
rust: enable rustdoc::unescaped_backticks lint
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]>
1 parent 3fcc233 commit bef8324

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
@@ -461,7 +461,8 @@ export rust_common_flags := --edition=2021 \
461461
-Wclippy::undocumented_unsafe_blocks \
462462
-Wclippy::unnecessary_safety_comment \
463463
-Wclippy::unnecessary_safety_doc \
464-
-Wrustdoc::missing_crate_level_docs
464+
-Wrustdoc::missing_crate_level_docs \
465+
-Wrustdoc::unescaped_backticks
465466

466467
KBUILD_HOSTCFLAGS := $(KBUILD_USERHOSTCFLAGS) $(HOST_LFS_CFLAGS) \
467468
$(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)