From 9a0728eed6d3d2ece1882ae95802a94f330c71dd Mon Sep 17 00:00:00 2001 From: ridiculousfish Date: Sun, 21 Jan 2024 16:26:06 -0800 Subject: [PATCH] Stop using num_traits in common.rs This was a rather silly usage only for estimating string capacity in a rarely used function. We can do without it. --- src/common.rs | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/src/common.rs b/src/common.rs index 9b4c55d4c..645cd0cab 100644 --- a/src/common.rs +++ b/src/common.rs @@ -19,7 +19,6 @@ use bitflags::bitflags; use core::slice; use libc::{EIO, O_WRONLY, SIGTTOU, SIG_IGN, STDERR_FILENO, STDIN_FILENO, STDOUT_FILENO}; -use num_traits::ToPrimitive; use once_cell::sync::OnceCell; use std::env; use std::ffi::{CStr, CString, OsStr, OsString}; @@ -418,13 +417,7 @@ fn escape_string_var(input: &wstr) -> WString { /// \param in is the raw string to be searched for literally when substituted in a PCRE2 expression. fn escape_string_pcre2(input: &wstr) -> WString { let mut out = WString::new(); - out.reserve( - (f64::from(u32::try_from(input.len()).unwrap()) * 1.3) // a wild guess - .to_i128() - .unwrap() - .try_into() - .unwrap(), - ); + out.reserve(input.len()); for c in input.chars() { if [