Skip to content

Commit 5e30a01

Browse files
committed
Filter packages only when '-p' was passed
1 parent 98eb7da commit 5e30a01

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/bin/cargo-fmt.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -261,12 +261,12 @@ fn filter_packages_with_hitlist<'a>(
261261
packages: Vec<Value>,
262262
workspace_hitlist: &'a WorkspaceHitlist,
263263
) -> Result<Vec<Value>, &'a String> {
264-
if *workspace_hitlist == WorkspaceHitlist::All {
264+
let some_hitlist: Option<HashSet<&String>> =
265+
workspace_hitlist.get_some().map(HashSet::from_iter);
266+
if some_hitlist.is_none() {
265267
return Ok(packages);
266268
}
267-
let mut hitlist: HashSet<&String> = workspace_hitlist
268-
.get_some()
269-
.map_or(HashSet::new(), HashSet::from_iter);
269+
let mut hitlist = some_hitlist.unwrap();
270270
let members: Vec<Value> = packages
271271
.into_iter()
272272
.filter(|member| {

0 commit comments

Comments
 (0)