Skip to content

Commit

Permalink
excel: minor tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
jqnatividad committed Oct 26, 2024
1 parent 78d65e5 commit 97bac8d
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions src/cmd/excel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ fn get_requested_range(

let sheet_name = split_range[0].to_lowercase();
sheet.clone_from(&sheet_name);
let range_str = split_range[1].to_string();
let range_string = split_range[1].to_string();

// Find the sheet index
let sheet_index = sheet_names
Expand All @@ -385,7 +385,7 @@ fn get_requested_range(
);
};

Ok(range_str)
Ok(range_string)
}

pub fn run(argv: &[&str]) -> CliResult<()> {
Expand Down Expand Up @@ -996,8 +996,6 @@ pub fn run(argv: &[&str]) -> CliResult<()> {
};
let mut float_val;
let mut work_date;
let mut ryu_buffer = ryu::Buffer::new();
let mut itoa_buffer = itoa::Buffer::new();
let mut format_buffer = String::new();
let mut formatted_date = String::new();

Expand All @@ -1011,7 +1009,7 @@ pub fn run(argv: &[&str]) -> CliResult<()> {
match *cell {
Data::Empty => record.push_field(""),
Data::String(ref s) => record.push_field(s),
Data::Int(ref i) => record.push_field(itoa_buffer.format(*i)),
Data::Int(ref i) => record.push_field(itoa::Buffer::new().format(*i)),
Data::Float(ref f) => {
float_val = *f;
// push the ryu-formatted float value if its
Expand All @@ -1022,12 +1020,12 @@ pub fn run(argv: &[&str]) -> CliResult<()> {
|| float_val > i64::MAX as f64
|| float_val < i64::MIN as f64
{
record.push_field(ryu_buffer.format_finite(float_val));
record.push_field(ryu::Buffer::new().format_finite(float_val));
} else {
// its an i64 integer. We can't use ryu to format it, because it
// will be formatted as a
// float (have a ".0"). So we use itoa.
record.push_field(itoa_buffer.format(float_val as i64));
record.push_field(itoa::Buffer::new().format(float_val as i64));
}
},
Data::DateTime(ref edt) => {
Expand Down

0 comments on commit 97bac8d

Please sign in to comment.