mirror of
https://github.com/pezkuwichain/serde.git
synced 2026-06-14 14:01:02 +00:00
Remove unused methods on FromPrimitive trait
This commit is contained in:
@@ -39,12 +39,10 @@ macro_rules! uint_to {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub trait FromPrimitive: Sized {
|
pub trait FromPrimitive: Sized {
|
||||||
fn from_isize(n: isize) -> Option<Self>;
|
|
||||||
fn from_i8(n: i8) -> Option<Self>;
|
fn from_i8(n: i8) -> Option<Self>;
|
||||||
fn from_i16(n: i16) -> Option<Self>;
|
fn from_i16(n: i16) -> Option<Self>;
|
||||||
fn from_i32(n: i32) -> Option<Self>;
|
fn from_i32(n: i32) -> Option<Self>;
|
||||||
fn from_i64(n: i64) -> Option<Self>;
|
fn from_i64(n: i64) -> Option<Self>;
|
||||||
fn from_usize(n: usize) -> Option<Self>;
|
|
||||||
fn from_u8(n: u8) -> Option<Self>;
|
fn from_u8(n: u8) -> Option<Self>;
|
||||||
fn from_u16(n: u16) -> Option<Self>;
|
fn from_u16(n: u16) -> Option<Self>;
|
||||||
fn from_u32(n: u32) -> Option<Self>;
|
fn from_u32(n: u32) -> Option<Self>;
|
||||||
@@ -54,10 +52,6 @@ pub trait FromPrimitive: Sized {
|
|||||||
macro_rules! impl_from_primitive_for_int {
|
macro_rules! impl_from_primitive_for_int {
|
||||||
($t:ident) => {
|
($t:ident) => {
|
||||||
impl FromPrimitive for $t {
|
impl FromPrimitive for $t {
|
||||||
#[inline]
|
|
||||||
fn from_isize(n: isize) -> Option<Self> {
|
|
||||||
int_to_int!($t, n)
|
|
||||||
}
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn from_i8(n: i8) -> Option<Self> {
|
fn from_i8(n: i8) -> Option<Self> {
|
||||||
int_to_int!($t, n)
|
int_to_int!($t, n)
|
||||||
@@ -75,10 +69,6 @@ macro_rules! impl_from_primitive_for_int {
|
|||||||
int_to_int!($t, n)
|
int_to_int!($t, n)
|
||||||
}
|
}
|
||||||
#[inline]
|
#[inline]
|
||||||
fn from_usize(n: usize) -> Option<Self> {
|
|
||||||
uint_to!($t, n)
|
|
||||||
}
|
|
||||||
#[inline]
|
|
||||||
fn from_u8(n: u8) -> Option<Self> {
|
fn from_u8(n: u8) -> Option<Self> {
|
||||||
uint_to!($t, n)
|
uint_to!($t, n)
|
||||||
}
|
}
|
||||||
@@ -101,10 +91,6 @@ macro_rules! impl_from_primitive_for_int {
|
|||||||
macro_rules! impl_from_primitive_for_uint {
|
macro_rules! impl_from_primitive_for_uint {
|
||||||
($t:ident) => {
|
($t:ident) => {
|
||||||
impl FromPrimitive for $t {
|
impl FromPrimitive for $t {
|
||||||
#[inline]
|
|
||||||
fn from_isize(n: isize) -> Option<Self> {
|
|
||||||
int_to_uint!($t, n)
|
|
||||||
}
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn from_i8(n: i8) -> Option<Self> {
|
fn from_i8(n: i8) -> Option<Self> {
|
||||||
int_to_uint!($t, n)
|
int_to_uint!($t, n)
|
||||||
@@ -122,10 +108,6 @@ macro_rules! impl_from_primitive_for_uint {
|
|||||||
int_to_uint!($t, n)
|
int_to_uint!($t, n)
|
||||||
}
|
}
|
||||||
#[inline]
|
#[inline]
|
||||||
fn from_usize(n: usize) -> Option<Self> {
|
|
||||||
uint_to!($t, n)
|
|
||||||
}
|
|
||||||
#[inline]
|
|
||||||
fn from_u8(n: u8) -> Option<Self> {
|
fn from_u8(n: u8) -> Option<Self> {
|
||||||
uint_to!($t, n)
|
uint_to!($t, n)
|
||||||
}
|
}
|
||||||
@@ -148,10 +130,6 @@ macro_rules! impl_from_primitive_for_uint {
|
|||||||
macro_rules! impl_from_primitive_for_float {
|
macro_rules! impl_from_primitive_for_float {
|
||||||
($t:ident) => {
|
($t:ident) => {
|
||||||
impl FromPrimitive for $t {
|
impl FromPrimitive for $t {
|
||||||
#[inline]
|
|
||||||
fn from_isize(n: isize) -> Option<Self> {
|
|
||||||
Some(n as Self)
|
|
||||||
}
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn from_i8(n: i8) -> Option<Self> {
|
fn from_i8(n: i8) -> Option<Self> {
|
||||||
Some(n as Self)
|
Some(n as Self)
|
||||||
@@ -169,10 +147,6 @@ macro_rules! impl_from_primitive_for_float {
|
|||||||
Some(n as Self)
|
Some(n as Self)
|
||||||
}
|
}
|
||||||
#[inline]
|
#[inline]
|
||||||
fn from_usize(n: usize) -> Option<Self> {
|
|
||||||
Some(n as Self)
|
|
||||||
}
|
|
||||||
#[inline]
|
|
||||||
fn from_u8(n: u8) -> Option<Self> {
|
fn from_u8(n: u8) -> Option<Self> {
|
||||||
Some(n as Self)
|
Some(n as Self)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user