From 559b51b18028db58072f201ca44efe716cd02657 Mon Sep 17 00:00:00 2001 From: Dom Dwyer Date: Sat, 24 Aug 2024 18:18:58 +0200 Subject: [PATCH 1/3] ci: lint for broken inline code / backticks Enables the rustdoc "unescaped_backticks" lint[1] at warn level. Unfortunately this only covers "prod" code, so it doesn't catch the actual broken backticks in the test code! [1]: https://doc.rust-lang.org/rustdoc/lints.html#unescaped_backticks --- src/lib.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index 9920b1bfc2f..c3ba00abad6 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -4,6 +4,9 @@ //! implemented in the [category](category/index.html), [keyword](keyword/index.html), //! [krate](krate/index.html), [user](user/index.html) and [version](version/index.html) modules. +// +#![warn(rustdoc::unescaped_backticks)] + #[cfg(test)] #[macro_use] extern crate claims; From 5c34d6602fe33b924f964a5d091244ef9ba300b5 Mon Sep 17 00:00:00 2001 From: Dom Dwyer Date: Sat, 24 Aug 2024 18:20:27 +0200 Subject: [PATCH 2/3] style: remove spurious backtick This breaks the rustdoc rendering. --- src/tests/util/test_app.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tests/util/test_app.rs b/src/tests/util/test_app.rs index a77317645d7..02911f04a86 100644 --- a/src/tests/util/test_app.rs +++ b/src/tests/util/test_app.rs @@ -116,7 +116,7 @@ impl TestApp { } /// Create a new user with a verified email address in the database - /// (`@example.com``) and return a mock user session. + /// (`@example.com`) and return a mock user session. /// /// This method updates the database directly pub fn db_new_user(&self, username: &str) -> MockCookieUser { From a3cf0a68c4cfc202aef9a35b6e7846f8bcd4dd13 Mon Sep 17 00:00:00 2001 From: Dom Dwyer Date: Sat, 24 Aug 2024 19:32:25 +0200 Subject: [PATCH 3/3] chore: apply rustdoc lint to workspace Lint the entire workspace by specifying it in Cargo.toml. --- Cargo.toml | 3 +++ src/lib.rs | 3 --- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index a76991d3da1..fefc7a9879c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -19,6 +19,9 @@ rust_2018_compatibility = "warn" rust_2021_compatibility = "warn" unused = "warn" +[workspace.lints.rustdoc] +unescaped_backticks = "warn" + [workspace.lints.clippy] dbg_macro = "warn" todo = "warn" diff --git a/src/lib.rs b/src/lib.rs index c3ba00abad6..9920b1bfc2f 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -4,9 +4,6 @@ //! implemented in the [category](category/index.html), [keyword](keyword/index.html), //! [krate](krate/index.html), [user](user/index.html) and [version](version/index.html) modules. -// -#![warn(rustdoc::unescaped_backticks)] - #[cfg(test)] #[macro_use] extern crate claims;