Skip to content

Commit 9468b65

Browse files
committed
Run cargo fmt.
1 parent c74cd90 commit 9468b65

File tree

1 file changed

+13
-17
lines changed

1 file changed

+13
-17
lines changed

parser/src/lexer.rs

+13-17
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
pub use super::token::Tok;
55
use num_bigint::BigInt;
66
use num_traits::Num;
7+
use std::cmp::Ordering;
78
use std::collections::HashMap;
89
use std::str::FromStr;
9-
use std::cmp::Ordering;
1010

1111
#[derive(Clone, Copy, PartialEq, Debug)]
1212
struct IndentationLevel {
@@ -16,10 +16,7 @@ struct IndentationLevel {
1616

1717
impl IndentationLevel {
1818
fn new() -> IndentationLevel {
19-
IndentationLevel {
20-
tabs: 0,
21-
spaces: 0,
22-
}
19+
IndentationLevel { tabs: 0, spaces: 0 }
2320
}
2421
fn compare_strict(&self, other: &IndentationLevel) -> Option<Ordering> {
2522
// We only know for sure that we're smaller or bigger if tabs
@@ -37,7 +34,6 @@ impl IndentationLevel {
3734
} else {
3835
None
3936
}
40-
4137
} else {
4238
Some(self.spaces.cmp(&other.spaces))
4339
}
@@ -620,7 +616,7 @@ where
620616
Some(' ') => {
621617
self.next_char();
622618
spaces += 1;
623-
},
619+
}
624620
Some('\t') => {
625621
if spaces != 0 {
626622
// Don't allow tabs after spaces as part of indentation.
@@ -630,7 +626,7 @@ where
630626
}
631627
self.next_char();
632628
tabs += 1;
633-
},
629+
}
634630
Some('#') => {
635631
self.lex_comment();
636632
self.at_begin_of_line = true;
@@ -649,10 +645,7 @@ where
649645
}
650646
}
651647

652-
let indentation_level = IndentationLevel {
653-
spaces,
654-
tabs,
655-
};
648+
let indentation_level = IndentationLevel { spaces, tabs };
656649

657650
if self.nesting == 0 {
658651
// Determine indent or dedent:
@@ -661,7 +654,7 @@ where
661654
match ordering {
662655
Some(Ordering::Equal) => {
663656
// Same same
664-
},
657+
}
665658
Some(Ordering::Greater) => {
666659
// New indentation level:
667660
self.indentation_stack.push(indentation_level);
@@ -674,18 +667,21 @@ where
674667
// Pop off other levels until col is found:
675668

676669
loop {
677-
let ordering = indentation_level.compare_strict(self.indentation_stack.last().unwrap());
670+
let ordering = indentation_level
671+
.compare_strict(self.indentation_stack.last().unwrap());
678672
match ordering {
679673
Some(Ordering::Less) => {
680674
self.indentation_stack.pop();
681675
let tok_start = self.get_pos();
682676
let tok_end = tok_start.clone();
683677
self.pending.push(Ok((tok_start, Tok::Dedent, tok_end)));
684-
},
685-
None => panic!("inconsistent use of tabs and spaces in indentation"),
678+
}
679+
None => {
680+
panic!("inconsistent use of tabs and spaces in indentation")
681+
}
686682
_ => {
687683
break;
688-
},
684+
}
689685
};
690686
}
691687

0 commit comments

Comments
 (0)