Skip to content

Commit

Permalink
Remove unneeded mut var for progress bar
Browse files Browse the repository at this point in the history
  • Loading branch information
jqnatividad committed Dec 17, 2021
1 parent 37788fe commit 6847924
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 12 deletions.
5 changes: 2 additions & 3 deletions src/cmd/apply.rs
Original file line number Diff line number Diff line change
Expand Up @@ -394,10 +394,9 @@ pub fn run(argv: &[&str]) -> CliResult<()> {
};

// prep progress bar
let mut record_count = 0_u64;
let progress = ProgressBar::new(0);
if !args.flag_quiet {
record_count = util::count_rows(&rconfig);
let record_count = util::count_rows(&rconfig);
util::prep_progress(&progress, record_count);
} else {
progress.set_draw_target(ProgressDrawTarget::hidden());
Expand Down Expand Up @@ -466,7 +465,7 @@ pub fn run(argv: &[&str]) -> CliResult<()> {
let hit_ratio = (hits as f64 / (hits + misses) as f64) * 100.0;
progress.set_message(format!(
" of {} records. Geocode cache hit ratio: {:.2}% - {} entries",
record_count.separate_with_commas(),
progress.length().separate_with_commas(),
hit_ratio,
cache_size.separate_with_commas(),
));
Expand Down
5 changes: 2 additions & 3 deletions src/cmd/fetch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,10 +131,9 @@ pub fn run(argv: &[&str]) -> CliResult<()> {
}

// prep progress bar
let mut record_count = 0_u64;
let progress = ProgressBar::new(0);
if !args.flag_quiet {
record_count = util::count_rows(&rconfig);
let record_count = util::count_rows(&rconfig);
util::prep_progress(&progress, record_count);
} else {
progress.set_draw_target(ProgressDrawTarget::hidden());
Expand Down Expand Up @@ -176,7 +175,7 @@ pub fn run(argv: &[&str]) -> CliResult<()> {
let hit_ratio = (hits as f64 / (hits + misses) as f64) * 100.0;
progress.set_message(format!(
" of {} records. Cache hit ratio: {:.2}% - {} entries",
record_count.separate_with_commas(),
progress.length().separate_with_commas(),
hit_ratio,
cache_size.separate_with_commas(),
));
Expand Down
5 changes: 2 additions & 3 deletions src/cmd/foreach.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,9 @@ pub fn run(argv: &[&str]) -> CliResult<()> {
let mut output_headers_written = false;

// prep progress bar
let mut record_count: u64 = 0;
let progress = ProgressBar::new(record_count);
let progress = ProgressBar::new(0);
if !args.flag_quiet {
record_count = util::count_rows(&rconfig);
let record_count = util::count_rows(&rconfig);
util::prep_progress(&progress, record_count);
} else {
progress.set_draw_target(ProgressDrawTarget::hidden());
Expand Down
5 changes: 2 additions & 3 deletions src/cmd/lua.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,10 +148,9 @@ pub fn run(argv: &[&str]) -> CliResult<()> {

lua_program.push_str(&lua_script);

let mut record_count: u64 = 0;
let progress = ProgressBar::new(record_count);
let progress = ProgressBar::new(0);
if !args.flag_quiet {
record_count = util::count_rows(&rconfig);
let record_count = util::count_rows(&rconfig);
util::prep_progress(&progress, record_count);
} else {
progress.set_draw_target(ProgressDrawTarget::hidden());
Expand Down

0 comments on commit 6847924

Please sign in to comment.