Skip to content

Commit c32c864

Browse files
authored
Lint to stable/beta lint docs page in diagnostics (#14547)
Fixes #14534 r? @flip1995 changelog: none
2 parents 1954d4c + e2a8b5b commit c32c864

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

clippy_utils/src/diagnostics.rs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,14 @@ fn docs_link(diag: &mut Diag<'_, ()>, lint: &'static Lint) {
2222
{
2323
diag.help(format!(
2424
"for further information visit https://rust-lang.github.io/rust-clippy/{}/index.html#{lint}",
25-
&option_env!("RUST_RELEASE_NUM").map_or_else(
26-
|| "master".to_string(),
27-
|n| {
28-
// extract just major + minor version and ignore patch versions
29-
format!("rust-{}", n.rsplit_once('.').unwrap().1)
30-
}
31-
)
25+
match option_env!("CFG_RELEASE_CHANNEL") {
26+
// Clippy version is 0.1.xx
27+
//
28+
// Always use .0 because we do not generate separate lint doc pages for rust patch releases
29+
Some("stable") => concat!("rust-1.", env!("CARGO_PKG_VERSION_PATCH"), ".0"),
30+
Some("beta") => "beta",
31+
_ => "master",
32+
}
3233
));
3334
}
3435
}

0 commit comments

Comments
 (0)