shtola

ssg in rust
git clone https://tilde.team/~marisa/repo/shtola.git
Log | Files | Refs | LICENSE

commit 77f13cb3ff36457b2a02cc5e125d019e8a347595
parent e87fa32275c5cc8f8aa96feeb44ebb476c396537
Author: marisa <mokou@posteo.de>
Date:   Thu,  7 Nov 2019 17:44:03 +0100

Run Rustfmt

Diffstat:
A.rustfmt.toml | 1+
Mshtola/src/frontmatter.rs | 5+----
Mshtola/src/lib.rs | 26++++++++++++++++----------
Mware/src/lib.rs | 6++++--
4 files changed, 22 insertions(+), 16 deletions(-)

diff --git a/.rustfmt.toml b/.rustfmt.toml @@ -0,0 +1 @@ +hard_tabs = true diff --git a/shtola/src/frontmatter.rs b/shtola/src/frontmatter.rs @@ -12,10 +12,7 @@ pub fn lexer(text: &str) -> (String, String) { content_slice.trim().to_string(), ) } else { - ( - String::new(), - text.to_string(), - ) + (String::new(), text.to_string()) } } diff --git a/shtola/src/lib.rs b/shtola/src/lib.rs @@ -1,12 +1,13 @@ -use ware::Ware; -use im::HashMap; -use walkdir::WalkDir; -use yaml_rust::Yaml; use pathdiff::diff_paths; -use std::path::PathBuf; -use std::fs::{File, canonicalize}; -use std::io::Read; use std::default::Default; +use std::fs::{canonicalize, File}; +use std::io::Read; +use std::path::PathBuf; +use walkdir::WalkDir; + +pub use im::HashMap; +pub use ware::Ware; +pub use yaml_rust::Yaml; mod frontmatter; @@ -18,8 +19,14 @@ pub struct Shtola { impl Shtola { pub fn new() -> Shtola { let config: Config = Default::default(); - let ir = IR { files: HashMap::new(), config }; - Shtola { ware: Ware::new(), ir } + let ir = IR { + files: HashMap::new(), + config, + }; + Shtola { + ware: Ware::new(), + ir, + } } pub fn ignores(&mut self, vec: &mut Vec<PathBuf>) { @@ -72,7 +79,6 @@ pub struct Config { frontmatter: bool, } - #[derive(Debug, Clone)] pub struct ShFile { frontmatter: Vec<Yaml>, diff --git a/ware/src/lib.rs b/ware/src/lib.rs @@ -120,8 +120,10 @@ impl<R, S> Ware2<R, S> { /// Run the registered middleware functions with the given value to pass /// through. Returns whatever the last registered middleware function /// returns. - pub fn run (&self, arg1: R, arg2: S) -> (R, S) { - self.fns.iter().fold((arg1, arg2), |acc, func| func(acc.0, acc.1)) + pub fn run(&self, arg1: R, arg2: S) -> (R, S) { + self.fns + .iter() + .fold((arg1, arg2), |acc, func| func(acc.0, acc.1)) } }