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

Satisfy clippy 1.67 beta. #2326

Merged
merged 9 commits into from
Jan 16, 2023
Merged

Satisfy clippy 1.67 beta. #2326

merged 9 commits into from
Jan 16, 2023

Conversation

xStrom
Copy link
Member

@xStrom xStrom commented Jan 10, 2023

Clippy lints addressed:

@xStrom xStrom added maintenance cleans up code or docs S-needs-review waits for review labels Jan 10, 2023
Copy link
Collaborator

@jneem jneem left a comment

Choose a reason for hiding this comment

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

It looks like there are still some warnings in druid/src/env.rs and druid-shell/examples/invalidate.rs

@xStrom xStrom added S-blocked waits for another PR or dependency and removed S-needs-review waits for review labels Jan 10, 2023
@xStrom
Copy link
Member Author

xStrom commented Jan 10, 2023

Yeah there are even some more, which I'll also handle.

However the more serious issue is that there is an infinite loop of clippy with the beta toolchain.

warning: variables can be used directly in the `format!` string
   --> druid\src\widget\flex.rs:619:13
    |
619 | /             debug_assert!(
620 | |                 flex >= 0.0,
621 | |                 "flex value for space should be greater than equal to 0, received: {}",
622 | |                 flex
623 | |             );
    | |_____________^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#uninlined_format_args
    = note: `#[warn(clippy::uninlined_format_args)]` on by default

into

warning: panic message contains an unused formatting placeholder
   --> druid\src\widget\flex.rs:621:84
    |
621 |                 "flex value for space should be greater than equal to 0, received: {flex}"
    |                                                                                    ^^^^^^
    |
    = note: this message is not used as a format string when given without arguments, but will be in Rust 2021
    = note: `#[warn(non_fmt_panics)]` on by default
help: add the missing argument
    |
621 |                 "flex value for space should be greater than equal to 0, received: {flex}", ...
    |                                                                                           +++++
help: or add a "{}" format string to use the message literally
    |
621 |                 "{}", "flex value for space should be greater than equal to 0, received: {flex}"
    |                 +++++

I will investigate it tomorrow. Perhaps just updating the edition will solve the issue. However I feel clippy shouldn't recommend fixes that it itself will immediately complain about.

@xStrom
Copy link
Member Author

xStrom commented Jan 12, 2023

Okay, so with the beta clippy both assert! and debug_assert! are incorrectly handled with Rust 2018. This was already fixed in rust-clippy#10055 and has landed in nightly, but it's unclear to me if it will arrive with stable 1.67 or some future version.

I think we might be able to just upgrade to Rust 2021 and get around this issue. I'll see if I can make it happen.

@xStrom xStrom added S-needs-review waits for review and removed S-blocked waits for another PR or dependency labels Jan 16, 2023
@xStrom
Copy link
Member Author

xStrom commented Jan 16, 2023

Alright, this is ready for another look. It solves all clippy errors now.

Copy link
Collaborator

@jneem jneem left a comment

Choose a reason for hiding this comment

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

🎉

@xStrom xStrom merged commit bac8dd8 into linebender:master Jan 16, 2023
@xStrom xStrom deleted the clippy167beta branch January 16, 2023 14:36
@xStrom xStrom removed the S-needs-review waits for review label Jan 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
maintenance cleans up code or docs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants