From 67678ec39c53e43bc2077dd23e6026a9fba3f9eb Mon Sep 17 00:00:00 2001 From: Wolfgang Bumiller Date: Wed, 29 Sep 2021 12:39:51 +0200 Subject: [PATCH] add all autotraits to output_or_stdout trait object just in case we ever need any of them in async code that requires them and loses it because of accessing such a trait object... Signed-off-by: Wolfgang Bumiller --- pbs-tools/src/cli.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/pbs-tools/src/cli.rs b/pbs-tools/src/cli.rs index 069b23e2..62f17ac5 100644 --- a/pbs-tools/src/cli.rs +++ b/pbs-tools/src/cli.rs @@ -1,13 +1,16 @@ use std::fs::File; use std::io::{self, stdout, Write}; use std::path::Path; +use std::panic::{RefUnwindSafe, UnwindSafe}; /// Returns either a new file, if a path is given, or stdout, if no path is given. -pub fn outfile_or_stdout>(path: Option

) -> io::Result> { +pub fn outfile_or_stdout>( + path: Option

, +) -> io::Result> { if let Some(path) = path { let f = File::create(path)?; - Ok(Box::new(f) as Box) + Ok(Box::new(f) as Box<_>) } else { - Ok(Box::new(stdout()) as Box) + Ok(Box::new(stdout()) as Box<_>) } }