-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Update Clippy #103337
Update Clippy #103337
Conversation
Share much of its implementation with `manual_map` and should greatly benefit from its previous feedback.
This lint detects calls to a `&self`-taking `as_ptr` method, where the result is then immediately cast to a `*mut T`. Code like this is probably invalid, as that pointer will not have write permissions, and `*mut T` is usually used to write through.
Move common functions to `manual_utils.rs`, better arm matching, use clippy utils `contains_unsafe_block`
[`match_single_binding`] Add curlies for more cases to fix suggestion causes error Fixes rust-lang#9575 changelog: [`match_single_binding`]: Add curlies for scrutinees with side effects for more cases
Replace if_chain with let chains in `clippy::author` output Should help nudge new contributors towards let chains changelog: none
TypeErrCtxt optionally has a TypeckResults so that InferCtxt doesn't need to.
extend `box-default` lint, add suggestion This extends the recently added `box-default` lint to also cover `Box::new(vec![])`, `Box::new(String::from(""))` and `Box::new(Vec::from([]))`. Also the lint now suggests a suitable replacement. I did not find a simple way to check whether the type is fully determined by the outside, so I at least checked for some variations to remove the turbofish in those cases. --- changelog: none
make const_err a hard error This lint has been deny-by-default with future incompat wording since [Rust 1.51](rust-lang#80394) and the stable release of this week starts showing it in cargo's future compat reports. I can't wait to finally get rid of at least some of the mess in our const-err-reporting-code. ;) r? `@oli-obk` Fixes rust-lang#71800 Fixes rust-lang#100114
Remove `mir::CastKind::Misc` As discussed in rust-lang#97649 `mir::CastKind::Misc` is not clear, this PR addresses that by creating a new enum variant for every valid cast. r? ````@oli-obk````
…ast as float Floats cannot be expressed as hexadecimal literals
Add `manual_filter` lint for `Option` Share much of its implementation with `manual_map` and should greatly benefit from its previous feedback. I'm sure it's possible to even more refactor both and would gladly take input on that as well as any clippy idiomatic usage, since this is my first lint addition. I've added the lint to the complexity section for now, I don't know if every new lint needs to go in nursery first. The matching could be expanded to more than `Some(<value>)` to lint on arbitrary struct matching inside the `Some` but I've left it like it was for `manual_map` for now. `needless_match::pat_same_as_expr` provides a more generic match example. close rust-lang/rust-clippy#8822 changelog: Add lint [`manual_filter`] for `Option`
…ow, r=Jarcho Further enhance `needless_borrow`, mildly refactor `redundant_clone` This PR does the following: * Moves some code from `redundant_clone` into a new `clippy_utils` module called `mir`, and wraps that code in a function called `dropped_without_further_use`. * Relaxes the "is copyable" condition condition from rust-lang#9136 by also suggesting to remove borrows from values dropped without further use. The changes involve the just mentioned function. * Separates `redundant_clone` into modules. Strictly speaking, the last bullet is independent of the others. `redundant_clone` is somewhat hairy, IMO. Separating it into modules makes it slightly less so, by helping to delineate what depends upon what. I've tried to break everything up into digestible commits. r? `@Jarcho` (`@Jarcho` I hope you don't mind.) changelog: continuation of rust-lang#9136
As it makes the `Option` Non Copy
☔ The latest upstream changes (presumably #103310) made this pull request unmergeable. Please resolve the merge conflicts. |
argh merge conflict |
[`collapsible_match`] specify field name when destructuring structs changelog: [`collapsible_match`] specify field name when destructuring structs fix rust-lang/rust-clippy#9647 I wasn't the sure about the best way to convey the message in the lint message since it does not use suggestion. Because I liked the former output highlighting both spans, I've left it as before, only modifying the span label.
`ref_option_ref` do not lint when inner reference is mutable changelog: FP: [`ref_option_ref`]: No longer lints if the inner reference is mutable fix rust-lang/rust-clippy#9682
Add `lintcheck` to packages linted by `dogfood` test Currently, `lintcheck` is not checked by the `dogfood` test. I assume that is not intentional. If it is intentional, then this PR can be ignored. changelog: Add `lintcheck` to packages linted by `dogfood` test
Move MSRV tests into the lint specific test files There are currently two ways MSRV tests are done in the ui test suite, adding a case to the `#![clippy::msrv = "1.0"]` `tests/ui/min_rust_version_attr.rs` or adding the two `msrv_1_xx` functions to the test file of the lint in question This updates the clippy book to suggest the `msrv_1_xx` style, and replaces the tests in `tests/ui/min_rust_version_attr.rs` with ones of that style Almost the entire diff is just moving stuff around as a result, I made sure to check the line numbers the lints are emitted at correspond with the right `msrv` case, so feel free to only skim that part changelog: none
fix `box-default` ignoring trait objects' types This avoids removing the turbofish when the `Box` type is a `dyn` or `impl _`. This fixes rust-lang#9621. --- changelog: none
re-synced @Manishearth |
@bors r+ p=1 |
☀️ Test successful - checks-actions |
Finished benchmarking commit (758f196): comparison URL. Overall result: no relevant changes - no action needed@rustbot label: -perf-regression Instruction countThis benchmark run did not return any relevant results for this metric. Max RSS (memory usage)ResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
CyclesThis benchmark run did not return any relevant results for this metric. Footnotes |
r? @Manishearth