Skip to content

Commit 2e26fdc

Browse files
committed
Enable rustup clippy to refer to the correct documentation
1 parent 246a77e commit 2e26fdc

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

clippy_lints/src/utils/mod.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -507,8 +507,11 @@ impl<'a> DiagnosticWrapper<'a> {
507507
fn docs_link(&mut self, lint: &'static Lint) {
508508
if env::var("CLIPPY_DISABLE_DOCS_LINKS").is_err() {
509509
self.0.help(&format!(
510-
"for further information visit https://rust-lang-nursery.github.io/rust-clippy/v{}/index.html#{}",
511-
env!("CARGO_PKG_VERSION"),
510+
"for further information visit https://rust-lang-nursery.github.io/rust-clippy/{}/index.html#{}",
511+
&option_env!("RUST_RELEASE_NUM").map_or("master".to_string(), |n| {
512+
// extract just major + minor version and ignore patch versions
513+
format!("rust-{}", n.rsplitn(2, '.').nth(1).unwrap())
514+
}),
512515
lint.name_lower().replacen("clippy::", "", 1)
513516
));
514517
}

0 commit comments

Comments
 (0)