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

Set MSRV for clippy in rustworkx #793

Merged
merged 1 commit into from
Jan 27, 2023
Merged

Conversation

mtreinish
Copy link
Member

Starting in the recently released Rust 1.67.0 clippy enabled a new rule by default, uninlined_format_args [1], which warns when format!() is used and a variable is not put in the string inline but isntead as a separate argument in the macro. For example, format!("{}", foo) Instead the rule suggests using the variable inline the format call (e.g. format!("{foo}"). However, with our msrv of 1.56.1 this syntax was not supported. So trying to fix the places the rule is triggered as suggested will fail to compile with rust 1.56.1. To address this and solve this for future rust releases and potential new rules this commit adds a clippy.toml file which sets the msrv for the rustworkx crate This will by default disable rules that weren't on by default in rust 1.56.1.

[1] https://rust-lang.github.io/rust-clippy/master/index.html#uninlined_format_args

Starting in the recently released Rust 1.67.0 clippy enabled a new rule
by default, uninlined_format_args [1], which warns when format!() is
used and a variable is not put in the string inline but isntead as a
separate argument in the macro. For example, `format!("{}", foo)`
Instead the rule suggests using the variable inline the format call
(e.g. `format!("{foo}")`. However, with our msrv of 1.56.1
this syntax was not supported. So trying to fix the places the rule is
triggered as suggested will fail to compile with rust 1.56.1. To address
this and solve this for future rust releases and potential new rules this
commit adds a clippy.toml file which sets the msrv for the rustworkx crate
This will by default disable rules that weren't on by default in rust
1.56.1.

[1] https://rust-lang.github.io/rust-clippy/master/index.html#uninlined_format_args
Copy link
Collaborator

@IvanIsCoding IvanIsCoding left a comment

Choose a reason for hiding this comment

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

Seems straightfoward to me.

@coveralls
Copy link

Pull Request Test Coverage Report for Build 4020032791

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • 8 unchanged lines in 1 file lost coverage.
  • Overall coverage decreased (-0.04%) to 96.956%

Files with Coverage Reduction New Missed Lines %
rustworkx-core/src/min_scored.rs 8 63.64%
Totals Coverage Status
Change from base Build 4010384973: -0.04%
Covered Lines: 13760
Relevant Lines: 14192

💛 - Coveralls

Copy link
Collaborator

@IvanIsCoding IvanIsCoding left a comment

Choose a reason for hiding this comment

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

Also, for future reference: when we upgrade our MSRV, we should delete that file and just use rust-version in Cargo.toml: https://doc.rust-lang.org/cargo/reference/manifest.html#the-rust-version-field

Both the compiler and Clippy detect that field. I find too many config files a bit confusing.

@mtreinish mtreinish merged commit d8ad84a into Qiskit:main Jan 27, 2023
@mtreinish mtreinish deleted the fix-clippy-67 branch January 27, 2023 20:40
IvanIsCoding pushed a commit that referenced this pull request Feb 27, 2023
Starting in the recently released Rust 1.67.0 clippy enabled a new rule
by default, uninlined_format_args [1], which warns when format!() is
used and a variable is not put in the string inline but isntead as a
separate argument in the macro. For example, `format!("{}", foo)`
Instead the rule suggests using the variable inline the format call
(e.g. `format!("{foo}")`. However, with our msrv of 1.56.1
this syntax was not supported. So trying to fix the places the rule is
triggered as suggested will fail to compile with rust 1.56.1. To address
this and solve this for future rust releases and potential new rules this
commit adds a clippy.toml file which sets the msrv for the rustworkx crate
This will by default disable rules that weren't on by default in rust
1.56.1.

[1] https://rust-lang.github.io/rust-clippy/master/index.html#uninlined_format_args
mergify bot added a commit that referenced this pull request Feb 27, 2023
* Fix Matplotlib warning when building docs (#820)

Fix the warning in the docs because of matplotlib.cm deprecations.

(cherry picked from commit 50c3968)

* Fix clippy with Rust 1.66.0 (#762)

The recent release of Rust 1.66.0 [1] added new on by default clippy rules
which are causing failures when we run the clippy CI job with the new
rust version. This commit updates the code to fix the issues that clippy
has identified which will unblock CI.

[1] https://blog.rust-lang.org/2022/12/15/Rust-1.66.0.html

* Set MSRV for clippy in rustworkx (#793)

Starting in the recently released Rust 1.67.0 clippy enabled a new rule
by default, uninlined_format_args [1], which warns when format!() is
used and a variable is not put in the string inline but isntead as a
separate argument in the macro. For example, `format!("{}", foo)`
Instead the rule suggests using the variable inline the format call
(e.g. `format!("{foo}")`. However, with our msrv of 1.56.1
this syntax was not supported. So trying to fix the places the rule is
triggered as suggested will fail to compile with rust 1.56.1. To address
this and solve this for future rust releases and potential new rules this
commit adds a clippy.toml file which sets the msrv for the rustworkx crate
This will by default disable rules that weren't on by default in rust
1.56.1.

[1] https://rust-lang.github.io/rust-clippy/master/index.html#uninlined_format_args

* Pin tox version used in CI to < 4.0.0 (#761)

The most recent tox release, 4.0.0, is a major rewrite of the internals
of tox and several things behave quite differently. This new release
is causing CI jobs to fail as something in incompatible with our tox
configuration. This commit pins the tox version we're using in CI to
unblock things until we can update the tox configuration to be
compatible with both the new and old versions of tox.

---------

Co-authored-by: Ivan Carvalho <8753214+IvanIsCoding@users.noreply.github.com>
Co-authored-by: Matthew Treinish <mtreinish@kortar.org>
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.

None yet

3 participants