about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAlex Macleod <alex@macleod.io>2025-08-21 15:22:19 +0000
committerGitHub <noreply@github.com>2025-08-21 15:22:19 +0000
commitc32c864ec149700ef966fb115a175aa3b22bdb1d (patch)
treea6f482a2163a6d415e394559280f0ab1876e260c
parent1954d4c0e45c17484a5a36af6af318aaedacbffe (diff)
parente2a8b5b036cbda77bc2adf79f5dd73be498cb7ab (diff)
downloadrust-c32c864ec149700ef966fb115a175aa3b22bdb1d.tar.gz
rust-c32c864ec149700ef966fb115a175aa3b22bdb1d.zip
Lint to stable/beta lint docs page in diagnostics (#14547)
Fixes https://github.com/rust-lang/rust-clippy/issues/14534

r? @flip1995

changelog: none
-rw-r--r--clippy_utils/src/diagnostics.rs15
1 files changed, 8 insertions, 7 deletions
diff --git a/clippy_utils/src/diagnostics.rs b/clippy_utils/src/diagnostics.rs
index 625e1eead21..8a19039a7fe 100644
--- a/clippy_utils/src/diagnostics.rs
+++ b/clippy_utils/src/diagnostics.rs
@@ -22,13 +22,14 @@ fn docs_link(diag: &mut Diag<'_, ()>, lint: &'static Lint) {
     {
         diag.help(format!(
             "for further information visit https://rust-lang.github.io/rust-clippy/{}/index.html#{lint}",
-            &option_env!("RUST_RELEASE_NUM").map_or_else(
-                || "master".to_string(),
-                |n| {
-                    // extract just major + minor version and ignore patch versions
-                    format!("rust-{}", n.rsplit_once('.').unwrap().1)
-                }
-            )
+            match option_env!("CFG_RELEASE_CHANNEL") {
+                // Clippy version is 0.1.xx
+                //
+                // Always use .0 because we do not generate separate lint doc pages for rust patch releases
+                Some("stable") => concat!("rust-1.", env!("CARGO_PKG_VERSION_PATCH"), ".0"),
+                Some("beta") => "beta",
+                _ => "master",
+            }
         ));
     }
 }