From 05e1555a9bee016ce480ea32720fbedfe332ec9a Mon Sep 17 00:00:00 2001 From: Greg Shuflin Date: Sun, 14 Nov 2021 03:07:58 -0800 Subject: [PATCH] Run rustfmt --- schala-lang/language/src/parsing/mod.rs | 2 +- schala-lang/language/src/parsing/new.rs | 7 ++----- schala-lang/language/src/schala.rs | 1 - 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/schala-lang/language/src/parsing/mod.rs b/schala-lang/language/src/parsing/mod.rs index 7d82575..e39915e 100644 --- a/schala-lang/language/src/parsing/mod.rs +++ b/schala-lang/language/src/parsing/mod.rs @@ -190,7 +190,7 @@ pub struct ParseError { impl ParseError { fn new_with_token(msg: M, token: Token) -> ParseResult where M: Into { - Err(ParseError { msg: msg.into(), location: Default::default(), token, }) + Err(ParseError { msg: msg.into(), location: Default::default(), token }) } } diff --git a/schala-lang/language/src/parsing/new.rs b/schala-lang/language/src/parsing/new.rs index 8069c9e..6a11995 100644 --- a/schala-lang/language/src/parsing/new.rs +++ b/schala-lang/language/src/parsing/new.rs @@ -22,10 +22,7 @@ impl Parser { Self { id_store: IdStore::new() } } - pub(crate) fn parse( - &mut self, - input: &str, - ) -> Result { + pub(crate) fn parse(&mut self, input: &str) -> Result { use peg::str::LineCol; schala_parser::program(input, self).map_err(|err: peg::error::ParseError| { @@ -190,7 +187,7 @@ peg::parser! { rule type_singleton_name() -> TypeSingletonName = name:identifier() params:type_params()? { TypeSingletonName { - name: rc_string(name), params: if let Some(params) = params { params } else { vec![] } + name: rc_string(name), params: if let Some(params) = params { params } else { vec![] } } } rule type_params() -> Vec = diff --git a/schala-lang/language/src/schala.rs b/schala-lang/language/src/schala.rs index 0413cc8..2e8e167 100644 --- a/schala-lang/language/src/schala.rs +++ b/schala-lang/language/src/schala.rs @@ -136,7 +136,6 @@ impl SourceReference { // (line_start, line_num, the string itself) pub fn get_line(&self, line: usize) -> (usize, usize, String) { - if self.newline_offsets.is_empty() { return (0, 0, self.last_source.as_ref().cloned().unwrap()); }