Hi! I'm trying to implement a CI pipeline for a project, and seeing different behavior in my rustfmt
step than I see locally.
Here's what my GitHub Actions workflow looks like:
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true
default: true
components: rustfmt, clippy
- name: Rust version
run: |
rustup --version && cargo --version && cargo fmt --version && cargo clippy --version && \
cargo tarpaulin --version
- name: Lint and format
run: |
cargo fmt --check --verbose
cargo clippy --all-targets --all-features
And this is the result:
rustup 1.26.0 (5af9b9484 2023-04-05)
info: This is the version for the rustup toolchain manager, not the rustc compiler.
info: The currently active `rustc` version is `rustc 1.70.0 (90c541806 2023-05-31)`
cargo 1.70.0 (ec8a8a0ca 2023-04-25)
rustfmt 1.5.2-stable (90c5418 2023-05-31)
clippy 0.1.70 (90c5418 2023-05-31)
cargo-tarpaulin version: 0.26.1
...
[example (2021)] "/home/runner/work/clio-auth/clio-auth/examples/auth0.rs"
[lib (2021)] "/home/runner/work/clio-auth/clio-auth/src/lib.rs"
rustfmt --edition 2021 --check /home/runner/work/clio-auth/clio-auth/examples/auth0.rs /home/runner/work/clio-auth/clio-auth/src/lib.rs
Diff in /home/runner/work/clio-auth/clio-auth/examples/auth0.rs at line 56:
token_result.unwrap_err()
);
}
- },
+ }
Err(e) => warn!("👎 uh oh! {:?}", e),
};
info!("🏁 finished!");
Diff in /home/runner/work/clio-auth/clio-auth/src/server.rs at line 68:
.header("Connection", "close")
.body(body)
.unwrap()
- },
+ }
None => Response::builder()
.status(400)
.header("Connection", "close")
Error: Process completed with exit code 1.
If I run the same commands locally:
$ rustup --version && cargo --version && cargo fmt --version && cargo clippy --version && \
cargo tarpaulin --version
rustup 1.26.0 (5af9b9484 2023-04-05)
info: This is the version for the rustup toolchain manager, not the rustc compiler.
info: The currently active `rustc` version is `rustc 1.70.0 (90c541806 2023-05-31)`
cargo 1.70.0 (ec8a8a0ca 2023-04-25)
rustfmt 1.5.2-stable (90c54180 2023-05-31)
clippy 0.1.70 (90c54180 2023-05-31)
cargo-tarpaulin version: 0.26.1
...
$ cargo fmt --check --verbose
[example (2021)] "/Users/ericmcintyre/Development/src/clio-auth/examples/auth0.rs"
[lib (2021)] "/Users/ericmcintyre/Development/src/clio-auth/src/lib.rs"
rustfmt --edition 2021 --check /Users/ericmcintyre/Development/src/clio-auth/examples/auth0.rs /Users/ericmcintyre/Development/src/clio-auth/src/lib.rs
The tool versions are identical. I have no local changes in my workspace. The only difference I can see is OS (macOS locally, Ubuntu in GitHub). Can anyone help me understand why rustfmt
is reporting different results?