Skip to content

Commit 7f2c706

Browse files
committed
refactor(toml): Move the ws default features function out
1 parent 738cdec commit 7f2c706

File tree

1 file changed

+17
-16
lines changed

1 file changed

+17
-16
lines changed

src/cargo/util/toml/mod.rs

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -970,22 +970,6 @@ fn inner_dependency_inherit_with<'a>(
970970
package_root: &Path,
971971
warnings: &mut Vec<String>,
972972
) -> CargoResult<manifest::TomlDependency> {
973-
fn deprecated_ws_default_features(
974-
label: &str,
975-
ws_def_feat: Option<bool>,
976-
warnings: &mut Vec<String>,
977-
) {
978-
let ws_def_feat = match ws_def_feat {
979-
Some(true) => "true",
980-
Some(false) => "false",
981-
None => "not specified",
982-
};
983-
warnings.push(format!(
984-
"`default-features` is ignored for {label}, since `default-features` was \
985-
{ws_def_feat} for `workspace.dependencies.{label}`, \
986-
this could become a hard error in the future"
987-
))
988-
}
989973
inherit()?.get_dependency(name, package_root).map(|ws_dep| {
990974
let mut merged_dep = match ws_dep {
991975
manifest::TomlDependency::Simple(ws_version) => manifest::TomlDetailedDependency {
@@ -1044,6 +1028,23 @@ fn inner_dependency_inherit_with<'a>(
10441028
})
10451029
}
10461030

1031+
fn deprecated_ws_default_features(
1032+
label: &str,
1033+
ws_def_feat: Option<bool>,
1034+
warnings: &mut Vec<String>,
1035+
) {
1036+
let ws_def_feat = match ws_def_feat {
1037+
Some(true) => "true",
1038+
Some(false) => "false",
1039+
None => "not specified",
1040+
};
1041+
warnings.push(format!(
1042+
"`default-features` is ignored for {label}, since `default-features` was \
1043+
{ws_def_feat} for `workspace.dependencies.{label}`, \
1044+
this could become a hard error in the future"
1045+
))
1046+
}
1047+
10471048
#[tracing::instrument(skip_all)]
10481049
fn to_real_manifest(
10491050
contents: String,

0 commit comments

Comments
 (0)