aboutsummaryrefslogtreecommitdiff
path: root/src/archiver
diff options
context:
space:
mode:
Diffstat (limited to 'src/archiver')
-rw-r--r--src/archiver/gemini.rs4
-rw-r--r--src/archiver/gopher.rs4
-rw-r--r--src/archiver/mod.rs4
3 files changed, 6 insertions, 6 deletions
diff --git a/src/archiver/gemini.rs b/src/archiver/gemini.rs
index f4df9f8..edc6219 100644
--- a/src/archiver/gemini.rs
+++ b/src/archiver/gemini.rs
@@ -1,6 +1,6 @@
use crate::template::{Context, find, parse};
use std::fs::write;
-use std::io::{Error, ErrorKind::Other, Result};
+use std::io::{Error, Result};
use std::path::Path;
const FILENAME: &str = "index.gmi";
@@ -13,7 +13,7 @@ pub fn archive(
) -> Result<()> {
if let Some(template) = find(template_directory, FILENAME) {
let parsed_template = parse(&template)
- .ok_or_else(|| Error::new(Other, "Unable to parse Gemini Archive template"))?;
+ .ok_or_else(|| Error::other("Unable to parse Gemini Archive template"))?;
let rendered_template = parsed_template.render(context)?;
let location = target.join(FILENAME);
write(location, rendered_template)?;
diff --git a/src/archiver/gopher.rs b/src/archiver/gopher.rs
index 8c37022..39b54cb 100644
--- a/src/archiver/gopher.rs
+++ b/src/archiver/gopher.rs
@@ -1,6 +1,6 @@
use crate::template::{Context, find, parse};
use std::fs::write;
-use std::io::{Error, ErrorKind::Other, Result};
+use std::io::{Error, Result};
use std::path::Path;
const FILENAME: &str = "index.gph";
@@ -13,7 +13,7 @@ pub fn archive(
) -> Result<()> {
if let Some(template) = find(template_directory, FILENAME) {
let parsed_template = parse(&template)
- .ok_or_else(|| Error::new(Other, "Unable to parse Gopher Archive template"))?;
+ .ok_or_else(|| Error::other("Unable to parse Gopher Archive template"))?;
let rendered_template = parsed_template.render(context)?;
let location = target.join(FILENAME);
write(location, rendered_template)?;
diff --git a/src/archiver/mod.rs b/src/archiver/mod.rs
index db3a841..a0655a4 100644
--- a/src/archiver/mod.rs
+++ b/src/archiver/mod.rs
@@ -5,7 +5,7 @@ mod raw;
use crate::template::{Context, Value};
use std::collections::HashMap;
use std::fs::read_dir;
-use std::io::{Error, ErrorKind, Result};
+use std::io::{Error, Result};
use std::path::{Path, PathBuf};
use time::{OffsetDateTime, format_description::FormatItem, macros::format_description};
@@ -30,7 +30,7 @@ impl ArchiveEntry {
let archive_length: u64 = archive_entries
.len()
.try_into()
- .map_err(|_| Error::new(ErrorKind::Other, "Too many items in the archive."))?;
+ .map_err(|_| Error::other("Too many items in the archive."))?;
context.insert(
"archive_length".to_string(),
Value::Unsigned(archive_length),