Move an assertion
@@ -266,10 +266,11 @@ def _cargo_metadata(cwd: pathlib.Path) -> Dict[str, Any]:
:raises ValueError: if `cwd` is not absolute
"""
- def find_root_manifest_for_wd() -> pathlib.Path:
- # https://docs.rs/cargo/0.48.0/cargo/util/important_paths/fn.find_root_manifest_for_wd.html
if not cwd.is_absolute():
raise ValueError(f'the `cwd` parameter must be absolute: {cwd}')
+
+ def find_root_manifest_for_wd() -> pathlib.Path:
+ # https://docs.rs/cargo/0.48.0/cargo/util/important_paths/fn.find_root_manifest_for_wd.html
for directory in [cwd, *cwd.parents]:
manifest_path = directory / 'Cargo.toml'
if manifest_path.exists():
