mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-26 12:53:13 +00:00
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.
This commit is contained in:
parent
1a42bdf182
commit
9a0728eed6
1 changed files with 1 additions and 8 deletions
|
@ -19,7 +19,6 @@ use crate::wutil::fish_iswalnum;
|
|||
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 [
|
||||
|
|
Loading…
Reference in a new issue