Skip to content

Commit 5272ace

Browse files
committed
Merge pull request #32
2 parents 9d642cf + 2fc2db2 commit 5272ace

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/lib.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ use clap::{crate_authors, crate_description, crate_name, crate_version, value_t,
2727
use indicatif::{ProgressBar, ProgressStyle};
2828
use rayon::prelude::*;
2929
use state_map::StateMap;
30-
use std::{collections::BTreeMap, fs::File, io::Write, str::FromStr};
30+
use std::{collections::BTreeMap, convert::TryInto, fs::File, io::Write, str::FromStr};
3131
use string_cache::DefaultAtom as Atom;
3232

3333
mod compressor;
@@ -162,7 +162,7 @@ impl Config {
162162
Arg::with_name("groups_to_compress")
163163
.short("n")
164164
.value_name("GROUPS_TO_COMPRESS")
165-
.help("How many groups to load into memory to compress")
165+
.help("How many groups to load into memory to compress")
166166
.long_help(concat!(
167167
"How many groups to load into memory to compress (starting from",
168168
" the 1st group in the room or the group specified by -s)"))
@@ -362,8 +362,8 @@ pub fn run(mut config: Config) {
362362
}
363363

364364
if let Some(min) = config.min_saved_rows {
365-
let saving = (original_summed_size - compressed_summed_size) as i32;
366-
if saving < min {
365+
let saving = original_summed_size.saturating_sub(compressed_summed_size);
366+
if saving < min.try_into().unwrap_or(0) {
367367
warn!(
368368
"Only {} rows would be saved by this compression. Skipping output.",
369369
saving

0 commit comments

Comments
 (0)