From a390b21df18c61e07badcffb69351e451f608266 Mon Sep 17 00:00:00 2001 From: asonix Date: Sat, 22 Jul 2023 12:39:39 -0500 Subject: [PATCH] Make running pict-rs fluent --- src/lib.rs | 5 +++-- src/main.rs | 7 ++++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index a9b9a3a..96eae59 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1531,8 +1531,9 @@ impl PictRsConfiguration { /// /// This is probably not useful for 3rd party applications that install their own tracing /// subscribers. - pub fn install_tracing(&self) -> color_eyre::Result<()> { - init_tracing(&self.config.tracing) + pub fn install_tracing(self) -> color_eyre::Result { + init_tracing(&self.config.tracing)?; + Ok(self) } /// Run the pict-rs application diff --git a/src/main.rs b/src/main.rs index 58ec8c4..f4d2984 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,6 +1,7 @@ #[actix_rt::main] async fn main() -> color_eyre::Result<()> { - let pict_rs = pict_rs::PictRsConfiguration::build_default()?; - pict_rs.install_tracing()?; - pict_rs.run().await + pict_rs::PictRsConfiguration::build_default()? + .install_tracing()? + .run() + .await }