From afbae12b7298cf7befcef6060548a7762bf7c411 Mon Sep 17 00:00:00 2001 From: Joe Ling - uni laptop Date: Mon, 13 Jul 2020 15:39:14 +0100 Subject: [PATCH] fixed formatting --- src/lib.rs | 7 +++---- src/main.rs | 4 ++-- src/parse/function.rs | 2 +- src/parse/import.rs | 23 +++++++++++------------ src/parse/keyframes.rs | 4 ++-- src/parse/mixin.rs | 4 ++-- src/parse/mod.rs | 10 +++++----- src/parse/value/parse.rs | 2 +- src/value/mod.rs | 2 +- 9 files changed, 28 insertions(+), 30 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index fa33776..d33a754 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -250,11 +250,10 @@ pub fn from_string(p: String) -> std::result::Result { .map_err(|e| raw_to_parse_error(&map, *e).to_string())?) } - #[cfg_attr(feature = "profiling", inline(never))] #[cfg_attr(not(feature = "profiling"), inline)] #[cfg(not(feature = "wasm"))] -pub fn from_path_with_load_paths(p: &str, loadpaths: Vec<&Path>) -> Result { +pub fn from_path_with_load_paths(p: &str, loadpaths: &Vec<&Path>) -> Result { let mut map = CodeMap::new(); let file = map.add_file(p.into(), String::from_utf8(fs::read(p)?)?); let empty_span = file.span.subspan(0, 0); @@ -276,7 +275,7 @@ pub fn from_path_with_load_paths(p: &str, loadpaths: Vec<&Path>) -> Result) -> Result std::io::Result<()> { if let Some(path) = matches.value_of("OUTPUT") { let mut buf = BufWriter::new(File::open(path).unwrap_or(File::create(path)?)); buf.write_all( - from_path_with_load_paths(name, vals) + from_path_with_load_paths(name, &vals) .unwrap_or_else(|e| { eprintln!("{}", e); std::process::exit(1) @@ -203,7 +203,7 @@ fn main() -> std::io::Result<()> { } else { let mut stdout = BufWriter::new(stdout()); stdout.write_all( - from_path_with_load_paths(name, vals) + from_path_with_load_paths(name, &vals) .unwrap_or_else(|e| { eprintln!("{}", e); std::process::exit(1) diff --git a/src/parse/function.rs b/src/parse/function.rs index 0721b21..7b47892 100644 --- a/src/parse/function.rs +++ b/src/parse/function.rs @@ -107,7 +107,7 @@ impl<'a> Parser<'a> { at_root_has_selector: self.at_root_has_selector, extender: self.extender, content_scopes: self.content_scopes, - load_paths: self.load_paths + load_paths: self.load_paths, } .parse()?; diff --git a/src/parse/import.rs b/src/parse/import.rs index 8ad84a8..4176005 100644 --- a/src/parse/import.rs +++ b/src/parse/import.rs @@ -97,24 +97,23 @@ impl<'a> Parser<'a> { } } - for _path in self.load_paths { + for path in self.load_paths { let paths; - if _path.is_dir() { + if path.is_dir() { paths = vec![ - _path.join(format!("{}.scss", name.to_str().unwrap())), - _path.join(format!("_{}.scss", name.to_str().unwrap())), - _path.join("index.scss"), - _path.join("_index.scss"), + path.join(format!("{}.scss", name.to_str().unwrap())), + path.join(format!("_{}.scss", name.to_str().unwrap())), + path.join("index.scss"), + path.join("_index.scss"), ]; } else { paths = vec![ - _path.to_path_buf(), - _path.with_file_name(name).with_extension("scss"), - _path - .with_file_name(format!("_{}", name.to_str().unwrap())) + path.to_path_buf(), + path.with_file_name(name).with_extension("scss"), + path.with_file_name(format!("_{}", name.to_str().unwrap())) .with_extension("scss"), - _path.join("index.scss"), - _path.join("_index.scss"), + path.join("index.scss"), + path.join("_index.scss"), ]; } diff --git a/src/parse/keyframes.rs b/src/parse/keyframes.rs index b6db525..f647de2 100644 --- a/src/parse/keyframes.rs +++ b/src/parse/keyframes.rs @@ -165,7 +165,7 @@ impl<'a> Parser<'a> { at_root_has_selector: self.at_root_has_selector, extender: self.extender, content_scopes: self.content_scopes, - load_paths: self.load_paths + load_paths: self.load_paths, }) .parse_keyframes_selector()?; @@ -196,7 +196,7 @@ impl<'a> Parser<'a> { at_root_has_selector: self.at_root_has_selector, extender: self.extender, content_scopes: self.content_scopes, - load_paths: self.load_paths + load_paths: self.load_paths, } .parse_stmt()?; diff --git a/src/parse/mixin.rs b/src/parse/mixin.rs index fcad98c..95709c9 100644 --- a/src/parse/mixin.rs +++ b/src/parse/mixin.rs @@ -154,7 +154,7 @@ impl<'a> Parser<'a> { at_root_has_selector: self.at_root_has_selector, extender: self.extender, content_scopes: self.content_scopes, - load_paths: self.load_paths + load_paths: self.load_paths, } .parse()?; @@ -206,7 +206,7 @@ impl<'a> Parser<'a> { at_root_has_selector: self.at_root_has_selector, extender: self.extender, content_scopes: self.scopes, - load_paths: self.load_paths + load_paths: self.load_paths, } .parse()? } else { diff --git a/src/parse/mod.rs b/src/parse/mod.rs index 7db9ef1..f6a0556 100644 --- a/src/parse/mod.rs +++ b/src/parse/mod.rs @@ -361,7 +361,7 @@ impl<'a> Parser<'a> { at_root_has_selector: self.at_root_has_selector, extender: self.extender, content_scopes: self.content_scopes, - load_paths: self.load_paths + load_paths: self.load_paths, }, allows_parent, true, @@ -600,7 +600,7 @@ impl<'a> Parser<'a> { at_root_has_selector: self.at_root_has_selector, extender: self.extender, content_scopes: self.content_scopes, - load_paths: self.load_paths + load_paths: self.load_paths, } .parse_stmt()?; @@ -668,7 +668,7 @@ impl<'a> Parser<'a> { at_root_has_selector, extender: self.extender, content_scopes: self.content_scopes, - load_paths: self.load_paths + load_paths: self.load_paths, } .parse()? .into_iter() @@ -709,7 +709,7 @@ impl<'a> Parser<'a> { at_root_has_selector: self.at_root_has_selector, extender: self.extender, content_scopes: self.content_scopes, - load_paths: self.load_paths + load_paths: self.load_paths, } .parse_selector(false, true, String::new())?; @@ -787,7 +787,7 @@ impl<'a> Parser<'a> { at_root_has_selector: self.at_root_has_selector, extender: self.extender, content_scopes: self.content_scopes, - load_paths: self.load_paths + load_paths: self.load_paths, } .parse_stmt()?; diff --git a/src/parse/value/parse.rs b/src/parse/value/parse.rs index 7c44737..58fb2c0 100644 --- a/src/parse/value/parse.rs +++ b/src/parse/value/parse.rs @@ -201,7 +201,7 @@ impl<'a> Parser<'a> { at_root_has_selector: self.at_root_has_selector, extender: self.extender, content_scopes: self.content_scopes, - load_paths: self.load_paths + load_paths: self.load_paths, } .parse_value(in_paren) } diff --git a/src/value/mod.rs b/src/value/mod.rs index 0b9b149..29aba66 100644 --- a/src/value/mod.rs +++ b/src/value/mod.rs @@ -476,7 +476,7 @@ impl Value { at_root_has_selector: parser.at_root_has_selector, extender: parser.extender, content_scopes: parser.content_scopes, - load_paths: parser.load_paths + load_paths: parser.load_paths, } .parse_selector(allows_parent, true, String::new()) }