diff options
| author | WriterV2 <primary-v2@protonmail.com> | 2022-11-05 20:59:42 +0100 |
|---|---|---|
| committer | WriterV2 <primary-v2@protonmail.com> | 2022-11-05 20:59:42 +0100 |
| commit | c151561da778d4e7daf6fb42af7340ff604d7ba7 (patch) | |
| tree | e8ecbda57cef2e45723de0d74a54a2ba01b7569c /src/works/mod.rs | |
| parent | f78b274fe28d69464ead4c4fae50496c9cd19e55 (diff) | |
Remove redundant error handling depth
Diffstat (limited to 'src/works/mod.rs')
| -rw-r--r-- | src/works/mod.rs | 8 |
1 files 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<Self> { - 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 ) - })?) + }) } } |
