Skip to content

Commit

Permalink
update formatting for rustfmt
Browse files Browse the repository at this point in the history
  • Loading branch information
sgodwincs committed Jan 30, 2018
1 parent 50392c2 commit f6883e5
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 28 deletions.
46 changes: 24 additions & 22 deletions src/lexer/mod.rs
Expand Up @@ -364,9 +364,10 @@ impl<'input> Lexer<'input> {
self.chars.next();
Some(Ok((start, Token::Ellipsis, start + 3)))
}
_ => Some(Err(
create_error(LexicalErrorCode::ExpectedEllipsis, start + 2),
)),
_ => Some(Err(create_error(
LexicalErrorCode::ExpectedEllipsis,
start + 2,
))),
}
}

Expand Down Expand Up @@ -415,9 +416,10 @@ impl<'input> Lexer<'input> {
float_lex_state = FloatLexState::ImmediatelyAfterExponentBase;
}
_ if float_literal.starts_with("-.") => {
return Some(Err(
create_error(LexicalErrorCode::ExpectedDecimalDigit, offset),
))
return Some(Err(create_error(
LexicalErrorCode::ExpectedDecimalDigit,
offset,
)))
}
_ => {
return Some(Ok((
Expand Down Expand Up @@ -507,9 +509,11 @@ impl<'input> Lexer<'input> {
_ => {
let hexadecimal_literal =
i64::from_str_radix(&*hexadecimal_literal, 16).unwrap();
return Some(Ok(
(start, Token::IntegerLiteral(hexadecimal_literal), offset),
));
return Some(Ok((
start,
Token::IntegerLiteral(hexadecimal_literal),
offset,
)));
}
}
},
Expand All @@ -525,11 +529,11 @@ impl<'input> Lexer<'input> {
fn lex_identifier(&mut self, offset: &mut usize, mut identifier: &mut String) {
loop {
match self.chars.peek() {
Some(&(_, c @ 'A'...'Z')) |
Some(&(_, c @ 'a'...'z')) |
Some(&(_, c @ '0'...'9')) |
Some(&(_, c @ '_')) |
Some(&(_, c @ '-')) => {
Some(&(_, c @ 'A'...'Z'))
| Some(&(_, c @ 'a'...'z'))
| Some(&(_, c @ '0'...'9'))
| Some(&(_, c @ '_'))
| Some(&(_, c @ '-')) => {
self.push_next_char(&mut identifier, c, offset);
}
_ => break,
Expand Down Expand Up @@ -659,9 +663,11 @@ impl<'input> Lexer<'input> {
if c > '7' {
if !self.lookahead_for_decimal_point() {
let literal = i64::from_str_radix(&*literal, 8).unwrap();
return Some(
Ok((start, Token::IntegerLiteral(literal), offset)),
);
return Some(Ok((
start,
Token::IntegerLiteral(literal),
offset,
)));
}

self.push_next_char(&mut literal, c, &mut offset);
Expand Down Expand Up @@ -1231,11 +1237,7 @@ mod test {
assert_lex(
r#""this is a string""#,
vec![
Ok((
0,
Token::StringLiteral("this is a string".to_string()),
18,
)),
Ok((0, Token::StringLiteral("this is a string".to_string()), 18)),
],
);
assert_lex(
Expand Down
12 changes: 6 additions & 6 deletions tests/parse_test.rs
Expand Up @@ -49,9 +49,9 @@ fn parse_includes() {
vec![
Definition::Includes(Includes {
extended_attributes: vec![
Box::new(ExtendedAttribute::NoArguments(
Other::Identifier("test".to_string()),
)),
Box::new(ExtendedAttribute::NoArguments(Other::Identifier(
"test".to_string(),
))),
],
includee: "B".to_string(),
includer: "A".to_string(),
Expand Down Expand Up @@ -81,9 +81,9 @@ fn parse_mixin() {
vec![
Definition::Mixin(Mixin::Partial(PartialMixin {
extended_attributes: vec![
Box::new(ExtendedAttribute::NoArguments(
Other::Identifier("test".to_string()),
)),
Box::new(ExtendedAttribute::NoArguments(Other::Identifier(
"test".to_string(),
))),
],
members: vec![
MixinMember::Attribute(Attribute::Regular(RegularAttribute {
Expand Down

0 comments on commit f6883e5

Please sign in to comment.