Skip to content

Run nightly Clippy over the Ruff repo#5670

Merged
charliermarsh merged 1 commit intomainfrom
charlie/clippy
Jul 11, 2023
Merged

Run nightly Clippy over the Ruff repo#5670
charliermarsh merged 1 commit intomainfrom
charlie/clippy

Conversation

@charliermarsh
Copy link
Member

Summary

This is the result of running cargo +nightly clippy --workspace --all-targets --all-features -- -D warnings and fixing all violations. Just wanted to see if there were any interesting new checks on nightly 👀

@charliermarsh charliermarsh added the internal An internal refactor or improvement label Jul 11, 2023
)
.chain(
// Include all star imports.
block.import_from_star.into_iter(),
Copy link
Member Author

Choose a reason for hiding this comment

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

(Calling .into_inter() on a method that accepts IntoIter.)

Copy link
Member

@zanieb zanieb left a comment

Choose a reason for hiding this comment

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

Seems reasonable. It'd be cool to automate this but if it can't autofix most of the violations it seems tricky.

@github-actions
Copy link
Contributor

github-actions bot commented Jul 11, 2023

PR Check Results

Ecosystem

✅ ecosystem check detected no changes.

Benchmark

Linux

group                                      main                                   pr
-----                                      ----                                   --
formatter/large/dataset.py                 1.00      7.9±0.01ms     5.1 MB/sec    1.01      8.0±0.03ms     5.1 MB/sec
formatter/numpy/ctypeslib.py               1.00   1814.1±2.19µs     9.2 MB/sec    1.00   1815.9±1.62µs     9.2 MB/sec
formatter/numpy/globals.py                 1.00    204.3±3.15µs    14.4 MB/sec    1.00    204.0±0.58µs    14.5 MB/sec
formatter/pydantic/types.py                1.01      4.0±0.00ms     6.4 MB/sec    1.00      3.9±0.02ms     6.5 MB/sec
linter/all-rules/large/dataset.py          1.00     13.5±0.06ms     3.0 MB/sec    1.01     13.6±0.04ms     3.0 MB/sec
linter/all-rules/numpy/ctypeslib.py        1.00      3.4±0.01ms     4.9 MB/sec    1.01      3.4±0.00ms     4.9 MB/sec
linter/all-rules/numpy/globals.py          1.00    435.7±0.77µs     6.8 MB/sec    1.00    437.6±0.68µs     6.7 MB/sec
linter/all-rules/pydantic/types.py         1.00      6.0±0.02ms     4.2 MB/sec    1.01      6.1±0.01ms     4.2 MB/sec
linter/default-rules/large/dataset.py      1.00      6.7±0.03ms     6.0 MB/sec    1.03      6.9±0.01ms     5.9 MB/sec
linter/default-rules/numpy/ctypeslib.py    1.00   1491.9±3.70µs    11.2 MB/sec    1.02   1521.2±2.80µs    10.9 MB/sec
linter/default-rules/numpy/globals.py      1.00    171.6±3.04µs    17.2 MB/sec    1.01    172.9±0.30µs    17.1 MB/sec
linter/default-rules/pydantic/types.py     1.00      3.1±0.02ms     8.3 MB/sec    1.03      3.1±0.01ms     8.1 MB/sec

Windows

group                                      main                                   pr
-----                                      ----                                   --
formatter/large/dataset.py                 1.00     10.9±0.22ms     3.7 MB/sec    1.01     11.0±0.17ms     3.7 MB/sec
formatter/numpy/ctypeslib.py               1.01      2.4±0.08ms     6.8 MB/sec    1.00      2.4±0.05ms     6.8 MB/sec
formatter/numpy/globals.py                 1.00    274.1±8.41µs    10.8 MB/sec    1.02   278.3±14.46µs    10.6 MB/sec
formatter/pydantic/types.py                1.00      5.3±0.10ms     4.8 MB/sec    1.02      5.5±0.10ms     4.7 MB/sec
linter/all-rules/large/dataset.py          1.04     19.4±1.09ms     2.1 MB/sec    1.00     18.7±0.72ms     2.2 MB/sec
linter/all-rules/numpy/ctypeslib.py        1.07      5.3±0.40ms     3.2 MB/sec    1.00      4.9±0.06ms     3.4 MB/sec
linter/all-rules/numpy/globals.py          1.00   606.4±21.17µs     4.9 MB/sec    1.00   605.0±23.78µs     4.9 MB/sec
linter/all-rules/pydantic/types.py         1.03      9.0±0.62ms     2.8 MB/sec    1.00      8.8±0.46ms     2.9 MB/sec
linter/default-rules/large/dataset.py      1.00      9.3±0.22ms     4.4 MB/sec    1.04      9.7±0.22ms     4.2 MB/sec
linter/default-rules/numpy/ctypeslib.py    1.00  1980.0±39.07µs     8.4 MB/sec    1.01  1997.6±41.77µs     8.3 MB/sec
linter/default-rules/numpy/globals.py      1.01    237.3±5.79µs    12.4 MB/sec    1.00    234.1±6.97µs    12.6 MB/sec
linter/default-rules/pydantic/types.py     1.00      4.2±0.10ms     6.1 MB/sec    1.01      4.2±0.09ms     6.0 MB/sec

@charliermarsh
Copy link
Member Author

Eventually these rules will make it out of nightly and into subsequent Rust releases, at which point we'll be able to incorporate them into our existing Clippy checks for free :)

@charliermarsh charliermarsh merged commit 4dee49d into main Jul 11, 2023
@charliermarsh charliermarsh deleted the charlie/clippy branch July 11, 2023 03:44
@MichaReiser
Copy link
Member

Uhm what. No approve button on github mobile 🧐 Approve

@dhruvmanila
Copy link
Member

Uhm what. No approve button on github mobile 🧐 Approve

It's hidden inside the file section > "Review Changes" button ;)

Copy link
Member

@MichaReiser MichaReiser left a comment

Choose a reason for hiding this comment

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

Damn, I never hit Submit on these comments

}
SerializationFormat::Junit => {
JunitEmitter::default().emit(writer, &diagnostics.messages, &context)?;
JunitEmitter.emit(writer, &diagnostics.messages, &context)?;
Copy link
Member

Choose a reason for hiding this comment

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

Hmm, this will be somewhat annoying if we ever add instance fields. You then need to update all usages.

>;
fn into_format(self) -> Self::Format {
FormatOwnedWithRule::new(self, crate::module::mod_module::FormatModModule::default())
FormatOwnedWithRule::new(self, crate::module::mod_module::FormatModModule)
Copy link
Member

Choose a reason for hiding this comment

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

I wouldn't change the generated file. Some rules have fields and thus require using default. Having different usages for different rules will make it annoying to generate the code

Or is calling default explicitly not required?

Copy link
Member

Choose a reason for hiding this comment

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

I'm gonna revert the generated changes. See #5804 for why

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

internal An internal refactor or improvement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants