Merge pull request #3442 from rust-lang/version_ids

Enable rustup clippy to refer to the correct documentation
This commit is contained in:
Oliver S̶c̶h̶n̶e̶i̶d̶e̶r Scherer 2018-11-22 10:46:08 +01:00 committed by GitHub
commit 2f6881c623
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

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