Run rustfmt

This commit is contained in:
Greg Shuflin 2021-11-14 03:07:58 -08:00
parent 4b0aced11f
commit 05e1555a9b
3 changed files with 3 additions and 7 deletions

View File

@ -190,7 +190,7 @@ pub struct ParseError {
impl ParseError {
fn new_with_token<T, M>(msg: M, token: Token) -> ParseResult<T>
where M: Into<String> {
Err(ParseError { msg: msg.into(), location: Default::default(), token, })
Err(ParseError { msg: msg.into(), location: Default::default(), token })
}
}

View File

@ -22,10 +22,7 @@ impl Parser {
Self { id_store: IdStore::new() }
}
pub(crate) fn parse(
&mut self,
input: &str,
) -> Result<AST, ParseError> {
pub(crate) fn parse(&mut self, input: &str) -> Result<AST, ParseError> {
use peg::str::LineCol;
schala_parser::program(input, self).map_err(|err: peg::error::ParseError<LineCol>| {
@ -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<TypeIdentifier> =

View File

@ -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());
}