aboutsummaryrefslogtreecommitdiffstats
path: root/askama_derive/src/input.rs
diff options
context:
space:
mode:
authorLibravatar Dirkjan Ochtman <dirkjan@ochtman.nl>2018-06-21 12:19:54 +0200
committerLibravatar Dirkjan Ochtman <dirkjan@ochtman.nl>2018-06-21 12:19:54 +0200
commit31b90ccc657a5468de6bdffea8d309f502cd0d07 (patch)
tree5b5689f15dfb2cdcc27eca10ef39212dd18db4f2 /askama_derive/src/input.rs
parentf05a924c49afb537b624cfe3cbef3a95b13759a2 (diff)
downloadaskama-31b90ccc657a5468de6bdffea8d309f502cd0d07.tar.gz
askama-31b90ccc657a5468de6bdffea8d309f502cd0d07.tar.bz2
askama-31b90ccc657a5468de6bdffea8d309f502cd0d07.zip
Fix formatting with cargo fmt
Diffstat (limited to 'askama_derive/src/input.rs')
-rw-r--r--askama_derive/src/input.rs20
1 files changed, 12 insertions, 8 deletions
diff --git a/askama_derive/src/input.rs b/askama_derive/src/input.rs
index 6c631be..d835763 100644
--- a/askama_derive/src/input.rs
+++ b/askama_derive/src/input.rs
@@ -4,7 +4,6 @@ use std::path::{Path, PathBuf};
use syn;
-
pub struct TemplateInput<'a> {
pub ast: &'a syn::DeriveInput,
pub source: Source,
@@ -20,7 +19,10 @@ impl<'a> TemplateInput<'a> {
.iter()
.find(|a| a.interpret_meta().unwrap().name() == "template");
if attr.is_none() {
- panic!(format!("'template' attribute not found on struct '{}'", ast.ident));
+ panic!(format!(
+ "'template' attribute not found on struct '{}'",
+ ast.ident
+ ));
}
let attr = attr.unwrap();
@@ -75,18 +77,20 @@ impl<'a> TemplateInput<'a> {
match (&source, ext.is_some()) {
(&Source::Path(_), true) => {
panic!("'ext' attribute cannot be used with 'path' attribute")
- },
+ }
(&Source::Source(_), false) => {
panic!("must include 'ext' attribute when using 'source' attribute")
- },
- _ => {},
+ }
+ _ => {}
}
let escaping = match escaping {
Some(m) => m,
None => {
let ext = match source {
- Source::Path(ref p) =>
- Path::new(p).extension().map(|s| s.to_str().unwrap()).unwrap_or(""),
+ Source::Path(ref p) => Path::new(p)
+ .extension()
+ .map(|s| s.to_str().unwrap())
+ .unwrap_or(""),
Source::Source(_) => ext.as_ref().unwrap(), // Already panicked if None
};
if HTML_EXTENSIONS.contains(&ext) {
@@ -94,7 +98,7 @@ impl<'a> TemplateInput<'a> {
} else {
EscapeMode::None
}
- },
+ }
};
let path = match source {