Skip to content

Commit

Permalink
utils: minor tweaks
Browse files Browse the repository at this point in the history
- in count_rows() helper, let compiler know we don't care about the contents of the record
- inline round_num() helper
  • Loading branch information
jqnatividad committed Jan 7, 2024
1 parent aa90ae4 commit 5d4bc9c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -301,8 +301,8 @@ pub fn count_rows(conf: &Config) -> Result<u64, CliError> {
let rc = ROW_COUNT.get_or_init(|| {
if let Ok(mut rdr) = conf.reader() {
let mut count = 0_u64;
let mut record = csv::ByteRecord::new();
while rdr.read_byte_record(&mut record).unwrap_or_default() {
let mut _record = csv::ByteRecord::new();
while rdr.read_byte_record(&mut _record).unwrap_or_default() {
count += 1;
}
count
Expand Down Expand Up @@ -1180,6 +1180,7 @@ impl ColumnNameParser {
}
}

#[inline]
pub fn round_num(dec_f64: f64, places: u32) -> String {
use rust_decimal::{Decimal, RoundingStrategy};

Expand Down

0 comments on commit 5d4bc9c

Please sign in to comment.