mirror of
https://github.com/fish-shell/fish-shell
synced 2025-01-15 22:44:01 +00:00
Stop using num_traits in printf
This wasn't needed at all.
This commit is contained in:
parent
26abb97198
commit
66ebd88c44
1 changed files with 2 additions and 4 deletions
|
@ -48,8 +48,6 @@
|
||||||
|
|
||||||
// This file has been imported from source code of printf command in GNU Coreutils version 6.9.
|
// This file has been imported from source code of printf command in GNU Coreutils version 6.9.
|
||||||
|
|
||||||
use num_traits;
|
|
||||||
|
|
||||||
use super::prelude::*;
|
use super::prelude::*;
|
||||||
use crate::locale::{get_numeric_locale, Locale};
|
use crate::locale::{get_numeric_locale, Locale};
|
||||||
use crate::wchar::encode_byte_to_char;
|
use crate::wchar::encode_byte_to_char;
|
||||||
|
@ -99,7 +97,7 @@ struct builtin_printf_state_t<'a, 'b> {
|
||||||
|
|
||||||
/// Convert to a scalar type. \return the result of conversion, and the end of the converted string.
|
/// Convert to a scalar type. \return the result of conversion, and the end of the converted string.
|
||||||
/// On conversion failure, \p end is not modified.
|
/// On conversion failure, \p end is not modified.
|
||||||
trait RawStringToScalarType: Copy + num_traits::Zero + std::convert::From<u32> {
|
trait RawStringToScalarType: Copy + std::convert::From<u32> {
|
||||||
/// Convert from a string to our self type.
|
/// Convert from a string to our self type.
|
||||||
/// \return the result of conversion, and the remainder of the string.
|
/// \return the result of conversion, and the remainder of the string.
|
||||||
fn raw_string_to_scalar_type<'a>(
|
fn raw_string_to_scalar_type<'a>(
|
||||||
|
@ -192,7 +190,7 @@ fn string_to_scalar_type<T: RawStringToScalarType>(
|
||||||
let mut end = s;
|
let mut end = s;
|
||||||
let mval = T::raw_string_to_scalar_type(s, &state.locale, &mut end);
|
let mval = T::raw_string_to_scalar_type(s, &state.locale, &mut end);
|
||||||
state.verify_numeric(s, end, mval.err());
|
state.verify_numeric(s, end, mval.err());
|
||||||
mval.unwrap_or(T::zero())
|
mval.unwrap_or(T::from(0))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue