diff --git a/src/cargo/util/toml/mod.rs b/src/cargo/util/toml/mod.rs index a086319d181..6f74ff6e8b2 100644 --- a/src/cargo/util/toml/mod.rs +++ b/src/cargo/util/toml/mod.rs @@ -786,12 +786,8 @@ fn normalize_dependencies<'a>( warnings, )?; if d.public.is_some() { - let public_feature = features.require(Feature::public_dependency()); - let with_public_feature = public_feature.is_ok(); + let with_public_feature = features.require(Feature::public_dependency()).is_ok(); let with_z_public = gctx.cli_unstable().public_dependency; - if !with_public_feature && (!with_z_public && !gctx.nightly_features_allowed) { - public_feature?; - } if matches!(kind, None) { if !with_public_feature && !with_z_public { d.public = None; diff --git a/tests/testsuite/pub_priv.rs b/tests/testsuite/pub_priv.rs index 4cf2a574031..6d81faced09 100644 --- a/tests/testsuite/pub_priv.rs +++ b/tests/testsuite/pub_priv.rs @@ -226,7 +226,6 @@ fn pub_dev_dependency_without_feature() { .build(); p.cargo("check --message-format=short") - .masquerade_as_nightly_cargo(&["public-dependency"]) .with_stderr_data(str![[r#" [WARNING] 'public' specifier can only be used on regular dependencies, not dev-dependencies [UPDATING] `dummy-registry` index