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

Clippyup #97248

Merged
merged 127 commits into from
May 21, 2022
Merged

Clippyup #97248

merged 127 commits into from
May 21, 2022

Conversation

xFrednet
Copy link
Member

@xFrednet xFrednet commented May 21, 2022

This direction was simpler. All test Clippy pass locally 🙃

r? @Manishearth

Serial-ATA and others added 30 commits April 26, 2022 18:21
Fixes issue where ranges containing ints with different signs would be
incorrect due to comparing as unsigned.
Previously, the `cast_lossless` lint would issue a warning on code that
converted a `usize` value to `f64`, on 32-bit targets.

`usize` to `f64` is a lossless cast on 32-bit targets, however there is
no corresponding `f64::from` that takes a `usize`, so `cast_lossless`'s
suggested replacement does not compile.

This PR disables the lint in the case of casting from `usize` or `isize`.

Fixes rust-lang#3689.

changelog: [`cast_lossless`] no longer gives wrong suggestion on usize->f64
This reverts commit bb01aca.

Partial: Keep regression tests
Adds the missing line to cast-slice-different-sizes lint documentation
/closes 8781
Added missing `### What it does`

Adds the missing line to ``[`cast-slice-different-sizes`]`` lint documentation
fixes rust-lang#8781

changelog: none
Lint `empty_lint_after_outer_attr` on argumentless macros

Reverts the change from 034c81b as it's no longer needed. The test is left just in case. Original issue is rust-lang#2475.

changelog: Lint `empty_lint_after_outer_attr` on argumentless macros again
Fix `cast_lossless` to avoid warning on `usize` to `f64` conversion.

Previously, the `cast_lossless` lint would issue a warning on code that
converted a `usize` value to `f64`, on 32-bit targets.

`usize` to `f64` is a lossless cast on 32-bit targets, however there is
no corresponding `f64::from` that takes a `usize`, so `cast_lossless`'s
suggested replacement does not compile.

This PR disables the lint in the case of casting from `usize` or `isize`.

Fixes rust-lang#3689.

changelog: [`cast_lossless`] no longer gives wrong suggestion on usize,isize->f64
-Zast-json is being removed shortly: rust-lang#85993.
ast-tree does essentially the same thing, and still works today even before that PR lands.
For check_range_bounds return type.
Suggest -Zunpretty=ast-tree instead of -Zast-json

-Zast-json is being removed shortly: rust-lang#85993.
ast-tree does essentially the same thing, and still works today even before that PR lands.

changelog: none
Support negative ints in manual_range_contains

fixes: rust-lang#8721
changelog: Fixes issue where ranges containing ints with different signs would be
incorrect due to comparing as unsigned.
Pass through extra args in `cargo dev lint`

changelog: Pass through extra args in `cargo dev lint`

Lets you pass some useful flags through, like `-A/W/etc`, `--fix`, `--force-warn`
Allow inline consts to reference generic params

Tracking issue: rust-lang#76001

The RFC says that inline consts cannot reference to generic parameters (for now), same as array length expressions. And expresses that it's desirable for it to reference in-scope generics, when array length expressions gain that feature as well.

However it is possible to implement this for inline consts before doing this for all anon consts, because inline consts are only used as values and they won't be used in the type system. So we can have:
```rust
fn foo<T>() {
    let x = [4i32; std::mem::size_of::<T>()];   // NOT ALLOWED (for now)
    let x = const { std::mem::size_of::<T>() }; // ALLOWED with this PR!
    let x = [4i32; const { std::mem::size_of::<T>() }];   // NOT ALLOWED (for now)
}
```

This would make inline consts super useful for compile-time checks and assertions:
```rust
fn assert_zst<T>() {
    const { assert!(std::mem::size_of::<T>() == 0) };
}
```

This would create an error during monomorphization when `assert_zst` is instantiated with non-ZST `T`s. A error during mono might sound scary, but this is exactly what a "desugared" inline const would do:
```rust
fn assert_zst<T>() {
    struct F<T>(T);
    impl<T> F<T> {
        const V: () = assert!(std::mem::size_of::<T>() == 0);
    }
    let _ = F::<T>::V;
}
```

It should also be noted that the current inline const implementation can already reference the type params via type inference, so this resolver-level restriction is not any useful either:
```rust
fn foo<T>() -> usize {
    let (_, size): (PhantomData<T>, usize) = const {
        const fn my_size_of<T>() -> (PhantomData<T>, usize) {
            (PhantomData, std::mem::size_of::<T>())
        }
        my_size_of()
    };
    size
}
```

```@rustbot``` label: F-inline_const
…-rustc-typeck, r=cjgillot

Remove ItemLikeVisitor impls from rustc_typeck

Issue rust-lang#95004
cc `@cjgillot`
author Preston From <[email protected]> 1645164142 -0600
committer Preston From <[email protected]> 1650005351 -0600
@rust-highfive
Copy link
Collaborator

Some changes occurred in src/tools/clippy.

cc @rust-lang/clippy

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label May 21, 2022
@xFrednet
Copy link
Member Author

Hey @Jarcho, @dswij, @Alexendoo, the Clippy team gets pinged by @rust-highfive whenever there are changes to Clippy files in this repo. I haven't included you in these pings as they can mostly be ignored. In this case, I'm pinging you since this is my PR, and it might be interesting to see the other side of the sync, which is not in the rust repo. In most cases, as in this one, you can just unsubscribe 🙃

@xFrednet xFrednet marked this pull request as draft May 21, 2022 11:46
@xFrednet xFrednet marked this pull request as ready for review May 21, 2022 11:50
@Manishearth
Copy link
Member

@bors r+ rollup=never p=1

@bors
Copy link
Contributor

bors commented May 21, 2022

📌 Commit 6e87c24 has been approved by Manishearth

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels May 21, 2022
@bors
Copy link
Contributor

bors commented May 21, 2022

⌛ Testing commit 6e87c24 with merge ebbea9b6a14883ee2fc01cb17d2be8c07f21ee54...

@rust-log-analyzer
Copy link
Collaborator

The job x86_64-gnu-tools failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
.......... (60/64)
...       (64/64)


/checkout/src/test/rustdoc-gui/search-result-display.goml search-result-display... FAILED
[ERROR] (line 5) Error: The following CSS selector "#search-settings" was not found: for command `wait-for: "#search-settings"`
Build completed unsuccessfully in 0:00:43

@bors
Copy link
Contributor

bors commented May 21, 2022

💔 Test failed - checks-actions

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels May 21, 2022
@matthiaskrgr
Copy link
Member

@bors retry

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels May 21, 2022
@bors
Copy link
Contributor

bors commented May 21, 2022

⌛ Testing commit 6e87c24 with merge bb4781a...

@bors
Copy link
Contributor

bors commented May 21, 2022

☀️ Test successful - checks-actions
Approved by: Manishearth
Pushing bb4781a to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label May 21, 2022
@bors bors merged commit bb4781a into rust-lang:master May 21, 2022
@rustbot rustbot added this to the 1.63.0 milestone May 21, 2022
@xFrednet xFrednet deleted the clippyup branch May 21, 2022 19:57
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (bb4781a): comparison url.

Instruction count

This benchmark run did not return any relevant results for this metric.

Max RSS (memory usage)

Results
  • Primary benchmarks: 🎉 relevant improvement found
  • Secondary benchmarks: mixed results
Regressions 😿
(primary)
Regressions 😿
(secondary)
Improvements 🎉
(primary)
Improvements 🎉
(secondary)
All 😿 🎉
(primary)
count1 0 1 1 3 1
mean2 N/A 1.4% -1.1% -3.1% -1.1%
max N/A 1.4% -1.1% -5.6% -1.1%

Cycles

Results
  • Primary benchmarks: 😿 relevant regressions found
  • Secondary benchmarks: mixed results
Regressions 😿
(primary)
Regressions 😿
(secondary)
Improvements 🎉
(primary)
Improvements 🎉
(secondary)
All 😿 🎉
(primary)
count1 2 2 0 2 2
mean2 2.2% 4.2% N/A -3.4% 2.2%
max 2.6% 4.6% N/A -3.5% 2.6%

If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf.

@rustbot label: -perf-regression

Footnotes

  1. number of relevant changes 2

  2. the arithmetic mean of the percent change 2

mati865 added a commit to mati865/rust-clippy that referenced this pull request Jul 11, 2022
It was first added to Rust in rust-lang/rust#97248 which missed 1.62 just by few days.
bors added a commit to rust-lang/rust-clippy that referenced this pull request Jul 11, 2022
Fix Clippy version in `derive_partial_eq_without_eq` lint

It was first added to Rust in rust-lang/rust#97248 which missed 1.62 just by few days.

changelog: none
bors added a commit to rust-lang/rust-clippy that referenced this pull request Jul 11, 2022
Fix Clippy version in `derive_partial_eq_without_eq` lint

It was first added to Rust in rust-lang/rust#97248 which missed 1.62 just by few days.

changelog: none
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.