Skip to content

Commit cb30ab6

Browse files
committed
refactor(toml): Initialize fields before everything else
1 parent aef2f6d commit cb30ab6

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

src/cargo/util/toml/mod.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,15 @@ fn normalize_toml(
275275
warnings: &mut Vec<String>,
276276
errors: &mut Vec<String>,
277277
) -> CargoResult<manifest::TomlManifest> {
278+
let package_root = manifest_file.parent().unwrap();
279+
280+
let inherit_cell: LazyCell<InheritableFields> = LazyCell::new();
281+
let inherit = || {
282+
inherit_cell
283+
.try_borrow_with(|| load_inheritable_fields(gctx, manifest_file, &workspace_config))
284+
};
285+
let workspace_root = || inherit().map(|fields| fields.ws_root().as_path());
286+
278287
let mut normalized_toml = manifest::TomlManifest {
279288
cargo_features: original_toml.cargo_features.clone(),
280289
package: None,
@@ -300,15 +309,6 @@ fn normalize_toml(
300309
_unused_keys: Default::default(),
301310
};
302311

303-
let package_root = manifest_file.parent().unwrap();
304-
305-
let inherit_cell: LazyCell<InheritableFields> = LazyCell::new();
306-
let inherit = || {
307-
inherit_cell
308-
.try_borrow_with(|| load_inheritable_fields(gctx, manifest_file, &workspace_config))
309-
};
310-
let workspace_root = || inherit().map(|fields| fields.ws_root().as_path());
311-
312312
if let Some(original_package) = original_toml.package() {
313313
let package_name = &original_package.name;
314314

0 commit comments

Comments
 (0)