Skip to content

Commit 2f6881c

Browse files
authored
Merge pull request rust-lang#3442 from rust-lang/version_ids
Enable rustup clippy to refer to the correct documentation
2 parents 42da194 + 87ec058 commit 2f6881c

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

clippy_lints/src/utils/mod.rs

+5-2
Original file line numberDiff line numberDiff line change
@@ -539,8 +539,11 @@ impl<'a> DiagnosticWrapper<'a> {
539539
fn docs_link(&mut self, lint: &'static Lint) {
540540
if env::var("CLIPPY_DISABLE_DOCS_LINKS").is_err() {
541541
self.0.help(&format!(
542-
"for further information visit https://rust-lang.github.io/rust-clippy/v{}/index.html#{}",
543-
env!("CARGO_PKG_VERSION"),
542+
"for further information visit https://rust-lang.github.io/rust-clippy/{}/index.html#{}",
543+
&option_env!("RUST_RELEASE_NUM").map_or("master".to_string(), |n| {
544+
// extract just major + minor version and ignore patch versions
545+
format!("rust-{}", n.rsplitn(2, '.').nth(1).unwrap())
546+
}),
544547
lint.name_lower().replacen("clippy::", "", 1)
545548
));
546549
}

0 commit comments

Comments
 (0)