Move error code to match conventional layout
We typically layout error code as: definition, [impl block], `Display` impl, `error::Error` impl, from imlps. Code move only, no other changes.
This commit is contained in:
parent
bd9c4125cf
commit
39314ad52f
|
@ -35,14 +35,6 @@ impl ParseIntError {
|
|||
pub fn input(&self) -> &str { &self.input }
|
||||
}
|
||||
|
||||
impl From<ParseIntError> for core::num::ParseIntError {
|
||||
fn from(value: ParseIntError) -> Self { value.source }
|
||||
}
|
||||
|
||||
impl AsRef<core::num::ParseIntError> for ParseIntError {
|
||||
fn as_ref(&self) -> &core::num::ParseIntError { &self.source }
|
||||
}
|
||||
|
||||
impl fmt::Display for ParseIntError {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
let signed = if self.is_signed { "signed" } else { "unsigned" };
|
||||
|
@ -51,6 +43,16 @@ impl fmt::Display for ParseIntError {
|
|||
}
|
||||
}
|
||||
|
||||
impl_std_error!(ParseIntError, source);
|
||||
|
||||
impl From<ParseIntError> for core::num::ParseIntError {
|
||||
fn from(value: ParseIntError) -> Self { value.source }
|
||||
}
|
||||
|
||||
impl AsRef<core::num::ParseIntError> for ParseIntError {
|
||||
fn as_ref(&self) -> &core::num::ParseIntError { &self.source }
|
||||
}
|
||||
|
||||
/// Not strictly neccessary but serves as a lint - avoids weird behavior if someone accidentally
|
||||
/// passes non-integer to the `parse()` function.
|
||||
pub(crate) trait Integer:
|
||||
|
@ -95,8 +97,6 @@ pub(crate) fn hex_u32<S: AsRef<str> + Into<String>>(s: S) -> Result<u32, ParseIn
|
|||
})
|
||||
}
|
||||
|
||||
impl_std_error!(ParseIntError, source);
|
||||
|
||||
/// Implements `TryFrom<$from> for $to` using `parse::int`, mapping the output using infallible
|
||||
/// conversion function `fn`.
|
||||
macro_rules! impl_tryfrom_str_from_int_infallible {
|
||||
|
|
Loading…
Reference in New Issue