Skip to content

Commit a580a11

Browse files
committed
Merge rust-bitcoin/rust-bitcoin#1032: Remove network::Error
99aab44 Remove network::Error (Tobin C. Harding) Pull request description: The `network::Error` is not used, remove it. (This description has been changed, the thumbs up emojis were put on the previous PR description.) ACKs for top commit: sanket1729: reACK 99aab44 apoelstra: ACK 99aab44 Tree-SHA512: 2342531160966860b7b65f8c5df10e169876ec446e6fd30093d5d81d0b0304cad04e2c2057eb3ca6b23a2fc56453c91ad4ddf426d3796fb301acb7f7d03a66b9
2 parents 9afed12 + a2df04d commit a580a11

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)