Skip to content

Commit a2df04d

Browse files
committed
Remove network::Error
The `network::Error` is not used, remove it.
1 parent 392465c commit a2df04d

File tree

2 files changed

+1
-52
lines changed

2 files changed

+1
-52
lines changed

src/network/mod.rs

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,6 @@
1818
//! of Bitcoin data and network messages.
1919
//!
2020
21-
use crate::io;
22-
use core::fmt;
23-
2421
pub mod constants;
2522

2623
#[cfg(feature = "std")]
@@ -47,38 +44,3 @@ pub mod message_filter;
4744
#[cfg(feature = "std")]
4845
#[cfg_attr(docsrs, doc(cfg(feature = "std")))]
4946
pub mod stream_reader;
50-
51-
/// Network error
52-
#[derive(Debug)]
53-
#[non_exhaustive]
54-
pub enum Error {
55-
/// And I/O error
56-
Io(io::Error),
57-
}
58-
59-
impl fmt::Display for Error {
60-
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
61-
match *self {
62-
Error::Io(ref e) => write_err!(f, "IO error"; e),
63-
}
64-
}
65-
}
66-
67-
#[cfg(feature = "std")]
68-
#[cfg_attr(docsrs, doc(cfg(feature = "std")))]
69-
impl std::error::Error for Error {
70-
fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
71-
use self::Error::*;
72-
73-
match self {
74-
Io(e) => Some(e)
75-
}
76-
}
77-
}
78-
79-
#[doc(hidden)]
80-
impl From<io::Error> for Error {
81-
fn from(err: io::Error) -> Self {
82-
Error::Io(err)
83-
}
84-
}

src/util/mod.rs

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ use crate::prelude::*;
4040
use crate::io;
4141
use core::fmt;
4242

43-
use crate::network;
4443
use crate::consensus::encode;
4544

4645
/// A trait which allows numbers to act as fixed-size bit arrays
@@ -71,8 +70,6 @@ pub trait BitArray {
7170
pub enum Error {
7271
/// Encoding error
7372
Encode(encode::Error),
74-
/// Network error
75-
Network(network::Error),
7673
/// The header hash is not below the target
7774
BlockBadProofOfWork,
7875
/// The `target` field of a block header did not match the expected difficulty
@@ -83,7 +80,6 @@ impl fmt::Display for Error {
8380
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
8481
match *self {
8582
Error::Encode(ref e) => write_err!(f, "encoding error"; e),
86-
Error::Network(ref e) => write_err!(f, "network error"; e),
8783
Error::BlockBadProofOfWork => f.write_str("block target correct but not attained"),
8884
Error::BlockBadTarget => f.write_str("block target incorrect"),
8985
}
@@ -98,9 +94,7 @@ impl std::error::Error for Error {
9894

9995
match self {
10096
Encode(e) => Some(e),
101-
Network(e) => Some(e),
102-
BlockBadProofOfWork
103-
| BlockBadTarget => None
97+
BlockBadProofOfWork | BlockBadTarget => None
10498
}
10599
}
106100
}
@@ -112,13 +106,6 @@ impl From<encode::Error> for Error {
112106
}
113107
}
114108

115-
#[doc(hidden)]
116-
impl From<network::Error> for Error {
117-
fn from(e: network::Error) -> Error {
118-
Error::Network(e)
119-
}
120-
}
121-
122109
// core2 doesn't have read_to_end
123110
pub(crate) fn read_to_end<D: io::Read>(mut d: D) -> Result<Vec<u8>, io::Error> {
124111
let mut result = vec![];

0 commit comments

Comments
 (0)