Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions src/base/charstr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1112,8 +1112,7 @@ impl fmt::Display for CharStrError {
}
}

#[cfg(feature = "std")]
impl std::error::Error for CharStrError {}
impl core::error::Error for CharStrError {}

//------------ FromStrError --------------------------------------------------

Expand Down Expand Up @@ -1152,8 +1151,7 @@ impl fmt::Display for FromStrError {
}
}

#[cfg(feature = "std")]
impl std::error::Error for FromStrError {}
impl core::error::Error for FromStrError {}

//------------ PresentationError ---------------------------------------------

Expand Down Expand Up @@ -1208,8 +1206,7 @@ impl fmt::Display for PresentationError {
}
}

#[cfg(feature = "std")]
impl std::error::Error for PresentationError {}
impl core::error::Error for PresentationError {}

//============ Testing =======================================================

Expand Down
6 changes: 2 additions & 4 deletions src/base/header.rs
Original file line number Diff line number Diff line change
Expand Up @@ -938,8 +938,7 @@ impl fmt::Display for FlagsFromStrError {
}
}

#[cfg(feature = "std")]
impl std::error::Error for FlagsFromStrError {}
impl core::error::Error for FlagsFromStrError {}

//------------ CountOverflow -------------------------------------------------

Expand All @@ -953,8 +952,7 @@ impl fmt::Display for CountOverflow {
}
}

#[cfg(feature = "std")]
impl std::error::Error for CountOverflow {}
impl core::error::Error for CountOverflow {}

//============ Testing ======================================================

Expand Down
3 changes: 1 addition & 2 deletions src/base/iana/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -520,8 +520,7 @@ macro_rules! from_str_error {
#[derive(Clone, Debug)]
pub struct FromStrError(());

#[cfg(feature = "std")]
impl std::error::Error for FromStrError {
impl core::error::Error for FromStrError {
fn description(&self) -> &str {
$description
}
Expand Down
3 changes: 1 addition & 2 deletions src/base/iana/rcode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -911,8 +911,7 @@ impl fmt::Display for InvalidRcode {
}
}

#[cfg(feature = "std")]
impl std::error::Error for InvalidRcode {}
impl core::error::Error for InvalidRcode {}

//============ Tests =========================================================

Expand Down
6 changes: 2 additions & 4 deletions src/base/message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1306,8 +1306,7 @@ impl fmt::Display for ShortMessage {
}
}

#[cfg(feature = "std")]
impl std::error::Error for ShortMessage {}
impl core::error::Error for ShortMessage {}

//------------ CopyRecordsError ----------------------------------------------

Expand Down Expand Up @@ -1346,8 +1345,7 @@ impl fmt::Display for CopyRecordsError {
}
}

#[cfg(feature = "std")]
impl std::error::Error for CopyRecordsError {}
impl core::error::Error for CopyRecordsError {}

//============ Testing =======================================================

Expand Down
3 changes: 1 addition & 2 deletions src/base/message_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2693,8 +2693,7 @@ impl fmt::Display for PushError {
}
}

#[cfg(feature = "std")]
impl std::error::Error for PushError {}
impl core::error::Error for PushError {}

//============ Testing =======================================================

Expand Down
3 changes: 1 addition & 2 deletions src/base/name/absolute.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1217,8 +1217,7 @@ impl fmt::Display for NameError {
}
}

#[cfg(feature = "std")]
impl std::error::Error for NameError {}
impl core::error::Error for NameError {}

//============ Testing =======================================================
//
Expand Down
15 changes: 5 additions & 10 deletions src/base/name/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -562,8 +562,7 @@ impl fmt::Display for PushError {
}
}

#[cfg(feature = "std")]
impl std::error::Error for PushError {}
impl core::error::Error for PushError {}

//------------ PushNameError -------------------------------------------------

Expand Down Expand Up @@ -596,8 +595,7 @@ impl fmt::Display for PushNameError {
}
}

#[cfg(feature = "std")]
impl std::error::Error for PushNameError {}
impl core::error::Error for PushNameError {}

//------------ LabelFromStrError ---------------------------------------------

Expand Down Expand Up @@ -655,8 +653,7 @@ impl fmt::Display for LabelFromStrError {
}
}

#[cfg(feature = "std")]
impl std::error::Error for LabelFromStrError {}
impl core::error::Error for LabelFromStrError {}

//------------ FromStrError --------------------------------------------------

Expand Down Expand Up @@ -713,8 +710,7 @@ impl fmt::Display for FromStrError {
}
}

#[cfg(feature = "std")]
impl std::error::Error for FromStrError {}
impl core::error::Error for FromStrError {}

//------------ PresentationError ---------------------------------------------

Expand Down Expand Up @@ -761,8 +757,7 @@ impl fmt::Display for PresentationError {
}
}

#[cfg(feature = "std")]
impl std::error::Error for PresentationError {}
impl core::error::Error for PresentationError {}

//============ Testing =======================================================

Expand Down
3 changes: 1 addition & 2 deletions src/base/name/chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -373,8 +373,7 @@ impl fmt::Display for LongChainError {
}
}

#[cfg(feature = "std")]
impl std::error::Error for LongChainError {}
impl core::error::Error for LongChainError {}

//============ Testing =======================================================

Expand Down
9 changes: 3 additions & 6 deletions src/base/name/label.rs
Original file line number Diff line number Diff line change
Expand Up @@ -808,8 +808,7 @@ impl fmt::Display for LabelTypeError {
}
}

#[cfg(feature = "std")]
impl std::error::Error for LabelTypeError {}
impl core::error::Error for LabelTypeError {}

//------------ LongLabelError ------------------------------------------------

Expand All @@ -825,8 +824,7 @@ impl fmt::Display for LongLabelError {
}
}

#[cfg(feature = "std")]
impl std::error::Error for LongLabelError {}
impl core::error::Error for LongLabelError {}

//------------ SplitLabelError -----------------------------------------------

Expand Down Expand Up @@ -879,8 +877,7 @@ impl fmt::Display for SplitLabelError {
}
}

#[cfg(feature = "std")]
impl std::error::Error for SplitLabelError {}
impl core::error::Error for SplitLabelError {}

//============ Testing =======================================================

Expand Down
3 changes: 1 addition & 2 deletions src/base/name/parsed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -707,8 +707,7 @@ impl fmt::Display for ParsedDnameError {
}
}

#[cfg(feature = "std")]
impl std::error::Error for ParsedDnameError {}
impl core::error::Error for ParsedDnameError {}

impl From<LabelTypeError> for ParsedDnameError {
fn from(err: LabelTypeError) -> Self {
Expand Down
9 changes: 3 additions & 6 deletions src/base/name/relative.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1043,8 +1043,7 @@ impl fmt::Display for RelativeNameError {
}
}

#[cfg(feature = "std")]
impl std::error::Error for RelativeNameError {}
impl core::error::Error for RelativeNameError {}

//------------ RelativeFromStrError ------------------------------------------

Expand Down Expand Up @@ -1079,8 +1078,7 @@ impl fmt::Display for RelativeFromStrError {
}
}

#[cfg(feature = "std")]
impl std::error::Error for RelativeFromStrError {}
impl core::error::Error for RelativeFromStrError {}

//------------ StripSuffixError ----------------------------------------------

Expand All @@ -1096,8 +1094,7 @@ impl fmt::Display for StripSuffixError {
}
}

#[cfg(feature = "std")]
impl std::error::Error for StripSuffixError {}
impl core::error::Error for StripSuffixError {}

//============ Testing =======================================================

Expand Down
3 changes: 1 addition & 2 deletions src/base/name/uncertain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -637,8 +637,7 @@ impl fmt::Display for UncertainDnameError {
}
}

#[cfg(feature = "std")]
impl std::error::Error for UncertainDnameError {}
impl core::error::Error for UncertainDnameError {}

//============ Testing =======================================================

Expand Down
3 changes: 1 addition & 2 deletions src/base/opt/keepalive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -227,8 +227,7 @@ impl fmt::Display for FromDurationError {
}
}

#[cfg(feature = "std")]
impl std::error::Error for FromDurationError {}
impl core::error::Error for FromDurationError {}

//============ Testing =======================================================

Expand Down
6 changes: 2 additions & 4 deletions src/base/opt/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1103,8 +1103,7 @@ impl fmt::Display for LongOptData {
}
}

#[cfg(feature = "std")]
impl std::error::Error for LongOptData {}
impl core::error::Error for LongOptData {}

//------------ BuildDataError ------------------------------------------------

Expand Down Expand Up @@ -1155,8 +1154,7 @@ impl fmt::Display for BuildDataError {
}
}

#[cfg(feature = "std")]
impl std::error::Error for BuildDataError {}
impl core::error::Error for BuildDataError {}

//============ Tests =========================================================

Expand Down
6 changes: 2 additions & 4 deletions src/base/question.rs
Original file line number Diff line number Diff line change
Expand Up @@ -408,8 +408,7 @@ impl fmt::Display for FromStrError {
}
}

#[cfg(feature = "std")]
impl std::error::Error for FromStrError {}
impl core::error::Error for FromStrError {}

//------------ PresentationError ---------------------------------------------

Expand Down Expand Up @@ -466,5 +465,4 @@ impl fmt::Display for PresentationError {
}
}

#[cfg(feature = "std")]
impl std::error::Error for PresentationError {}
impl core::error::Error for PresentationError {}
3 changes: 1 addition & 2 deletions src/base/rdata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -535,8 +535,7 @@ impl fmt::Display for LongRecordData {
}
}

#[cfg(feature = "std")]
impl std::error::Error for LongRecordData {}
impl core::error::Error for LongRecordData {}

//============ Testing ======================================================

Expand Down
7 changes: 3 additions & 4 deletions src/base/record.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1068,11 +1068,10 @@ where
}
}

#[cfg(feature = "std")]
impl<N, D> std::error::Error for RecordParseError<N, D>
impl<N, D> core::error::Error for RecordParseError<N, D>
where
N: std::error::Error,
D: std::error::Error,
N: core::error::Error,
D: core::error::Error,
{
}

Expand Down
19 changes: 5 additions & 14 deletions src/base/scan.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ use crate::base::charstr::{CharStr, CharStrBuilder};
use crate::base::name::{Name, ToName};
use crate::base::wire::{Compose, Composer};
use core::convert::{TryFrom, TryInto};
use core::error;
use core::iter::Peekable;
use core::marker::PhantomData;
use core::{fmt, str};
Expand All @@ -33,8 +34,6 @@ use octseq::{
EmptyBuilder, FreezeBuilder, FromBuilder, OctetsBuilder, ShortBuf,
Truncate,
};
#[cfg(feature = "std")]
use std::error;

use super::Ttl;

Expand Down Expand Up @@ -286,12 +285,8 @@ macro_rules! declare_error_trait {
}
}

#[cfg(feature = "std")]
declare_error_trait!(ScannerError: Sized + error::Error);

#[cfg(not(feature = "std"))]
declare_error_trait!(ScannerError: Sized + fmt::Debug + fmt::Display);

#[cfg(feature = "std")]
impl ScannerError for std::io::Error {
fn custom(msg: &'static str) -> Self {
Expand Down Expand Up @@ -1083,8 +1078,7 @@ impl fmt::Display for SymbolCharsError {
}
}

#[cfg(feature = "std")]
impl std::error::Error for SymbolCharsError {}
impl core::error::Error for SymbolCharsError {}

//------------ SymbolOctetsError ---------------------------------------------

Expand Down Expand Up @@ -1125,8 +1119,7 @@ impl fmt::Display for SymbolOctetsError {
}
}

#[cfg(feature = "std")]
impl std::error::Error for SymbolOctetsError {}
impl core::error::Error for SymbolOctetsError {}

//------------ BadSymbol -----------------------------------------------------

Expand Down Expand Up @@ -1174,8 +1167,7 @@ impl fmt::Display for BadSymbol {
}
}

#[cfg(feature = "std")]
impl std::error::Error for BadSymbol {}
impl core::error::Error for BadSymbol {}

#[cfg(feature = "std")]
impl From<BadSymbol> for std::io::Error {
Expand Down Expand Up @@ -1220,8 +1212,7 @@ impl fmt::Display for StrError {
}
}

#[cfg(feature = "std")]
impl std::error::Error for StrError {}
impl core::error::Error for StrError {}

//============ Testing =======================================================

Expand Down
Loading
Loading