File tree Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -1702,10 +1702,18 @@ fn find_workspace_root_with_loader(
1702
1702
mut loader : impl FnMut ( & Path ) -> CargoResult < Option < PathBuf > > ,
1703
1703
) -> CargoResult < Option < PathBuf > > {
1704
1704
// Check if there are any workspace roots that have already been found that would work
1705
- for ( ws_root, ws_root_config) in config. ws_roots . borrow ( ) . iter ( ) {
1706
- if manifest_path. starts_with ( ws_root) && !ws_root_config. is_excluded ( manifest_path) {
1707
- // Add `Cargo.toml` since ws_root is the root and not the file
1708
- return Ok ( Some ( ws_root. join ( "Cargo.toml" ) . clone ( ) ) ) ;
1705
+ {
1706
+ let mut parent = manifest_path. parent ( ) ;
1707
+ let roots = config. ws_roots . borrow ( ) ;
1708
+ while let Some ( current) = parent {
1709
+ if let Some ( ws_config) = roots. get ( current) {
1710
+ if !ws_config. is_excluded ( manifest_path) {
1711
+ // Add `Cargo.toml` since ws_root is the root and not the file
1712
+ return Ok ( Some ( current. join ( "Cargo.toml" ) ) ) ;
1713
+ }
1714
+ }
1715
+
1716
+ parent = current. parent ( ) ;
1709
1717
}
1710
1718
}
1711
1719
You can’t perform that action at this time.
0 commit comments