committed by
GitHub
parent
96f6ed15d7
commit
c915b236ae
13
src/error.rs
13
src/error.rs
@@ -83,7 +83,7 @@ impl Error {
|
|||||||
Some(e) => e,
|
Some(e) => e,
|
||||||
None => return false,
|
None => return false,
|
||||||
};
|
};
|
||||||
let ioe: &Box<io::Error> = match source.downcast_ref() {
|
let ioe: &io::Error = match source.downcast_ref() {
|
||||||
Some(e) => e,
|
Some(e) => e,
|
||||||
None => return false,
|
None => return false,
|
||||||
};
|
};
|
||||||
@@ -183,6 +183,17 @@ fn io_error() {
|
|||||||
assert_eq!(err.to_string(), "http://example.com/: Io: oops: too slow");
|
assert_eq!(err.to_string(), "http://example.com/: Io: oops: too slow");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn connection_closed() {
|
||||||
|
let ioe = io::Error::new(io::ErrorKind::ConnectionReset, "connection reset");
|
||||||
|
let err = ErrorKind::Io.new().src(ioe);
|
||||||
|
assert!(err.connection_closed());
|
||||||
|
|
||||||
|
let ioe = io::Error::new(io::ErrorKind::ConnectionAborted, "connection aborted");
|
||||||
|
let err = ErrorKind::Io.new().src(ioe);
|
||||||
|
assert!(err.connection_closed());
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn error_is_send_and_sync() {
|
fn error_is_send_and_sync() {
|
||||||
fn takes_send(_: impl Send) {}
|
fn takes_send(_: impl Send) {}
|
||||||
|
|||||||
Reference in New Issue
Block a user