Fix the `lru_cache` for `_cargo_metadata`
@@ -259,8 +259,11 @@ def _cargo_metadata(cwd: pathlib.Path) -> Dict[str, Any]:
return manifest_path
raise RuntimeError(f'Could not find `Cargo.toml` in `{cwd}` or any parent directory')
+ return cargo_metadata_by_manifest_path(find_root_manifest_for_wd())
+
+
@functools.lru_cache(maxsize=None)
- def cargo_metadata(manifest_path: pathlib.Path) -> Dict[str, Any]:
+def cargo_metadata_by_manifest_path(manifest_path: pathlib.Path) -> Dict[str, Any]:
return json.loads(subprocess.run(
['cargo', 'metadata', '--format-version', '1', '--manifest-path', str(manifest_path)],
stdout=PIPE,
@@ -268,8 +271,6 @@ def _cargo_metadata(cwd: pathlib.Path) -> Dict[str, Any]:
check=True,
).stdout.decode())
- return cargo_metadata(find_root_manifest_for_wd())
-
def _find_target(
metadata: Dict[str, Any],
