mirror of
https://git.proxmox.com/git/rustc
synced 2025-08-16 04:52:40 +00:00
27 lines
481 B
Rust
27 lines
481 B
Rust
#[macro_use]
|
|
extern crate failure;
|
|
|
|
use failure::Error;
|
|
|
|
fn bailer() -> Result<(), Error> {
|
|
// bail!("ruh roh");
|
|
bail!("ruh {}", "roh");
|
|
}
|
|
|
|
fn ensures() -> Result<(), Error> {
|
|
ensure!(true, "true is false");
|
|
ensure!(false, "false is false");
|
|
Ok(())
|
|
}
|
|
|
|
fn main() {
|
|
match bailer() {
|
|
Ok(_) => println!("ok"),
|
|
Err(e) => println!("{}", e),
|
|
}
|
|
match ensures() {
|
|
Ok(_) => println!("ok"),
|
|
Err(e) => println!("{}", e),
|
|
}
|
|
}
|