@@ -447,7 +447,7 @@ fn normalize_toml(
447
447
edition,
448
448
& features,
449
449
original_toml. dependencies . as_ref ( ) ,
450
- None ,
450
+ DepKind :: Normal ,
451
451
& inherit,
452
452
& workspace_root,
453
453
package_root,
@@ -467,7 +467,7 @@ fn normalize_toml(
467
467
edition,
468
468
& features,
469
469
original_toml. dev_dependencies ( ) ,
470
- Some ( DepKind :: Development ) ,
470
+ DepKind :: Development ,
471
471
& inherit,
472
472
& workspace_root,
473
473
package_root,
@@ -487,7 +487,7 @@ fn normalize_toml(
487
487
edition,
488
488
& features,
489
489
original_toml. build_dependencies ( ) ,
490
- Some ( DepKind :: Build ) ,
490
+ DepKind :: Build ,
491
491
& inherit,
492
492
& workspace_root,
493
493
package_root,
@@ -500,7 +500,7 @@ fn normalize_toml(
500
500
edition,
501
501
& features,
502
502
platform. dependencies . as_ref ( ) ,
503
- None ,
503
+ DepKind :: Normal ,
504
504
& inherit,
505
505
& workspace_root,
506
506
package_root,
@@ -520,7 +520,7 @@ fn normalize_toml(
520
520
edition,
521
521
& features,
522
522
platform. dev_dependencies ( ) ,
523
- Some ( DepKind :: Development ) ,
523
+ DepKind :: Development ,
524
524
& inherit,
525
525
& workspace_root,
526
526
package_root,
@@ -540,7 +540,7 @@ fn normalize_toml(
540
540
edition,
541
541
& features,
542
542
platform. build_dependencies ( ) ,
543
- Some ( DepKind :: Build ) ,
543
+ DepKind :: Build ,
544
544
& inherit,
545
545
& workspace_root,
546
546
package_root,
@@ -873,7 +873,7 @@ fn normalize_dependencies<'a>(
873
873
edition : Edition ,
874
874
features : & Features ,
875
875
orig_deps : Option < & BTreeMap < manifest:: PackageName , manifest:: InheritableDependency > > ,
876
- kind : Option < DepKind > ,
876
+ kind : DepKind ,
877
877
inherit : & dyn Fn ( ) -> CargoResult < & ' a InheritableFields > ,
878
878
workspace_root : & dyn Fn ( ) -> CargoResult < & ' a Path > ,
879
879
package_root : & Path ,
@@ -906,27 +906,27 @@ fn normalize_dependencies<'a>(
906
906
if d. public . is_some ( ) {
907
907
let with_public_feature = features. require ( Feature :: public_dependency ( ) ) . is_ok ( ) ;
908
908
let with_z_public = gctx. cli_unstable ( ) . public_dependency ;
909
- if matches ! ( kind, None ) {
910
- if !with_public_feature && !with_z_public {
911
- d. public = None ;
912
- warnings. push ( format ! (
913
- "ignoring `public` on dependency {name_in_toml}, pass `-Zpublic-dependency` to enable support for it"
914
- ) )
909
+ match kind {
910
+ DepKind :: Normal => {
911
+ if !with_public_feature && !with_z_public {
912
+ d. public = None ;
913
+ warnings. push ( format ! (
914
+ "ignoring `public` on dependency {name_in_toml}, pass `-Zpublic-dependency` to enable support for it"
915
+ ) ) ;
916
+ }
915
917
}
916
- } else {
917
- let kind_name = match kind {
918
- Some ( k) => k. kind_table ( ) ,
919
- None => "dependencies" ,
920
- } ;
921
- let hint = format ! (
922
- "'public' specifier can only be used on regular dependencies, not {kind_name}" ,
923
- ) ;
924
- if with_public_feature || with_z_public {
925
- bail ! ( hint)
926
- } else {
927
- // If public feature isn't enabled in nightly, we instead warn that.
928
- warnings. push ( hint) ;
929
- d. public = None ;
918
+ DepKind :: Development | DepKind :: Build => {
919
+ let kind_name = kind. kind_table ( ) ;
920
+ let hint = format ! (
921
+ "'public' specifier can only be used on regular dependencies, not {kind_name}" ,
922
+ ) ;
923
+ if with_public_feature || with_z_public {
924
+ bail ! ( hint)
925
+ } else {
926
+ // If public feature isn't enabled in nightly, we instead warn that.
927
+ warnings. push ( hint) ;
928
+ d. public = None ;
929
+ }
930
930
}
931
931
}
932
932
}
0 commit comments