Skip to content

Commit 0dd177d

Browse files
committed
Lint to stable/beta lint docs page in diagnostics
1 parent a5a033d commit 0dd177d

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

clippy_utils/src/diagnostics.rs

+8-4
Original file line numberDiff line numberDiff line change
@@ -22,10 +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("master".to_string(), |n| {
26-
// extract just major + minor version and ignore patch versions
27-
format!("rust-{}", n.rsplit_once('.').unwrap().1)
28-
})
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+
}
2933
));
3034
}
3135
}

0 commit comments

Comments
 (0)