From 5e30a0183f5a1f1e244142940a6d65d0a3f7d76a Mon Sep 17 00:00:00 2001 From: topecongiro Date: Sun, 29 Oct 2017 00:13:37 +0900 Subject: [PATCH] Filter packages only when '-p' was passed --- src/bin/cargo-fmt.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/bin/cargo-fmt.rs b/src/bin/cargo-fmt.rs index 3caf5522948..2c0b964b001 100644 --- a/src/bin/cargo-fmt.rs +++ b/src/bin/cargo-fmt.rs @@ -261,12 +261,12 @@ fn filter_packages_with_hitlist<'a>( packages: Vec, workspace_hitlist: &'a WorkspaceHitlist, ) -> Result, &'a String> { - if *workspace_hitlist == WorkspaceHitlist::All { + let some_hitlist: Option> = + workspace_hitlist.get_some().map(HashSet::from_iter); + if some_hitlist.is_none() { return Ok(packages); } - let mut hitlist: HashSet<&String> = workspace_hitlist - .get_some() - .map_or(HashSet::new(), HashSet::from_iter); + let mut hitlist = some_hitlist.unwrap(); let members: Vec = packages .into_iter() .filter(|member| { -- 2.44.0