@@ -6,6 +6,7 @@ mod wildcard_dependencies;
66use cargo_metadata:: MetadataCommand ;
77use clippy_utils:: diagnostics:: span_lint;
88use clippy_utils:: is_lint_allowed;
9+ use rustc_data_structures:: fx:: FxHashSet ;
910use rustc_hir:: hir_id:: CRATE_HIR_ID ;
1011use rustc_lint:: { LateContext , LateLintPass , Lint } ;
1112use rustc_session:: impl_lint_pass;
@@ -128,6 +129,8 @@ declare_clippy_lint! {
128129 /// ### Known problems
129130 /// Because this can be caused purely by the dependencies
130131 /// themselves, it's not always possible to fix this issue.
132+ /// In those cases, you can allow that specific crate using
133+ /// the `allowed_duplicate_crates` configuration option.
131134 ///
132135 /// ### Example
133136 /// ```toml
@@ -163,6 +166,7 @@ declare_clippy_lint! {
163166}
164167
165168pub struct Cargo {
169+ pub allowed_duplicate_crates : FxHashSet < String > ,
166170 pub ignore_publish : bool ,
167171}
168172
@@ -208,7 +212,7 @@ impl LateLintPass<'_> for Cargo {
208212 {
209213 match MetadataCommand :: new ( ) . exec ( ) {
210214 Ok ( metadata) => {
211- multiple_crate_versions:: check ( cx, & metadata) ;
215+ multiple_crate_versions:: check ( cx, & metadata, & self . allowed_duplicate_crates ) ;
212216 } ,
213217 Err ( e) => {
214218 for lint in WITH_DEPS_LINTS {
0 commit comments