1
0
Fork 0

Clarify ancestor usage in workspace detection

This commit is contained in:
Robbert van der Helm 2022-11-13 18:36:52 +01:00
parent 08ddd9c42a
commit 15ce644dec

View file

@ -166,6 +166,8 @@ pub fn chdir_workspace_root() -> Result<()> {
let workspace_root = project_dir
.ancestors()
.filter(|dir| dir.join("Cargo.toml").exists())
// The ancestors are ordered starting from `project_dir` going up to the filesystem root. So
// this is the leftmost matching ancestor.
.last()
.with_context(|| {
format!(