mirror of
https://github.com/haraldh/chainerror.git
synced 2025-01-31 00:56:41 +01:00
Harald Hoyer
165c1b939c
code is in this state by purpose Signed-off-by: Harald Hoyer <harald@hoyer.xyz>
30 lines
616 B
Rust
30 lines
616 B
Rust
#![allow(clippy::single_match)]
|
|
#![allow(clippy::redundant_pattern_matching)]
|
|
|
|
use std::error::Error;
|
|
use std::io;
|
|
use std::result::Result;
|
|
|
|
fn do_some_io() -> Result<(), Box<dyn Error + Send + Sync>> {
|
|
Err(io::Error::from(io::ErrorKind::NotFound))?;
|
|
Ok(())
|
|
}
|
|
|
|
fn func2() -> Result<(), Box<dyn Error + Send + Sync>> {
|
|
if let Err(_) = do_some_io() {
|
|
Err("func2 error")?;
|
|
}
|
|
Ok(())
|
|
}
|
|
|
|
fn func1() -> Result<(), Box<dyn Error + Send + Sync>> {
|
|
if let Err(_) = func2() {
|
|
Err("func1 error")?;
|
|
}
|
|
Ok(())
|
|
}
|
|
|
|
fn main() -> Result<(), Box<dyn Error + Send + Sync>> {
|
|
func1()
|
|
}
|