about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAlex Macleod <alex@macleod.io>2025-04-04 15:48:43 +0000
committerAlex Macleod <alex@macleod.io>2025-08-21 15:16:28 +0000
commite2a8b5b036cbda77bc2adf79f5dd73be498cb7ab (patch)
tree0caf8ee34ccf29abd534a4ce6bb5cb494da88672
parent743405d7bfe0f806e886012db23feb9869b81d2b (diff)
Lint to stable/beta lint docs page in diagnostics
-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",
+            }
         ));
     }
 }