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

fix(clippy): Resolve some lifetime and reference lints #4578

Merged
merged 4 commits into from
Jun 14, 2022
Merged

Conversation

teor2345
Copy link
Contributor

@teor2345 teor2345 commented Jun 7, 2022

Motivation

Clippy has some new lints on nightly, we should resolve them to avoid subtle bugs.

Solution

  • Fix significant drop in match scrutinee by copying (small) values
  • Fix deref immutable value
  • Fix get(0) when first() works and is clearer

Review

Anyone can review this PR, it is optional.

Reviewer Checklist

  • Existing tests pass

@teor2345 teor2345 added A-rust Area: Updates to Rust code C-cleanup Category: This is a cleanup P-Optional ✨ labels Jun 7, 2022
@teor2345 teor2345 self-assigned this Jun 7, 2022
@teor2345 teor2345 requested review from a team as code owners June 7, 2022 03:20
@teor2345 teor2345 requested review from upbqdn and removed request for a team June 7, 2022 03:20
@codecov
Copy link

codecov bot commented Jun 7, 2022

Codecov Report

Merging #4578 (f97f41a) into main (2e50ccc) will decrease coverage by 0.08%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main    #4578      +/-   ##
==========================================
- Coverage   78.84%   78.75%   -0.09%     
==========================================
  Files         304      304              
  Lines       37318    37330      +12     
==========================================
- Hits        29423    29400      -23     
- Misses       7895     7930      +35     

Copy link
Contributor

@dconnolly dconnolly left a comment

Choose a reason for hiding this comment

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

📎🖇️🦀

zebra-chain/src/transparent/serialize.rs Show resolved Hide resolved
@upbqdn
Copy link
Member

upbqdn commented Jun 8, 2022

I was wondering about the significant_drop_in_scrutinee lint, and here's a good explanation https://rust-lang.github.io/rust-clippy/master/index.html#significant_drop_in_scrutinee.

@teor2345
Copy link
Contributor Author

@Mergifyio update

@mergify
Copy link
Contributor

mergify bot commented Jun 14, 2022

update

✅ Branch has been successfully updated

mergify bot added a commit that referenced this pull request Jun 14, 2022
@mergify mergify bot merged commit 3825caa into main Jun 14, 2022
@mergify mergify bot deleted the clippy-match branch June 14, 2022 06:21
upbqdn pushed a commit that referenced this pull request Jun 14, 2022
* Fix significant drop in match scrutinee

rust-lang/rust#93883

* Fix deref immutable value

* Fix explicit 0 index when first() would do

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-rust Area: Updates to Rust code C-cleanup Category: This is a cleanup
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants