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

Support both old and new rust toolchains simultaneously (clippy conversion related) #1106

Merged
merged 4 commits into from
Jul 23, 2020

Conversation

dennisschagt
Copy link
Member

No description provided.

Minoru added 3 commits July 16, 2020 22:20
These appeared with Rust 1.45.
This ensures no surprises where new Rust release introduces some new
Clippy lints and breaks our build. We"re now in full control of what
versions we run in CI, and can update on our own schedule.
@coveralls
Copy link

coveralls commented Jul 22, 2020

Coverage Status

Coverage decreased (-0.01%) to 57.534% when pulling 02c1c2a on dennisschagt:dennis/fix-CI into 974207a on newsboat:master.

@dennisschagt dennisschagt requested a review from Minoru July 22, 2020 19:06
@dennisschagt
Copy link
Member Author

@Minoru: I think my latest commit makes it possible to drop a1cee13.
Let me know if you want me to try that.

Also, feel free to make any changes yourself to this branch or just cherry-pick my commit onto your existing PR.

Copy link
Member

@Minoru Minoru left a comment

Choose a reason for hiding this comment

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

That"s neat! I couldn"t imagine that there"s a lint to disable warnings about unknown lints :)

I"m in two minds about this. On one hand, this lets people with older toolchains run Clippy locally and see just the warnings that they introduced. On the other hand, we have no way of knowing when to drop the old lint for good, so they"ll just keep piling up. Also, anyone who suppresses a Clippy warning might need to implement this trick too, which implies they need to know about it.

I have no way of knowing which side is objectively better, so let"s err on the side of compatibility for now: please drop a1cee13, see CI pass here, and merge this. After all, I can always re-visit this decision if it ends up causing trouble.

Thanks for working on this!

old: clippy::identity_conversion (needed before 1.45.0)
new: clippy::useless_conversion options (needed since 1.45.0)

clippy::unknown_clippy_lints is needed for old toolchains to ignore
clippy::useless_conversion.

renamed_and_removed_lints is needed for new toolchains to ignore renamed
clippy::identity_conversion.
@dennisschagt
Copy link
Member Author

I"m in two minds about this. On one hand, this lets people with older toolchains run Clippy locally and see just the warnings that they introduced. On the other hand, we have no way of knowing when to drop the old lint for good, so they"ll just keep piling up. Also, anyone who suppresses a Clippy warning might need to implement this trick too, which implies they need to know about it.

Somewhere in the future we might be able to use something like the following instead of those 4 lines:

#[cfg_attr(version("1.45.0"), allow(clippy::useless_conversion))]
#[cfg_attr(not(version("1.45.0")), allow(clippy::identity_conversion))]

but it depends on rust-lang/rfcs#2523 which is not yet implemented (rust-lang/rust#64796).

It might also be possible to use cfg_attr by manually adding an attribute/feature when running clippy but I don"t really know how/where to do that.

@dennisschagt dennisschagt merged commit 71f77f2 into newsboat:master Jul 23, 2020
@dennisschagt dennisschagt deleted the dennis/fix-CI branch July 23, 2020 13:10
@Minoru Minoru added this to the 2.21 milestone Sep 20, 2020
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