-
Notifications
You must be signed in to change notification settings - Fork 13
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
Fix rustfmt, clippy issues #87
Conversation
b71d09e
to
453035d
Compare
Also, add rustfmt and clippy to Github CI.
action-rs has been archived. Move to using dtolnay/rust-toolchain.
.github/workflows/ci.yml
Outdated
@@ -21,11 +21,9 @@ jobs: | |||
- name: Checkout repository | |||
uses: actions/checkout@v3 | |||
- name: Install Rust toolchain | |||
uses: actions-rs/toolchain@v1 | |||
uses: dtolnay/rust-toolchain@stable |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Leaving this version floating means we could get spontaneous failures starting at any point not triggered by a change :/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should be locked to a version, assuming that's possible.
- name: Run clippy | ||
run: source ~/.nvm/nvm.sh && cargo clippy --all-targets --all-features | ||
- name: Run rustfmt | ||
run: source ~/.nvm/nvm.sh && cargo fmt --all -- --check |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You shouldn't need the nvm.sh part for clippy and format runs, only for things that do a build. Do a clean and then try them without that part.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It failed without the nvm.sh. I initially tried without it and all CI jobs failed.
let status = Command::new("npm") | ||
.arg("install") | ||
.spawn()? | ||
.wait()?; | ||
if ! status.success() { | ||
let status = Command::new("npm").arg("install").spawn()?.wait()?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the kind of thing that's th downside to auto-formatting. This is worse formatting.
Also, add Github checks for rustfmt and clippy.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.