Skip to content
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

Simplify rustfmt config and switch to stable rustfmt #242

Merged
merged 2 commits into from
Jan 11, 2022

Conversation

davepacheco
Copy link
Collaborator

See #77 for lots of background. About a year ago, we switched to a simpler stable-only rustfmt config in omicron to try it out. That's been going well. It's time to apply that here, too.

This change:

  • updates the rustfmt config file to match Omicron's
  • updates the GitHub actions config to stop specifying a specific nightly for rustfmt
  • updates the documentation
  • reformats all code to match the new config (just by running cargo fmt)

This has a (trivial) conflict with #139 so I've based this on #139 because I expect that to land shortly. I've set the branch to "pin-toolchain" to make the diff easier to read.

Base automatically changed from pin-toolchain to main January 10, 2022 22:41
@@ -1,8 +0,0 @@
{
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ahl I believe it's correct to remove this file now. I think we did the same for omicron when we switch to stable rustfmt.

@@ -14,17 +14,12 @@ jobs:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@230611dbd0eb52da1e1f4f7bc8bb0c3a339fc8b7
- uses: actions-rs/toolchain@88dc2356392166efad76775c878094f4e83ff746
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@zephraph I think this change is correct -- we don't have to specify this action any more in this job, right?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought this action was just to get access to any rust toolchain, and we needed:

  • "nightly-2021-03-25" here, and
  • "Whatever is in the rust-toolchain.toml" file below

But it seems like, based on the "checks" output, we actually happen to be downloading the version we need (specified in the rust-toolchain.toml) on the first call to cargo --version.

Checking my understanding: With this new change, are we just relying on whatever happens to be installed on Github's default ubuntu-18.04 image to bootstrap?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't believe we're relying on whatever happens to be installed because we have a rust-toolchain file in the repo.

Copy link
Collaborator Author

@davepacheco davepacheco Jan 10, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To expand on that: the Actions environment, at least for Ubuntu 18.04, includes Rust 1.57. I believe this is updated pretty regularly when a new Rust release comes out. So this will likely already be the right thing when this runs. But if it's not (e.g., if they've updated to 1.58 and we have not yet updated our rust-toolchain file), then the Rust that is installed by default will honor the rust-toolchain file like it always does, installing the specified toolchain and running the rest of the build with it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, that's what I meant by "bootstrap" in my comment above. Sounds reasonable, if we expect that'll always exist in the Actions environment across our supported test systems.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that's right. It's documented to be present in the Actions environments for Ubuntu, Windows, and Mac. I would imagine it would be a pretty big breaking change if it were removed. If it were, we could add this action back.

We might also add the action back if we wanted to override rust-toolchain to do builds with nightly or beta or some other stable (e.g., a MSRV).

@davepacheco davepacheco changed the title Simplify rustfmt config and switch to stable "rustfmt" Simplify rustfmt config and switch to stable rustfmt Jan 10, 2022
@davepacheco davepacheco merged commit 913f9a4 into main Jan 11, 2022
@davepacheco davepacheco deleted the rustfmt-simpler branch January 11, 2022 04:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants