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 issue on Rust 1.75 #11492

Merged
merged 1 commit into from
Jan 4, 2024
Merged

Fix clippy issue on Rust 1.75 #11492

merged 1 commit into from
Jan 4, 2024

Conversation

mtreinish
Copy link
Member

Summary

With the recent release of Rust 1.75 there were some new clippy rules enabled. There was one minor usage issue highlighted in the new release. While we pin the rust version in CI when building and running clippy locally with the latest version this would trigger a failure. This commit fixes the one issue highlighted by clippy on Rust 1.75 which replaces Vec<T>.get(0) with Vec<T>.first().

Details and comments

With the recent release of Rust 1.75 there were some new clippy rules
enabled. There was one minor usage issue highlighted in the new release.
While we pin the rust version in CI when building and running clippy
locally with the latest version this would trigger a failure. This
commit fixes the one issue highlighted by clippy on Rust 1.75 which
replaces `Vec<T>.get(0)` with `Vec<T>.first()`.
@mtreinish mtreinish added type: qa Issues and PRs that relate to testing and code quality Changelog: None Do not include in changelog Rust This PR or issue is related to Rust code in the repository labels Jan 4, 2024
@mtreinish mtreinish requested a review from a team as a code owner January 4, 2024 20:47
@qiskit-bot
Copy link
Collaborator

One or more of the the following people are requested to review this:

jakelishman
jakelishman previously approved these changes Jan 4, 2024
Copy link
Member

@jakelishman jakelishman left a comment

Choose a reason for hiding this comment

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

I'm not wild about Clippy newly turning on subjective style stuff like this at deny-by-default, but it is what it is. Still good to make Clippy happy.

If we were MSRV 1.65+, we could have done this as a one-liner:

let Some(first_elem) = memory.first() else { return Ok(Vec::<String>::new().to_object(py)) };

but no let-else for us in 1.64 land.

@jakelishman jakelishman enabled auto-merge January 4, 2024 21:06
@coveralls
Copy link

coveralls commented Jan 4, 2024

Pull Request Test Coverage Report for Build 7414974491

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.002%) to 87.573%

Totals Coverage Status
Change from base Build 7414826659: -0.002%
Covered Lines: 59471
Relevant Lines: 67910

💛 - Coveralls

@mtreinish
Copy link
Member Author

If we were MSRV 1.65+, we could have done this as a one-liner:

See #11493 we can wait on that to merge first and then update this to use that

@jakelishman
Copy link
Member

Oh no need to change it - it's just another stylistic thing. It was only on my mind because I think let-else was one of the things we talked about when deciding between 1.64 and 1.65.

@jakelishman jakelishman added this pull request to the merge queue Jan 4, 2024
Merged via the queue into Qiskit:main with commit 6b1e846 Jan 4, 2024
15 checks passed
ShellyGarion pushed a commit to ShellyGarion/qiskit-terra that referenced this pull request Jan 18, 2024
With the recent release of Rust 1.75 there were some new clippy rules
enabled. There was one minor usage issue highlighted in the new release.
While we pin the rust version in CI when building and running clippy
locally with the latest version this would trigger a failure. This
commit fixes the one issue highlighted by clippy on Rust 1.75 which
replaces `Vec<T>.get(0)` with `Vec<T>.first()`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Changelog: None Do not include in changelog Rust This PR or issue is related to Rust code in the repository type: qa Issues and PRs that relate to testing and code quality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants