File tree Expand file tree Collapse file tree 1 file changed +3
-4
lines changed Expand file tree Collapse file tree 1 file changed +3
-4
lines changed Original file line number Diff line number Diff line change @@ -1703,17 +1703,16 @@ fn find_workspace_root_with_loader(
17031703) -> CargoResult < Option < PathBuf > > {
17041704 // Check if there are any workspace roots that have already been found that would work
17051705 {
1706- let mut parent = manifest_path. parent ( ) ;
17071706 let roots = config. ws_roots . borrow ( ) ;
1708- while let Some ( current) = parent {
1707+ // Iterate through the manifests parent directories until we find a workspace
1708+ // root. Note we skip the first item since that is just the path itself
1709+ for current in manifest_path. ancestors ( ) . skip ( 1 ) {
17091710 if let Some ( ws_config) = roots. get ( current) {
17101711 if !ws_config. is_excluded ( manifest_path) {
17111712 // Add `Cargo.toml` since ws_root is the root and not the file
17121713 return Ok ( Some ( current. join ( "Cargo.toml" ) ) ) ;
17131714 }
17141715 }
1715-
1716- parent = current. parent ( ) ;
17171716 }
17181717 }
17191718
You can’t perform that action at this time.
0 commit comments