From c151561da778d4e7daf6fb42af7340ff604d7ba7 Mon Sep 17 00:00:00 2001 From: WriterV2 Date: Sat, 5 Nov 2022 20:59:42 +0100 Subject: Remove redundant error handling depth --- src/works/mod.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/works/mod.rs b/src/works/mod.rs index 8de16d7..6cb9331 100644 --- a/src/works/mod.rs +++ b/src/works/mod.rs @@ -8,9 +8,9 @@ pub trait Works: for<'a> Deserialize<'a> + Serialize { // create works from the corresponding JSON file, // e.g. stories from stories.json fn new_from_file(file: std::fs::File) -> Result { - Ok(serde_json::from_reader(std::io::BufReader::new(&file)) + serde_json::from_reader(std::io::BufReader::new(&file)) // add error context - .with_context(|| format!("Failed to create works from {:?}", &file))?) + .with_context(|| format!("Failed to create works from {:?}", &file)) } // crate tera context from the group of work @@ -28,7 +28,7 @@ pub trait Works: for<'a> Deserialize<'a> + Serialize { tera_instance: &tera::Tera, filename_without_extension: &str, ) -> Result<()> { - Ok(std::fs::write( + std::fs::write( format!("docs/{}.html", filename_without_extension).as_str(), tera_instance.render( format!("{}.html", filename_without_extension).as_str(), @@ -41,6 +41,6 @@ pub trait Works: for<'a> Deserialize<'a> + Serialize { "Failed to render overview page for {:?}", filename_without_extension ) - })?) + }) } } -- cgit v1.2.3