@@ -6,6 +6,7 @@ mod wildcard_dependencies;
6
6
use cargo_metadata:: MetadataCommand ;
7
7
use clippy_utils:: diagnostics:: span_lint;
8
8
use clippy_utils:: is_lint_allowed;
9
+ use rustc_data_structures:: fx:: FxHashSet ;
9
10
use rustc_hir:: hir_id:: CRATE_HIR_ID ;
10
11
use rustc_lint:: { LateContext , LateLintPass , Lint } ;
11
12
use rustc_session:: impl_lint_pass;
@@ -128,6 +129,8 @@ declare_clippy_lint! {
128
129
/// ### Known problems
129
130
/// Because this can be caused purely by the dependencies
130
131
/// 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.
131
134
///
132
135
/// ### Example
133
136
/// ```toml
@@ -163,6 +166,7 @@ declare_clippy_lint! {
163
166
}
164
167
165
168
pub struct Cargo {
169
+ pub allowed_duplicate_crates : FxHashSet < String > ,
166
170
pub ignore_publish : bool ,
167
171
}
168
172
@@ -208,7 +212,7 @@ impl LateLintPass<'_> for Cargo {
208
212
{
209
213
match MetadataCommand :: new ( ) . exec ( ) {
210
214
Ok ( metadata) => {
211
- multiple_crate_versions:: check ( cx, & metadata) ;
215
+ multiple_crate_versions:: check ( cx, & metadata, & self . allowed_duplicate_crates ) ;
212
216
} ,
213
217
Err ( e) => {
214
218
for lint in WITH_DEPS_LINTS {
0 commit comments