Skip to content

Commit 98eb7da

Browse files
committed
Format dependency crates only when '--all' was passed
1 parent ee490ae commit 98eb7da

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

src/bin/cargo-fmt.rs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -329,13 +329,15 @@ fn get_targets(workspace_hitlist: &WorkspaceHitlist) -> Result<Vec<Target>, io::
329329
let packages = get_packages(&output.stdout)?;
330330

331331
// If we can find any local dependencies, we will try to get targets from those as well.
332-
for path in get_path_to_local_dependencies(&packages) {
333-
match env::set_current_dir(path) {
334-
Ok(..) => match get_targets(workspace_hitlist) {
335-
Ok(ref mut t) => targets.append(t),
332+
if *workspace_hitlist == WorkspaceHitlist::All {
333+
for path in get_path_to_local_dependencies(&packages) {
334+
match env::set_current_dir(path) {
335+
Ok(..) => match get_targets(workspace_hitlist) {
336+
Ok(ref mut t) => targets.append(t),
337+
Err(..) => continue,
338+
},
336339
Err(..) => continue,
337-
},
338-
Err(..) => continue,
340+
}
339341
}
340342
}
341343

0 commit comments

Comments
 (0)