Commit 90c85a7e authored by Hunter Goldstein's avatar Hunter Goldstein

Reformat, switch to `cargo fmt -- --check`

parent c14f6ab0
...@@ -8,6 +8,6 @@ cache: cargo ...@@ -8,6 +8,6 @@ cache: cargo
before_script: before_script:
- rustup component add rustfmt-preview - rustup component add rustfmt-preview
script: script:
- cargo fmt -- --write-mode=diff - cargo fmt -- --check
- cargo build - cargo build
- cargo test - cargo test
error_on_line_overflow = false error_on_line_overflow = false
max_width = 80 max_width = 80
write_mode = "overwrite"
wrap_comments = true wrap_comments = true
...@@ -146,24 +146,27 @@ pub fn tokenize(input: &str) -> Result<Vec<Token>, CalcError> { ...@@ -146,24 +146,27 @@ pub fn tokenize(input: &str) -> Result<Vec<Token>, CalcError> {
} else { } else {
match c.check_operator() { match c.check_operator() {
OperatorState::Complete => { OperatorState::Complete => {
tokens.push(c tokens.push(
.operator_type() c.operator_type().ok_or_else(|| InvalidOperator(c))?,
.ok_or_else(|| InvalidOperator(c))?); );
chars.next(); chars.next();
} }
OperatorState::PotentiallyIncomplete => { OperatorState::PotentiallyIncomplete => {
chars.next(); chars.next();
match chars.peek() { match chars.peek() {
Some(&next_char) if next_char.is_operator() => { Some(&next_char) if next_char.is_operator() => {
tokens.push([c, next_char] tokens.push(
.operator_type() [c, next_char]
.ok_or_else(|| InvalidOperator(c))?); .operator_type()
.ok_or_else(|| InvalidOperator(c))?,
);
chars.next(); chars.next();
} }
_ => { _ => {
tokens.push(c tokens.push(
.operator_type() c.operator_type()
.ok_or_else(|| InvalidOperator(c))?); .ok_or_else(|| InvalidOperator(c))?,
);
} }
} }
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment