diff --git a/Cargo.lock b/Cargo.lock index 56b92d8d4..4865d713e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3962,7 +3962,6 @@ dependencies = [ "dynfmt", "eudex", "ext-sort", - "fast-float", "fastrand 2.0.1", "file-format", "filetime", diff --git a/Cargo.toml b/Cargo.toml index 6ca1566c6..9b60b5aab 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -97,7 +97,6 @@ eudex = { version = "0.1", optional = true } ext-sort = { version = "0.1", features = [ "memory-limit", ], default-features = false } -fast-float = "0.2" fastrand = "2" flate2 = { version = "1", optional = true } file-format = { version = "0.22", features = ["reader"] } diff --git a/src/cmd/apply.rs b/src/cmd/apply.rs index b771dc23a..b78f8323e 100644 --- a/src/cmd/apply.rs +++ b/src/cmd/apply.rs @@ -1106,7 +1106,7 @@ fn apply_operations( *cell = censor.count(cell).to_string(); }, Operations::Thousands => { - if let Ok(num) = fast_float::parse::(&cell) { + if let Ok(num) = cell.parse::() { let mut temp_string = num.separate_by_policy(*THOUSANDS_POLICY.get().unwrap()); // if there is a decimal separator (fractional part > 0.0), use the requested @@ -1131,7 +1131,7 @@ fn apply_operations( } }, Operations::Round => { - if let Ok(num) = fast_float::parse::(&cell) { + if let Ok(num) = cell.parse::() { *cell = util::round_num(num, *ROUND_PLACES.get().unwrap()); } }, @@ -1172,10 +1172,8 @@ fn apply_operations( }; if let Ok(currency_value) = Currency::from_str(&cell_val) { - let currency_wrk = currency_value.convert( - fast_float::parse::(replacement).unwrap_or(1.0_f64), - comparand, - ); + let currency_wrk = currency_value + .convert(replacement.parse::().unwrap_or(1.0_f64), comparand); *cell = if formatstr.contains("euro") { format!("{currency_wrk:e}") } else { diff --git a/src/cmd/applydp.rs b/src/cmd/applydp.rs index 4f87a7ed9..107cba8f1 100644 --- a/src/cmd/applydp.rs +++ b/src/cmd/applydp.rs @@ -725,7 +725,7 @@ fn applydp_operations( *cell = regexreplace.replace_all(cell, replacement).to_string(); }, Operations::Round => { - if let Ok(num) = fast_float::parse(&cell) { + if let Ok(num) = cell.parse::() { *cell = util::round_num(num, *ROUND_PLACES.get().unwrap()); } }, diff --git a/src/cmd/geocode.rs b/src/cmd/geocode.rs index 8facfab7b..fb078aa9c 100644 --- a/src/cmd/geocode.rs +++ b/src/cmd/geocode.rs @@ -1529,8 +1529,8 @@ fn search_index( let loccaps = locregex.captures(cell); if let Some(loccaps) = loccaps { - let lat = fast_float::parse(&loccaps[1]).unwrap_or_default(); - let long = fast_float::parse(&loccaps[2]).unwrap_or_default(); + let lat = loccaps[1].to_string().parse::().unwrap_or_default(); + let long = loccaps[2].to_string().parse::().unwrap_or_default(); if (-90.0..=90.0).contains(&lat) && (-180.0..=180.0).contains(&long) { let search_result = engine.reverse((lat, long), 1, k, country_filter_list.as_deref()); let Some(cityrecord) = (match search_result { diff --git a/src/cmd/schema.rs b/src/cmd/schema.rs index 539e76f62..2c59041a6 100644 --- a/src/cmd/schema.rs +++ b/src/cmd/schema.rs @@ -353,7 +353,7 @@ pub fn infer_schema_from_stats(args: &Args, input_filename: &str) -> CliResult(min_str).unwrap(); + let min = min_str.parse::().unwrap(); field_map.insert( "minimum".to_string(), Value::Number(Number::from_f64(min).unwrap()), @@ -361,7 +361,7 @@ pub fn infer_schema_from_stats(args: &Args, input_filename: &str) -> CliResult(max_str).unwrap(); + let max = max_str.parse::().unwrap(); field_map.insert( "maximum".to_string(), Value::Number(Number::from_f64(max).unwrap()), diff --git a/src/cmd/sort.rs b/src/cmd/sort.rs index 31c4d3f97..998aec7b5 100644 --- a/src/cmd/sort.rs +++ b/src/cmd/sort.rs @@ -313,7 +313,7 @@ where .and_then(|s| { if let Ok(i) = s.parse::() { Some(Number::Int(i)) - } else if let Ok(f) = fast_float::parse(s) { + } else if let Ok(f) = s.parse::() { Some(Number::Float(f)) } else { None diff --git a/src/cmd/stats.rs b/src/cmd/stats.rs index 5009a75b1..6726e6c2f 100644 --- a/src/cmd/stats.rs +++ b/src/cmd/stats.rs @@ -1236,7 +1236,7 @@ impl Stats { // sum if let Some(sum) = self.sum.as_ref().and_then(|sum| sum.show(typ)) { if typ == FieldType::TFloat { - if let Ok(f64_val) = fast_float::parse::(&sum) { + if let Ok(f64_val) = sum.parse::() { pieces.push(util::round_num(f64_val, round_places)); } else { pieces.push(format!("ERROR: Cannot convert {sum} to a float.")); @@ -1502,7 +1502,7 @@ impl FieldType { return (TInteger, None); } - if fast_float::parse::(string).is_ok() { + if string.parse::().is_ok() { return (TFloat, None); } } @@ -1679,7 +1679,7 @@ impl TypedMinMax { match typ { TString | TNull => {}, TFloat => { - let n = fast_float::parse::(from_utf8(sample).unwrap()).unwrap(); + let n = from_utf8(sample).unwrap().parse::().unwrap(); self.floats.add(n); self.integers.add(n as i64); diff --git a/src/cmd/validate.rs b/src/cmd/validate.rs index c492c2049..c142aab1d 100644 --- a/src/cmd/validate.rs +++ b/src/cmd/validate.rs @@ -779,10 +779,10 @@ fn to_json_instance( }, b'n' => { // number - if let Ok(float) = fast_float::parse(&value_string) { + if let Ok(float) = value_string.parse::() { json_object_map.insert( key_string, - // safety: we know it's a valid f64 from the fast_float::parse() above + // safety: we know it's a valid f64 from the parse() above Value::Number(Number::from_f64(float).unwrap()), ); } else {