Skip to content

Commit

Permalink
replace match with if in n2s closure
Browse files Browse the repository at this point in the history
  • Loading branch information
D3V1LC0D3R authored and D3V1LC0D3R committed May 8, 2024
1 parent 26e29a8 commit 20f2f18
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/uu/free/src/free.rs
Original file line number Diff line number Diff line change
Expand Up @@ -188,9 +188,12 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
let used = mem_info.total - mem_info.available;

// function that converts the number to the correct string
let n2s = |x| match human {
true => humanized(x, si),
false => convert(x).to_string(),
let n2s = |x| {
if human {
humanized(x, si)
} else {
convert(x).to_string()
}
};
if one_line {
println!(
Expand Down

0 comments on commit 20f2f18

Please sign in to comment.