File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -173,23 +173,6 @@ impl UnusedDepState {
173173 continue ;
174174 }
175175
176- let mut ignore = Vec :: new ( ) ;
177- if let Some ( unused_dependencies) = cargo_lints. get ( "unused_dependencies" ) {
178- if let Some ( config) = unused_dependencies. config ( ) {
179- if let Some ( config_ignore) = config. get ( "ignore" ) {
180- if let Ok ( config_ignore) =
181- toml:: Value :: try_into :: < Vec < InternedString > > ( config_ignore. clone ( ) )
182- {
183- ignore = config_ignore
184- } else {
185- anyhow:: bail!(
186- "`lints.cargo.unused_dependencies.ignore` must be a list of string"
187- ) ;
188- }
189- }
190- }
191- }
192-
193176 let manifest_path = rel_cwd_manifest_path ( pkg. manifest_path ( ) , build_runner. bcx . gctx ) ;
194177 let mut lint_count = 0 ;
195178 for ( dep_kind, state) in states. iter ( ) {
@@ -249,15 +232,6 @@ impl UnusedDepState {
249232 continue ;
250233 } ;
251234 for dependency in dependency {
252- if ignore. contains ( & dependency. name_in_toml ( ) ) {
253- debug ! (
254- "pkg {} v{} ({dep_kind:?}): ignoring unused extern `{ext}`, requested in manifest" ,
255- pkg_id. name( ) ,
256- pkg_id. version( ) ,
257- ) ;
258- continue ;
259- }
260-
261235 let manifest = pkg. manifest ( ) ;
262236 let document = manifest. document ( ) ;
263237 let contents = manifest. contents ( ) ;
Original file line number Diff line number Diff line change @@ -71,10 +71,6 @@ Should be written as:
7171[package]
7272name = "foo"
7373```
74-
75- ### Configuration
76-
77- - `ignore`: a list of dependency names to allow the lint on
7874"# ,
7975 ) ,
8076} ;
@@ -115,34 +111,13 @@ pub fn unused_build_dependencies_no_build_rs(
115111 let document = manifest. document ( ) ;
116112 let contents = manifest. contents ( ) ;
117113
118- let mut ignore = Vec :: new ( ) ;
119- if let Some ( unused_dependencies) = cargo_lints. get ( "unused_dependencies" ) {
120- if let Some ( config) = unused_dependencies. config ( ) {
121- if let Some ( config_ignore) = config. get ( "ignore" ) {
122- if let Ok ( config_ignore) =
123- toml:: Value :: try_into :: < Vec < String > > ( config_ignore. clone ( ) )
124- {
125- ignore = config_ignore
126- } else {
127- anyhow:: bail!(
128- "`lints.cargo.unused_dependencies.ignore` must be a list of string"
129- ) ;
130- }
131- }
132- }
133- }
134-
135114 for ( i, dep_name) in manifest
136115 . normalized_toml ( )
137116 . build_dependencies ( )
138117 . iter ( )
139118 . flat_map ( |m| m. keys ( ) )
140119 . enumerate ( )
141120 {
142- if ignore. contains ( & dep_name) {
143- continue ;
144- }
145-
146121 let level = lint_level. to_diagnostic_level ( ) ;
147122 let emitted_source = LINT . emitted_source ( lint_level, reason) ;
148123
Original file line number Diff line number Diff line change @@ -2734,7 +2734,6 @@ supported tools: {}",
27342734}
27352735
27362736static EXPECTED_LINT_CONFIG : & [ ( & str , & str , & str ) ] = & [
2737- ( "cargo" , "unused_dependencies" , "ignore" ) ,
27382737 // forwarded to rustc/rustdoc
27392738 ( "rust" , "unexpected_cfgs" , "check-cfg" ) ,
27402739] ;
Original file line number Diff line number Diff line change @@ -470,10 +470,6 @@ Should be written as:
470470name = " foo"
471471```
472472
473- ### Configuration
474-
475- - ` ignore ` : a list of dependency names to allow the lint on
476-
477473
478474## ` unused_workspace_dependencies `
479475Group: ` suspicious `
Original file line number Diff line number Diff line change @@ -1328,58 +1328,6 @@ pub fn fun() -> &'static str {
13281328 . run ( ) ;
13291329}
13301330
1331- #[ cargo_test]
1332- fn config_ignore ( ) {
1333- // The most basic case where there is an unused dependency
1334- Package :: new ( "unused_build" , "0.1.0" ) . publish ( ) ;
1335- Package :: new ( "unused" , "0.1.0" ) . publish ( ) ;
1336- let p = project ( )
1337- . file (
1338- "Cargo.toml" ,
1339- r#"
1340- [package]
1341- name = "foo"
1342- version = "0.1.0"
1343- authors = []
1344- edition = "2018"
1345-
1346- [build-dependencies]
1347- unused_build = "0.1.0"
1348-
1349- [dependencies]
1350- unused_renamed = { package = "unused", version = "0.1.0" }
1351-
1352- [lints.cargo]
1353- unused_dependencies = { level = "warn", ignore = ["unused_build", "unused_renamed"] }
1354- "# ,
1355- )
1356- . file (
1357- "src/main.rs" ,
1358- r#"
1359- fn main() {}
1360- "# ,
1361- )
1362- . build ( ) ;
1363-
1364- p. cargo ( "check -Zcargo-lints" )
1365- . masquerade_as_nightly_cargo ( & [ "cargo-lints" ] )
1366- . with_stderr_data (
1367- str![ [ r#"
1368- [UPDATING] `dummy-registry` index
1369- [LOCKING] 2 packages to latest compatible versions
1370- [DOWNLOADING] crates ...
1371- [DOWNLOADED] unused_build v0.1.0 (registry `dummy-registry`)
1372- [DOWNLOADED] unused v0.1.0 (registry `dummy-registry`)
1373- [CHECKING] unused v0.1.0
1374- [CHECKING] foo v0.1.0 ([ROOT]/foo)
1375- [FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
1376-
1377- "# ] ]
1378- . unordered ( ) ,
1379- )
1380- . run ( ) ;
1381- }
1382-
13831331#[ cargo_test]
13841332fn allow_rustflags ( ) {
13851333 // The most basic case where there is an unused dependency
You can’t perform that action at this time.
0 commit comments