Merge pull request #3488 from phansch/fix_cargo_lint_bug
Fix wildcard_dependencies false positive
This commit is contained in:
commit
8b2eb06df3
@ -13,6 +13,7 @@ use crate::syntax::{ast::*, source_map::DUMMY_SP};
|
||||
use crate::utils::span_lint;
|
||||
|
||||
use cargo_metadata;
|
||||
use if_chain::if_chain;
|
||||
use semver;
|
||||
|
||||
/// **What it does:** Checks for wildcard dependencies in the `Cargo.toml`.
|
||||
@ -54,8 +55,12 @@ impl EarlyLintPass for Pass {
|
||||
|
||||
for dep in &metadata.packages[0].dependencies {
|
||||
// VersionReq::any() does not work
|
||||
if let Ok(wildcard_ver) = semver::VersionReq::parse("*") {
|
||||
if dep.req == wildcard_ver {
|
||||
if_chain! {
|
||||
if let Ok(wildcard_ver) = semver::VersionReq::parse("*");
|
||||
if let Some(ref source) = dep.source;
|
||||
if !source.starts_with("git");
|
||||
if dep.req == wildcard_ver;
|
||||
then {
|
||||
span_lint(
|
||||
cx,
|
||||
WILDCARD_DEPENDENCIES,
|
||||
|
Loading…
Reference in New Issue
Block a user