Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve README and fix compile warnings #54

Merged
merged 2 commits into from Aug 10, 2020
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.rst
Expand Up @@ -25,13 +25,13 @@ Here is the comprehensive example:
Io(err: io::Error) {
from()
display("I/O error: {}", err)
cause(err)
source(err)
}
Other(descr: &'static str) {
display("Error {}", descr)
}
IoAt { place: &'static str, err: io::Error } {
cause(err)
source(err)
display(me) -> ("io error at {}: {}", place, err)
from(s: String) -> {
place: "some string",
Expand Down
14 changes: 6 additions & 8 deletions src/lib.rs
Expand Up @@ -997,7 +997,7 @@ mod test {

#[test]
fn bare_item_trait() {
let err: &Error = &Bare::Two;
let err: &dyn Error = &Bare::Two;
assert_eq!(format!("{}", err), "Two".to_string());
assert_eq!(format!("{:?}", err), "Two".to_string());
assert!(err.source().is_none());
Expand Down Expand Up @@ -1075,7 +1075,7 @@ mod test {
#[test]
fn tuple_wrapper_trait_str() {
let desc = "hello";
let err: &Error = &TupleWrapper::Other(desc);
let err: &dyn Error = &TupleWrapper::Other(desc);
assert_eq!(format!("{}", err), format!("Error: {}", desc));
assert_eq!(format!("{:?}", err), format!("Other({:?})", desc));
assert!(err.source().is_none());
Expand All @@ -1087,7 +1087,7 @@ mod test {
let source = String::from_utf8(invalid_utf8.clone())
.unwrap_err()
.utf8_error();
let err: &Error = &TupleWrapper::FromUtf8Error(source.clone(), invalid_utf8.clone());
let err: &dyn Error = &TupleWrapper::FromUtf8Error(source.clone(), invalid_utf8.clone());
assert_eq!(
format!("{}", err),
format!(
Expand Down Expand Up @@ -1162,7 +1162,7 @@ mod test {
let source = String::from_utf8(invalid_utf8.clone())
.unwrap_err()
.utf8_error();
let err: &Error = &StructWrapper::Utf8Error {
let err: &dyn Error = &StructWrapper::Utf8Error {
err: source.clone(),
hint: Some("nonsense"),
};
Expand Down Expand Up @@ -1276,9 +1276,7 @@ mod test {

#[test]
fn path_context() {
fn parse_utf<P: AsRef<Path>>(s: &[u8], p: P)
-> Result<(), ContextErr>
{
fn parse_utf<P: AsRef<Path>>(s: &[u8], p: P) -> Result<(), ContextErr> {
::std::str::from_utf8(s).context(p)?;
Ok(())
}
Expand Down Expand Up @@ -1309,7 +1307,7 @@ mod test {
let cause = String::from_utf8(invalid_utf8.clone())
.unwrap_err()
.utf8_error();
let err: &Error = &StructWrapper::Utf8Error {
let err: &dyn Error = &StructWrapper::Utf8Error {
err: cause.clone(),
hint: Some("nonsense"),
};
Expand Down