mirror of
https://github.com/fish-shell/fish-shell
synced 2024-11-14 17:07:44 +00:00
use $( ... )* syntax
This commit is contained in:
parent
732f7284d4
commit
2e66bb19da
1 changed files with 8 additions and 12 deletions
|
@ -33,37 +33,33 @@ fn to_wstring_impl(mut val: u64, neg: bool) -> WString {
|
|||
|
||||
/// Implement to_wstring() for signed types.
|
||||
macro_rules! impl_to_wstring_signed {
|
||||
($t:ty) => {
|
||||
($($t:ty), *) => {
|
||||
$(
|
||||
impl ToWString for $t {
|
||||
fn to_wstring(&self) -> WString {
|
||||
let val = *self as i64;
|
||||
to_wstring_impl(val.unsigned_abs(), val < 0)
|
||||
}
|
||||
}
|
||||
)*
|
||||
};
|
||||
}
|
||||
impl_to_wstring_signed!(i8);
|
||||
impl_to_wstring_signed!(i16);
|
||||
impl_to_wstring_signed!(i32);
|
||||
impl_to_wstring_signed!(i64);
|
||||
impl_to_wstring_signed!(isize);
|
||||
impl_to_wstring_signed!(i8, i16, i32, i64, isize);
|
||||
|
||||
/// Implement to_wstring() for unsigned types.
|
||||
macro_rules! impl_to_wstring_unsigned {
|
||||
($t:ty) => {
|
||||
($($t:ty), *) => {
|
||||
$(
|
||||
impl ToWString for $t {
|
||||
fn to_wstring(&self) -> WString {
|
||||
to_wstring_impl(*self as u64, false)
|
||||
}
|
||||
}
|
||||
)*
|
||||
};
|
||||
}
|
||||
|
||||
impl_to_wstring_unsigned!(u8);
|
||||
impl_to_wstring_unsigned!(u16);
|
||||
impl_to_wstring_unsigned!(u32);
|
||||
impl_to_wstring_unsigned!(u64);
|
||||
impl_to_wstring_unsigned!(usize);
|
||||
impl_to_wstring_unsigned!(u8, u16, u32, u64, usize);
|
||||
|
||||
#[test]
|
||||
fn test_to_wstring() {
|
||||
|
|
Loading…
Reference in a new issue