Skip to content

Commit f7c5742

Browse files
committed
Do not show docs link when lint doesn't start with "clippy::"
1 parent 52c25e9 commit f7c5742

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

clippy_utils/src/diagnostics.rs

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,16 @@ use std::env;
88

99
fn docs_link(diag: &mut DiagnosticBuilder<'_>, lint: &'static Lint) {
1010
if env::var("CLIPPY_DISABLE_DOCS_LINKS").is_err() {
11-
diag.help(&format!(
12-
"for further information visit https://rust-lang.github.io/rust-clippy/{}/index.html#{}",
13-
&option_env!("RUST_RELEASE_NUM").map_or("master".to_string(), |n| {
14-
// extract just major + minor version and ignore patch versions
15-
format!("rust-{}", n.rsplitn(2, '.').nth(1).unwrap())
16-
}),
17-
lint.name_lower().replacen("clippy::", "", 1)
18-
));
11+
if let Some(lint) = lint.name_lower().strip_prefix("clippy::") {
12+
diag.help(&format!(
13+
"for further information visit https://rust-lang.github.io/rust-clippy/{}/index.html#{}",
14+
&option_env!("RUST_RELEASE_NUM").map_or("master".to_string(), |n| {
15+
// extract just major + minor version and ignore patch versions
16+
format!("rust-{}", n.rsplitn(2, '.').nth(1).unwrap())
17+
}),
18+
lint
19+
));
20+
}
1921
}
2022
}
2123

0 commit comments

Comments
 (0)