1 // compile-flags: --edition=2018
2 #![feature(no_coverage)]
5 ($msg:literal $(,)?) => {
11 return Err(String::from($msg));
15 macro_rules! on_error {
16 ($value:expr, $error_message:expr) => {
17 $value.or_else(|e| { // FIXME(85000): no coverage in closure macros
18 let message = format!($error_message, e);
19 if message.len() > 0 {
20 println!("{}", message);
21 Ok(String::from("ok"))
29 fn load_configuration_files() -> Result<String, String> {
30 Ok(String::from("config"))
33 pub fn main() -> Result<(), String> {
34 println!("Starting service");
35 let config = on_error!(load_configuration_files(), "Error loading configs: {}")?;
37 let startup_delay_duration = String::from("arg");
38 let _ = (config, startup_delay_duration);