-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Clippyup #97248
Conversation
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.
Signed-off-by: Miguel Guarniz <[email protected]>
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
Some changes occurred in src/tools/clippy. cc @rust-lang/clippy |
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 🙃 |
@bors r+ rollup=never p=1 |
📌 Commit 6e87c24 has been approved by |
⌛ Testing commit 6e87c24 with merge ebbea9b6a14883ee2fc01cb17d2be8c07f21ee54... |
The job Click to see the possible cause of the failure (guessed by this bot)
|
💔 Test failed - checks-actions |
@bors retry |
☀️ Test successful - checks-actions |
Finished benchmarking commit (bb4781a): comparison url. Instruction countThis benchmark run did not return any relevant results for this metric. Max RSS (memory usage)Results
CyclesResults
If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf. @rustbot label: -perf-regression Footnotes |
It was first added to Rust in rust-lang/rust#97248 which missed 1.62 just by few days.
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
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
This direction was simpler. All test Clippy pass locally 🙃
r? @Manishearth