New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor `match` statements #522

Merged
merged 1 commit into from Sep 8, 2017

Conversation

Projects
None yet
2 participants
@nivkner
Contributor

nivkner commented Sep 8, 2017

The original problem I had was that when trying to compile a6e0e86 was that I got errors such as:

error: expected one of `,`, `.`, `?`, or `}`, found `Err`
  --> src/shell/assignments.rs:70:33
   |
69 |                                 }
   |                                  - expected one of `,`, `.`, `?`, or `}` here
70 |                                 Err(why) => {
   |                                 ^^^ unexpected token

The cause of it might have been the inner match's {} being confused for a multi-line match arm.

I have no idea how that slipped by, since its a syntax error. I deleted and cloned the repository again just in case; still got the same error.

Instead of simply adding , at the end, I decided refactor the methods to avoid such problems altogether.

This PR addresses readability issues, such as unnecessary nested matchs, variable names being used multiple times for different items, or functions being used outside of the match statement as though independent of the outcome, despite only happening in the first arm's case.

@mmstick

This comment has been minimized.

Collaborator

mmstick commented Sep 8, 2017

Are you using the nightly toolchain? Rustfmt formats code in a way that's incompatible with stable at the moment.

@mmstick mmstick merged commit ad24a24 into redox-os:master Sep 8, 2017

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment