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

chore: replace assert!(matches!(...)) with assert_matches!(...) #2723

Merged
merged 6 commits into from
Aug 28, 2024

Conversation

pbeza
Copy link
Collaborator

@pbeza pbeza commented Aug 23, 2024

What ❔

Replace assert!(matches!(...)) with assert_matches!(...).

Why ❔

To make the code more idiomatic.

Checklist

  • PR title corresponds to the body of PR (we generate changelog entries from PRs).
  • Tests for the changes have been added / updated.
  • Documentation comments have been added / updated.
  • Code has been formatted via zk fmt and zk lint.

@pbeza pbeza marked this pull request as ready for review August 23, 2024 12:51
@pbeza pbeza force-pushed the pab/lint-assert-nit branch 5 times, most recently from f27cca3 to abf741f Compare August 23, 2024 15:14
@pbeza
Copy link
Collaborator Author

pbeza commented Aug 23, 2024

I didn't know we disallow unstable features:

error: use of an unstable feature
 --> core/lib/types/src/lib.rs:7:12
  |
7 | #![feature(assert_matches)]
  |            ^^^^^^^^^^^^^^
  |
  = note: requested on the command line with `-D unstable-features`

so I give up this PR for now. Waiting for assert_matches! to become a standard Rust feature. It's amazing how long people can debate over what seems like trivial features. :P

@pbeza pbeza requested a review from popzxc August 23, 2024 16:09
@popzxc
Copy link
Member

popzxc commented Aug 26, 2024

I didn't know we disallow unstable features

@pbeza We do. We only use nightly because we're forced to (crypto deps), but we want to eventually get back to stable. Any nightly feature makes it harder.

However, we have assert_matches in our dependency tree already, so you can simply add it to dev-dependencies.

@pbeza
Copy link
Collaborator Author

pbeza commented Aug 27, 2024

Fixed 🫡 @popzxc, PTAL

popzxc
popzxc previously approved these changes Aug 28, 2024
@haraldh haraldh added this pull request to the merge queue Aug 28, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Aug 28, 2024
@pbeza
Copy link
Collaborator Author

pbeza commented Aug 28, 2024

@popzxc, this PR was removed from the merge queue due to failed status checks:

running unit tests with 'cargo nextest run --release '
error: duplicate key `workspace` in table `dev-dependencies`
  --> core/lib/multivm/Cargo.toml:45:1
   |
45 | assert_matches.workspace = true
   | ^
   |
error: failed to load manifest for workspace member `/usr/src/zksync/core/bin/block_reverter`
referenced by workspace at `/usr/src/zksync/Cargo.toml`

It doesn't make sense for me – there is no duplicate there. What am I missing here?

@popzxc
Copy link
Member

popzxc commented Aug 28, 2024

@pbeza assert_matches was just added to the multivm deps by another PR that got merged before yours.
Merge main, resolve the issue, and push.

@popzxc popzxc enabled auto-merge August 28, 2024 12:11
@popzxc popzxc added this pull request to the merge queue Aug 28, 2024
Merged via the queue into main with commit 268e66f Aug 28, 2024
48 checks passed
@popzxc popzxc deleted the pab/lint-assert-nit branch August 28, 2024 12:41
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.

2 participants