This commit is contained in:
Harald Hoyer 2020-03-03 14:37:11 +01:00
parent 3e270f1e1a
commit 1d43a39c61
No known key found for this signature in database
GPG key ID: 340F12141EA0994D
18 changed files with 83 additions and 84 deletions

View file

@ -4,12 +4,12 @@ use std::result::Result;
use chainerror::*;
fn do_some_io() -> Result<(), Box<Error + Send + Sync>> {
fn do_some_io() -> Result<(), Box<dyn Error + Send + Sync>> {
Err(io::Error::from(io::ErrorKind::NotFound))?;
Ok(())
}
fn func3() -> Result<(), Box<Error + Send + Sync>> {
fn func3() -> Result<(), Box<dyn Error + Send + Sync>> {
let filename = "foo.txt";
do_some_io().map_err(mstrerr!("Error reading '{}'", filename))?;
Ok(())

View file

@ -2,25 +2,25 @@ use std::error::Error;
use std::io;
use std::result::Result;
fn do_some_io() -> Result<(), Box<Error + Send + Sync>> {
fn do_some_io() -> Result<(), Box<dyn Error + Send + Sync>> {
Err(io::Error::from(io::ErrorKind::NotFound))?;
Ok(())
}
fn func2() -> Result<(), Box<Error + Send + Sync>> {
fn func2() -> Result<(), Box<dyn Error + Send + Sync>> {
if let Err(_) = do_some_io() {
Err("func2 error")?;
}
Ok(())
}
fn func1() -> Result<(), Box<Error + Send + Sync>> {
fn func1() -> Result<(), Box<dyn Error + Send + Sync>> {
if let Err(_) = func2() {
Err("func1 error")?;
}
Ok(())
}
fn main() -> Result<(), Box<Error + Send + Sync>> {
fn main() -> Result<(), Box<dyn Error + Send + Sync>> {
func1()
}

View file

@ -3,14 +3,14 @@ use std::error::Error;
use std::io;
use std::result::Result;
fn do_some_io() -> Result<(), Box<Error + Send + Sync>> {
fn do_some_io() -> Result<(), Box<dyn Error + Send + Sync>> {
Err(io::Error::from(io::ErrorKind::NotFound))?;
Ok(())
}
derive_str_cherr!(Func2Error);
fn func2() -> Result<(), Box<Error + Send + Sync>> {
fn func2() -> Result<(), Box<dyn Error + Send + Sync>> {
let filename = "foo.txt";
do_some_io().map_err(mstrerr!(Func2Error, "Error reading '{}'", filename))?;
Ok(())
@ -39,7 +39,7 @@ fn func1() -> ChainResult<(), Func1ErrorKind> {
Ok(())
}
fn main() -> Result<(), Box<Error + Send + Sync>> {
fn main() -> Result<(), Box<dyn Error + Send + Sync>> {
if let Err(e) = func1() {
match e.kind() {
Func1ErrorKind::Func2 => eprintln!("Main Error Report: func1 error calling func2"),

View file

@ -3,14 +3,14 @@ use std::error::Error;
use std::io;
use std::result::Result;
fn do_some_io() -> Result<(), Box<Error + Send + Sync>> {
fn do_some_io() -> Result<(), Box<dyn Error + Send + Sync>> {
Err(io::Error::from(io::ErrorKind::NotFound))?;
Ok(())
}
derive_str_cherr!(Func2Error);
fn func2() -> Result<(), Box<Error + Send + Sync>> {
fn func2() -> Result<(), Box<dyn Error + Send + Sync>> {
let filename = "foo.txt";
do_some_io().map_err(mstrerr!(Func2Error, "Error reading '{}'", filename))?;
Ok(())
@ -45,7 +45,7 @@ fn func1() -> ChainResult<(), Func1ErrorKind> {
Ok(())
}
fn main() -> Result<(), Box<Error + Send + Sync>> {
fn main() -> Result<(), Box<dyn Error + Send + Sync>> {
if let Err(e) = func1() {
match e.kind() {
Func1ErrorKind::Func2 => eprintln!("Main Error Report: func1 error calling func2"),

View file

@ -3,14 +3,14 @@ use std::error::Error;
use std::io;
use std::result::Result;
fn do_some_io() -> Result<(), Box<Error + Send + Sync>> {
fn do_some_io() -> Result<(), Box<dyn Error + Send + Sync>> {
Err(io::Error::from(io::ErrorKind::NotFound))?;
Ok(())
}
derive_str_cherr!(Func2Error);
fn func2() -> Result<(), Box<Error + Send + Sync>> {
fn func2() -> Result<(), Box<dyn Error + Send + Sync>> {
let filename = "foo.txt";
do_some_io().map_err(mstrerr!(Func2Error, "Error reading '{}'", filename))?;
Ok(())
@ -54,7 +54,7 @@ fn handle_func1errorkind(e: &Func1ErrorKind) {
}
}
fn main() -> Result<(), Box<Error + Send + Sync>> {
fn main() -> Result<(), Box<dyn Error + Send + Sync>> {
if let Err(e) = func1() {
match *e {
Func1ErrorKind::Func2 => eprintln!("Main Error Report: func1 error calling func2"),

View file

@ -2,14 +2,14 @@ pub mod mycrate {
use chainerror::*;
use std::io;
fn do_some_io() -> std::result::Result<(), Box<std::error::Error + Send + Sync>> {
fn do_some_io() -> std::result::Result<(), Box<dyn std::error::Error + Send + Sync>> {
Err(io::Error::from(io::ErrorKind::NotFound))?;
Ok(())
}
derive_str_cherr!(Func2Error);
fn func2() -> std::result::Result<(), Box<std::error::Error + Send + Sync>> {
fn func2() -> std::result::Result<(), Box<dyn std::error::Error + Send + Sync>> {
let filename = "foo.txt";
do_some_io().map_err(mstrerr!(Func2Error, "Error reading '{}'", filename))?;
Ok(())
@ -42,7 +42,7 @@ pub mod mycrate {
}
}
fn main() -> Result<(), Box<std::error::Error + Send + Sync>> {
fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
use mycrate::func1;
use mycrate::ErrorKind;
use std::error::Error;
@ -57,7 +57,7 @@ fn main() -> Result<(), Box<std::error::Error + Send + Sync>> {
}
eprintln!();
let mut s: &Error = &e;
let mut s: &dyn Error = &e;
while let Some(c) = s.source() {
if let Some(ioerror) = c.downcast_ref::<io::Error>() {
eprintln!("caused by: std::io::Error: {}", ioerror);

View file

@ -182,7 +182,7 @@ pub mod mycrate {
}
}
fn main() -> Result<(), Box<std::error::Error + Send + Sync>> {
fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
use mycrate::func1;
use mycrate::ErrorKind;
use std::error::Error;
@ -197,7 +197,7 @@ fn main() -> Result<(), Box<std::error::Error + Send + Sync>> {
}
eprintln!();
let mut s: &Error = &e;
let mut s: &dyn Error = &e;
while let Some(c) = s.source() {
if let Some(ioerror) = c.downcast_ref::<io::Error>() {
eprintln!("caused by: std::io::Error: {}", ioerror);

View file

@ -10,7 +10,7 @@ pub mod mycrate {
derive_str_cherr!(Func2Error);
fn func2() -> std::result::Result<(), Box<std::error::Error + Send + Sync>> {
fn func2() -> std::result::Result<(), Box<dyn std::error::Error + Send + Sync>> {
let filename = "foo.txt";
do_some_io(filename)
.map_err(|e| cherr!(e, Func2Error(format!("Error reading '{}'", filename))))?;
@ -52,7 +52,7 @@ pub mod mycrate {
}
impl From<&(dyn std::error::Error + 'static + Send + Sync)> for ErrorKind {
fn from(e: &(dyn std::error::Error + 'static + Send + Sync)) -> Self {
fn from(e: &(dyn std::error::Error + 'static + Send + Sync)) -> Self {
if let Some(_) = e.downcast_ref::<io::Error>() {
ErrorKind::IO(String::from("Unknown filename"))
} else if let Some(_) = e.downcast_inner_ref::<Func2Error>() {
@ -63,8 +63,8 @@ pub mod mycrate {
}
}
impl From<&std::boxed::Box<dyn std::error::Error + 'static + Send + Sync>> for ErrorKind {
fn from(e: &std::boxed::Box<dyn std::error::Error + 'static + Send + Sync>) -> Self {
impl From<&std::boxed::Box<dyn std::error::Error + 'static + Send + Sync>> for ErrorKind {
fn from(e: &std::boxed::Box<dyn std::error::Error + 'static + Send + Sync>) -> Self {
Self::from(&**e)
}
}
@ -99,10 +99,9 @@ pub mod mycrate {
func1().map_err(minto_cherr!(ErrorKind))?;
Ok(())
}
}
fn main() -> Result<(), Box<std::error::Error + Send + Sync>> {
fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
use mycrate::super_func1;
use mycrate::ErrorKind;
use std::error::Error;
@ -119,7 +118,7 @@ fn main() -> Result<(), Box<std::error::Error + Send + Sync>> {
}
eprintln!();
let mut s: &Error = &e;
let mut s: &dyn Error = &e;
while let Some(c) = s.source() {
if let Some(ioerror) = c.downcast_ref::<io::Error>() {
eprintln!("caused by: std::io::Error: {}", ioerror);

View file

@ -4,25 +4,25 @@ use std::error::Error;
use std::io;
use std::result::Result;
fn do_some_io() -> Result<(), Box<Error + Send + Sync>> {
fn do_some_io() -> Result<(), Box<dyn Error + Send + Sync>> {
Err(io::Error::from(io::ErrorKind::NotFound))?;
Ok(())
}
fn func2() -> Result<(), Box<Error + Send + Sync>> {
fn func2() -> Result<(), Box<dyn Error + Send + Sync>> {
if let Err(e) = do_some_io() {
Err(cherr!(e, "func2 error"))?;
}
Ok(())
}
fn func1() -> Result<(), Box<Error + Send + Sync>> {
fn func1() -> Result<(), Box<dyn Error + Send + Sync>> {
if let Err(e) = func2() {
Err(cherr!(e, "func1 error"))?;
}
Ok(())
}
fn main() -> Result<(), Box<Error + Send + Sync>> {
fn main() -> Result<(), Box<dyn Error + Send + Sync>> {
func1()
}

View file

@ -4,22 +4,22 @@ use std::error::Error;
use std::io;
use std::result::Result;
fn do_some_io() -> Result<(), Box<Error + Send + Sync>> {
fn do_some_io() -> Result<(), Box<dyn Error + Send + Sync>> {
Err(io::Error::from(io::ErrorKind::NotFound))?;
Ok(())
}
fn func2() -> Result<(), Box<Error + Send + Sync>> {
fn func2() -> Result<(), Box<dyn Error + Send + Sync>> {
do_some_io().map_err(|e| cherr!(e, "func2 error"))?;
Ok(())
}
fn func1() -> Result<(), Box<Error + Send + Sync>> {
fn func1() -> Result<(), Box<dyn Error + Send + Sync>> {
func2().map_err(|e| cherr!(e, "func1 error"))?;
Ok(())
}
fn main() -> Result<(), Box<Error + Send + Sync>> {
fn main() -> Result<(), Box<dyn Error + Send + Sync>> {
if let Err(e) = func1() {
eprintln!("{:?}", e);
}

View file

@ -3,23 +3,23 @@ use std::error::Error;
use std::io;
use std::result::Result;
fn do_some_io() -> Result<(), Box<Error + Send + Sync>> {
fn do_some_io() -> Result<(), Box<dyn Error + Send + Sync>> {
Err(io::Error::from(io::ErrorKind::NotFound))?;
Ok(())
}
fn func2() -> Result<(), Box<Error + Send + Sync>> {
fn func2() -> Result<(), Box<dyn Error + Send + Sync>> {
let filename = "foo.txt";
do_some_io().map_err(mstrerr!("Error reading '{}'", filename))?;
Ok(())
}
fn func1() -> Result<(), Box<Error + Send + Sync>> {
fn func1() -> Result<(), Box<dyn Error + Send + Sync>> {
func2().map_err(mstrerr!("func1 error"))?;
Ok(())
}
fn main() -> Result<(), Box<Error + Send + Sync>> {
fn main() -> Result<(), Box<dyn Error + Send + Sync>> {
if let Err(e) = func1() {
eprintln!("{:?}", e);
}

View file

@ -3,18 +3,18 @@ use std::error::Error;
use std::io;
use std::result::Result;
fn do_some_io() -> Result<(), Box<Error + Send + Sync>> {
fn do_some_io() -> Result<(), Box<dyn Error + Send + Sync>> {
Err(io::Error::from(io::ErrorKind::NotFound))?;
Ok(())
}
fn func2() -> Result<(), Box<Error + Send + Sync>> {
fn func2() -> Result<(), Box<dyn Error + Send + Sync>> {
let filename = "foo.txt";
do_some_io().map_err(mstrerr!("Error reading '{}'", filename))?;
Ok(())
}
fn func1() -> Result<(), Box<Error + Send + Sync>> {
fn func1() -> Result<(), Box<dyn Error + Send + Sync>> {
if let Err(e) = func2() {
if let Some(s) = e.source() {
eprintln!("func2 failed because of '{}'", s);
@ -24,7 +24,7 @@ fn func1() -> Result<(), Box<Error + Send + Sync>> {
Ok(())
}
fn main() -> Result<(), Box<Error + Send + Sync>> {
fn main() -> Result<(), Box<dyn Error + Send + Sync>> {
if let Err(e) = func1() {
eprintln!("{}", e);
}

View file

@ -3,26 +3,26 @@ use std::error::Error;
use std::io;
use std::result::Result;
fn do_some_io() -> Result<(), Box<Error + Send + Sync>> {
fn do_some_io() -> Result<(), Box<dyn Error + Send + Sync>> {
Err(io::Error::from(io::ErrorKind::NotFound))?;
Ok(())
}
fn func2() -> Result<(), Box<Error + Send + Sync>> {
fn func2() -> Result<(), Box<dyn Error + Send + Sync>> {
let filename = "foo.txt";
do_some_io().map_err(mstrerr!("Error reading '{}'", filename))?;
Ok(())
}
fn func1() -> Result<(), Box<Error + Send + Sync>> {
fn func1() -> Result<(), Box<dyn Error + Send + Sync>> {
func2().map_err(mstrerr!("func1 error"))?;
Ok(())
}
fn main() -> Result<(), Box<Error + Send + Sync>> {
fn main() -> Result<(), Box<dyn Error + Send + Sync>> {
if let Err(e) = func1() {
eprintln!("Error: {}", e);
let mut s : &(dyn Error) = e.as_ref();
let mut s: &(dyn Error) = e.as_ref();
while let Some(c) = s.source() {
if let Some(ioerror) = c.downcast_ref::<io::Error>() {
eprintln!("caused by: std::io::Error: {}", ioerror);

View file

@ -3,23 +3,23 @@ use std::error::Error;
use std::io;
use std::result::Result;
fn do_some_io() -> Result<(), Box<Error + Send + Sync>> {
fn do_some_io() -> Result<(), Box<dyn Error + Send + Sync>> {
Err(io::Error::from(io::ErrorKind::NotFound))?;
Ok(())
}
fn func2() -> Result<(), Box<Error + Send + Sync>> {
fn func2() -> Result<(), Box<dyn Error + Send + Sync>> {
let filename = "foo.txt";
do_some_io().map_err(mstrerr!("Error reading '{}'", filename))?;
Ok(())
}
fn func1() -> Result<(), Box<Error + Send + Sync>> {
fn func1() -> Result<(), Box<dyn Error + Send + Sync>> {
func2().map_err(mstrerr!("func1 error"))?;
Ok(())
}
fn main() -> Result<(), Box<Error + Send + Sync>> {
fn main() -> Result<(), Box<dyn Error + Send + Sync>> {
if let Err(e) = func1() {
eprintln!("Error: {}", e);
if let Some(s) = e.downcast_chain_ref::<String>() {

View file

@ -3,14 +3,14 @@ use std::error::Error;
use std::io;
use std::result::Result;
fn do_some_io() -> Result<(), Box<Error + Send + Sync>> {
fn do_some_io() -> Result<(), Box<dyn Error + Send + Sync>> {
Err(io::Error::from(io::ErrorKind::NotFound))?;
Ok(())
}
derive_str_cherr!(Func2Error);
fn func2() -> Result<(), Box<Error + Send + Sync>> {
fn func2() -> Result<(), Box<dyn Error + Send + Sync>> {
let filename = "foo.txt";
do_some_io().map_err(mstrerr!(Func2Error, "Error reading '{}'", filename))?;
Ok(())
@ -18,12 +18,12 @@ fn func2() -> Result<(), Box<Error + Send + Sync>> {
derive_str_cherr!(Func1Error);
fn func1() -> Result<(), Box<Error + Send + Sync>> {
fn func1() -> Result<(), Box<dyn Error + Send + Sync>> {
func2().map_err(mstrerr!(Func1Error, "func1 error"))?;
Ok(())
}
fn main() -> Result<(), Box<Error + Send + Sync>> {
fn main() -> Result<(), Box<dyn Error + Send + Sync>> {
if let Err(e) = func1() {
if let Some(f1err) = e.downcast_chain_ref::<Func1Error>() {
eprintln!("Func1Error: {}", f1err);

View file

@ -3,14 +3,14 @@ use std::error::Error;
use std::io;
use std::result::Result;
fn do_some_io() -> Result<(), Box<Error + Send + Sync>> {
fn do_some_io() -> Result<(), Box<dyn Error + Send + Sync>> {
Err(io::Error::from(io::ErrorKind::NotFound))?;
Ok(())
}
derive_str_cherr!(Func2Error);
fn func2() -> Result<(), Box<Error + Send + Sync>> {
fn func2() -> Result<(), Box<dyn Error + Send + Sync>> {
let filename = "foo.txt";
do_some_io().map_err(mstrerr!(Func2Error, "Error reading '{}'", filename))?;
Ok(())
@ -19,14 +19,14 @@ fn func2() -> Result<(), Box<Error + Send + Sync>> {
derive_str_cherr!(Func1ErrorFunc2);
derive_str_cherr!(Func1ErrorIO);
fn func1() -> Result<(), Box<Error + Send + Sync>> {
fn func1() -> Result<(), Box<dyn Error + Send + Sync>> {
func2().map_err(mstrerr!(Func1ErrorFunc2, "func1 error calling func2"))?;
let filename = "bar.txt";
do_some_io().map_err(mstrerr!(Func1ErrorIO, "Error reading '{}'", filename))?;
Ok(())
}
fn main() -> Result<(), Box<Error + Send + Sync>> {
fn main() -> Result<(), Box<dyn Error + Send + Sync>> {
if let Err(e) = func1() {
if let Some(s) = e.downcast_ref::<ChainError<Func1ErrorIO>>() {
eprintln!("Func1ErrorIO:\n{:?}", s);

View file

@ -32,18 +32,18 @@
//! use std::io;
//! use std::result::Result;
//!
//! fn do_some_io() -> Result<(), Box<Error + Send + Sync>> {
//! fn do_some_io() -> Result<(), Box<dyn Error + Send + Sync>> {
//! Err(io::Error::from(io::ErrorKind::NotFound))?;
//! Ok(())
//! }
//!
//! fn func2() -> Result<(), Box<Error + Send + Sync>> {
//! fn func2() -> Result<(), Box<dyn Error + Send + Sync>> {
//! let filename = "foo.txt";
//! do_some_io().map_err(mstrerr!("Error reading '{}'", filename))?;
//! Ok(())
//! }
//!
//! fn func1() -> Result<(), Box<Error + Send + Sync>> {
//! fn func1() -> Result<(), Box<dyn Error + Send + Sync>> {
//! func2().map_err(mstrerr!("func1 error"))?;
//! Ok(())
//! }
@ -74,12 +74,12 @@
//! use std::io;
//! use std::result::Result;
//!
//! fn do_some_io() -> Result<(), Box<Error + Send + Sync>> {
//! fn do_some_io() -> Result<(), Box<dyn Error + Send + Sync>> {
//! Err(io::Error::from(io::ErrorKind::NotFound))?;
//! Ok(())
//! }
//!
//! fn func3() -> Result<(), Box<Error + Send + Sync>> {
//! fn func3() -> Result<(), Box<dyn Error + Send + Sync>> {
//! let filename = "foo.txt";
//! do_some_io().map_err(mstrerr!("Error reading '{}'", filename))?;
//! Ok(())
@ -246,14 +246,14 @@ impl<T: 'static + Display + Debug> ChainError<T> {
/// use std::error::Error;
/// use std::io;
///
/// fn do_some_io() -> Result<(), Box<Error + Send + Sync>> {
/// fn do_some_io() -> Result<(), Box<dyn Error + Send + Sync>> {
/// Err(io::Error::from(io::ErrorKind::NotFound))?;
/// Ok(())
/// }
///
/// derive_str_cherr!(Func2Error);
///
/// fn func2() -> Result<(), Box<Error + Send + Sync>> {
/// fn func2() -> Result<(), Box<dyn Error + Send + Sync>> {
/// let filename = "foo.txt";
/// do_some_io().map_err(mstrerr!(Func2Error, "Error reading '{}'", filename))?;
/// Ok(())
@ -261,7 +261,7 @@ impl<T: 'static + Display + Debug> ChainError<T> {
///
/// derive_str_cherr!(Func1Error);
///
/// fn func1() -> Result<(), Box<Error + Send + Sync>> {
/// fn func1() -> Result<(), Box<dyn Error + Send + Sync>> {
/// func2().map_err(mstrerr!(Func1Error, "func1 error"))?;
/// Ok(())
/// }
@ -351,14 +351,14 @@ impl<T: 'static + Display + Debug> ChainError<T> {
/// use std::error::Error;
/// use std::io;
///
/// fn do_some_io() -> Result<(), Box<Error + Send + Sync>> {
/// fn do_some_io() -> Result<(), Box<dyn Error + Send + Sync>> {
/// Err(io::Error::from(io::ErrorKind::NotFound))?;
/// Ok(())
/// }
///
/// derive_str_cherr!(Func2Error);
///
/// fn func2() -> Result<(), Box<Error + Send + Sync>> {
/// fn func2() -> Result<(), Box<dyn Error + Send + Sync>> {
/// let filename = "foo.txt";
/// do_some_io().map_err(mstrerr!(Func2Error, "Error reading '{}'", filename))?;
/// Ok(())
@ -801,7 +801,7 @@ macro_rules! minto_cherr {
/// # }
/// # }
/// # }
/// fn do_some_stuff() -> Result<(), Box<Error + Send + Sync>> {
/// fn do_some_stuff() -> Result<(), Box<dyn Error + Send + Sync>> {
/// Err(io::Error::from(io::ErrorKind::NotFound))?;
/// Ok(())
/// }
@ -850,17 +850,17 @@ macro_rules! cherr {
/// # use std::error::Error;
/// # use std::io;
/// # use std::result::Result;
/// # fn do_some_io() -> Result<(), Box<Error + Send + Sync>> {
/// # fn do_some_io() -> Result<(), Box<dyn Error + Send + Sync>> {
/// # Err(io::Error::from(io::ErrorKind::NotFound))?;
/// # Ok(())
/// # }
/// fn func2() -> Result<(), Box<Error + Send + Sync>> {
/// fn func2() -> Result<(), Box<dyn Error + Send + Sync>> {
/// let filename = "foo.txt";
/// do_some_io().map_err(mstrerr!("Error reading '{}'", filename))?;
/// Ok(())
/// }
///
/// fn func1() -> Result<(), Box<Error + Send + Sync>> {
/// fn func1() -> Result<(), Box<dyn Error + Send + Sync>> {
/// func2().map_err(mstrerr!("func1 error"))?;
/// Ok(())
/// }
@ -891,13 +891,13 @@ macro_rules! cherr {
/// # use std::error::Error;
/// # use std::io;
/// # use std::result::Result;
/// # fn do_some_io() -> Result<(), Box<Error + Send + Sync>> {
/// # fn do_some_io() -> Result<(), Box<dyn Error + Send + Sync>> {
/// # Err(io::Error::from(io::ErrorKind::NotFound))?;
/// # Ok(())
/// # }
/// derive_str_cherr!(Func2Error);
///
/// fn func2() -> Result<(), Box<Error + Send + Sync>> {
/// fn func2() -> Result<(), Box<dyn Error + Send + Sync>> {
/// let filename = "foo.txt";
/// do_some_io().map_err(mstrerr!(Func2Error, "Error reading '{}'", filename))?;
/// Ok(())
@ -905,7 +905,7 @@ macro_rules! cherr {
///
/// derive_str_cherr!(Func1Error);
///
/// fn func1() -> Result<(), Box<Error + Send + Sync>> {
/// fn func1() -> Result<(), Box<dyn Error + Send + Sync>> {
/// func2().map_err(mstrerr!(Func1Error, "func1 error"))?;
/// Ok(())
/// }
@ -961,7 +961,7 @@ macro_rules! mstrerr {
///
/// derive_str_cherr!(Func1Error);
///
/// fn func1() -> Result<(), Box<Error>> {
/// fn func1() -> Result<(), Box<dyn Error>> {
/// func2().map_err(mstrerr!(Func1Error, "func1 error"))?;
/// Ok(())
/// }
@ -1009,7 +1009,7 @@ macro_rules! strerr {
/// # use std::error::Error;
/// # use std::io;
/// # use std::result::Result;
/// # fn do_some_io() -> Result<(), Box<Error + Send + Sync>> {
/// # fn do_some_io() -> Result<(), Box<dyn Error + Send + Sync>> {
/// # Err(io::Error::from(io::ErrorKind::NotFound))?;
/// # Ok(())
/// # }
@ -1023,7 +1023,7 @@ macro_rules! strerr {
///
/// derive_str_cherr!(Func1Error);
///
/// fn func1() -> Result<(), Box<Error>> {
/// fn func1() -> Result<(), Box<dyn Error>> {
/// func2().map_err(mstrerr!(Func1Error, "func1 error"))?;
/// Ok(())
/// }

View file

@ -4,7 +4,7 @@ use std::fmt::Write;
use std::io;
#[test]
fn test_iter() -> Result<(), Box<Error + Send + Sync>> {
fn test_iter() -> Result<(), Box<dyn Error + Send + Sync>> {
let err = io::Error::from(io::ErrorKind::NotFound);
let err = cherr!(err, "1");
let err = cherr!(err, "2");
@ -31,7 +31,7 @@ fn test_iter() -> Result<(), Box<Error + Send + Sync>> {
}
#[test]
fn test_find_cause() -> Result<(), Box<Error + Send + Sync>> {
fn test_find_cause() -> Result<(), Box<dyn Error + Send + Sync>> {
let err = io::Error::from(io::ErrorKind::NotFound);
let err = cherr!(err, "1");
let err = cherr!(err, "2");
@ -48,7 +48,7 @@ fn test_find_cause() -> Result<(), Box<Error + Send + Sync>> {
}
#[test]
fn test_root_cause() -> Result<(), Box<Error + Send + Sync>> {
fn test_root_cause() -> Result<(), Box<dyn Error + Send + Sync>> {
let err = io::Error::from(io::ErrorKind::NotFound);
let err = cherr!(err, "1");
let err = cherr!(err, "2");