-use clippy_utils::diagnostics::span_lint;
-use clippy_utils::run_lints;
+use clippy_utils::{diagnostics::span_lint, is_lint_allowed};
use rustc_hir::{hir_id::CRATE_HIR_ID, Crate};
use rustc_lint::{LateContext, LateLintPass};
use rustc_session::{declare_lint_pass, declare_tool_lint};
use if_chain::if_chain;
declare_clippy_lint! {
- /// **What it does:** Checks for wildcard dependencies in the `Cargo.toml`.
+ /// ### What it does
+ /// Checks for wildcard dependencies in the `Cargo.toml`.
///
- /// **Why is this bad?** [As the edition guide says](https://rust-lang-nursery.github.io/edition-guide/rust-2018/cargo-and-crates-io/crates-io-disallows-wildcard-dependencies.html),
+ /// ### Why is this bad?
+ /// [As the edition guide says](https://rust-lang-nursery.github.io/edition-guide/rust-2018/cargo-and-crates-io/crates-io-disallows-wildcard-dependencies.html),
/// it is highly unlikely that you work with any possible version of your dependency,
/// and wildcard dependencies would cause unnecessary breakage in the ecosystem.
///
- /// **Known problems:** None.
- ///
- /// **Example:**
- ///
+ /// ### Example
/// ```toml
/// [dependencies]
/// regex = "*"
impl LateLintPass<'_> for WildcardDependencies {
fn check_crate(&mut self, cx: &LateContext<'_>, _: &Crate<'_>) {
- if !run_lints(cx, &[WILDCARD_DEPENDENCIES], CRATE_HIR_ID) {
+ if is_lint_allowed(cx, WILDCARD_DEPENDENCIES, CRATE_HIR_ID) {
return;
}