Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
calc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
11
Issues
11
List
Boards
Labels
Service Desk
Milestones
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
redox-os
calc
Commits
90c85a7e
Commit
90c85a7e
authored
Jun 02, 2018
by
Hunter Goldstein
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reformat, switch to `cargo fmt -- --check`
parent
c14f6ab0
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
11 deletions
+13
-11
.travis.yml
.travis.yml
+1
-1
rustfmt.toml
rustfmt.toml
+0
-1
src/token.rs
src/token.rs
+12
-9
No files found.
.travis.yml
View file @
90c85a7e
...
...
@@ -8,6 +8,6 @@ cache: cargo
before_script
:
-
rustup component add rustfmt-preview
script
:
-
cargo fmt -- --
write-mode=diff
-
cargo fmt -- --
check
-
cargo build
-
cargo test
rustfmt.toml
View file @
90c85a7e
error_on_line_overflow
=
false
max_width
=
80
write_mode
=
"overwrite"
wrap_comments
=
true
src/token.rs
View file @
90c85a7e
...
...
@@ -146,24 +146,27 @@ pub fn tokenize(input: &str) -> Result<Vec<Token>, CalcError> {
}
else
{
match
c
.check_operator
()
{
OperatorState
::
Complete
=>
{
tokens
.push
(
c
.operator_type
()
.ok_or_else
(||
InvalidOperator
(
c
))
?
);
tokens
.push
(
c
.operator_type
()
.ok_or_else
(||
InvalidOperator
(
c
))
?
,
);
chars
.next
();
}
OperatorState
::
PotentiallyIncomplete
=>
{
chars
.next
();
match
chars
.peek
()
{
Some
(
&
next_char
)
if
next_char
.is_operator
()
=>
{
tokens
.push
([
c
,
next_char
]
.operator_type
()
.ok_or_else
(||
InvalidOperator
(
c
))
?
);
tokens
.push
(
[
c
,
next_char
]
.operator_type
()
.ok_or_else
(||
InvalidOperator
(
c
))
?
,
);
chars
.next
();
}
_
=>
{
tokens
.push
(
c
.operator_type
()
.ok_or_else
(||
InvalidOperator
(
c
))
?
);
tokens
.push
(
c
.operator_type
()
.ok_or_else
(||
InvalidOperator
(
c
))
?
,
);
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment