Skip to content

Commit

Permalink
refactor(rh): use cleaner iterator for counting version flags
Browse files Browse the repository at this point in the history
  • Loading branch information
ericswpark committed Sep 18, 2024
1 parent 69e30cc commit 668d854
Showing 1 changed file with 1 addition and 11 deletions.
12 changes: 1 addition & 11 deletions release-helper/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,17 +86,7 @@ pub fn today_iso8601() -> String {
}

pub fn enabled_version_flag_count(major: bool, minor: bool, patch: bool) -> i32 {
let mut count = 0;
if major {
count += 1;
}
if minor {
count += 1;
}
if patch {
count += 1;
}
count
[major, minor, patch].into_iter().filter(|b| *b).count() as i32
}

pub fn get_version_level(major: bool, minor: bool, patch: bool) -> Result<VersionLevel, Error> {
Expand Down

0 comments on commit 668d854

Please sign in to comment.