-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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 #92036
Update Clippy #92036
Conversation
Cleanup: Eliminate ConstnessAnd This is almost a behaviour-free change and purely a refactoring. "almost" because we appear to be using the wrong ParamEnv somewhere already, and this is now exposed by failing a test using the unstable `~const` feature. We most definitely need to review all `without_const` and at some point should probably get rid of many of them by using `TraitPredicate` instead of `TraitRef`. This is a continuation of rust-lang#90274. r? `@oli-obk` cc `@spastorino` `@ecstatic-morse`
Because the `if .. {}` statement already puts the condition in expression scope, contained blocks would be parsed as complete statements, so any `&` binary expression whose left operand ended in a block would lead to a non-compiling suggestion. This adds a visitor to identify such expressions and add parentheses. This fixes rust-lang#8052.
…r=camsteffen Parenthesize blocks in `needless_bool` suggestion Because the `if .. {}` statement already puts the condition in expression scope, contained blocks would be parsed as complete statements, so any `&` binary expression whose left operand ended in a block would lead to a non-compiling suggestion. We identify such expressions and add parentheses. Note that we don't make a difference between normal and unsafe blocks because the parsing problems are the same for both. This fixes rust-lang#8052. --- changelog: none
Peel blocks and statements utils changelog: none * Rename `remove_blocks` to `peel_blocks` * Add `peel_blocks_and_stmts` * Various refactors to use the above utils * The utils also now check `block.rules`
Fix FP on `question_mark` if returned object is not local Closes rust-lang#8019 changelog: [`question_mark`] Fix FP when returned object is not local
…po, r=giraffate `needless_lifetimes` Known problems typo fixes rust-lang#8084 [needless_lifetimes] changelog: none
…xFrednet Clarify the purpose of the non_send lint PR 2/2 for issue rust-lang#8045. Tried to tone down the warning message and clarify the intention of the lint. Specifically, I added a description that this lint tries to detect "types that are not safe to be sent to another thread". changelog: none r? `@xFrednet`
Fix bad suggestion on `option_if_let_else` when there is complex subpat closes rust-lang#7991 Prefer not warning any complex subpat in `option_if_let_else` rather than suggesting obscure suggestions. changelog: [`option_if_let_else`] does not warn when complex subpat is present
…type_complexity, r=llogiq Ignore associated types in traits when considering type complexity changelog: Ignore associated types in traits when checking ``[`type_complexity`]`` lint. fixes rust-lang#1013
…dnet Add new lint to warn when #[must_use] attribute should be used on a method This lint is somewhat similar to https://rust-lang.github.io/rust-clippy/master/index.html#must_use_candidate but also different: it emits a warning by default and only targets methods (so not functions nor associated functions). Someone suggested it to me after this tweet: https://twitter.com/m_ou_se/status/1466439813230477312 I think it would reduce the number of cases of API misuses quite a lot. What do you think? --- changelog: Added new [`return_self_not_must_use`] lint
Tweak errors coming from `for`-loop, `?` and `.await` desugaring * Suggest removal of `.await` on non-`Future` expression * Keep track of obligations introduced by desugaring * Remove span pointing at method for obligation errors coming from desugaring * Point at called local sync `fn` and suggest making it `async` ``` error[E0277]: `()` is not a future --> $DIR/unnecessary-await.rs:9:10 | LL | boo().await; | -----^^^^^^ `()` is not a future | | | this call returns `()` | = help: the trait `Future` is not implemented for `()` help: do not `.await` the expression | LL - boo().await; LL + boo(); | help: alternatively, consider making `fn boo` asynchronous | LL | async fn boo () {} | +++++ ``` Fix rust-lang#66731.
… r=scottmcm Stabilize `iter::zip` Hello all! As the tracking issue (rust-lang#83574) for `iter::zip` completed the final commenting period without any concerns being raised, I hereby submit this stabilization PR on the issue. As the pull request that introduced the feature (rust-lang#82917) states, the `iter::zip` function is a shorter way to zip two iterators. As it's generally a quality-of-life/ergonomic improvement, it has been integrated into the codebase without any trouble, and has been used in many places across the rust compiler and standard library since March without any issues. For more details, I would refer to `@cuviper's` original PR, or the [function's documentation](https://doc.rust-lang.org/std/iter/fn.zip.html).
…ignment, r=jackh726,pnkfelix Stabilize `destructuring_assignment` Closes rust-lang#71126 - [Stabilization report](rust-lang#71126 (comment)) - [Completed FCP](rust-lang#71126 (comment)) `@rustbot` label +F-destructuring-assignment +T-lang Also needs +relnotes but I don't have permission to add that tag.
Add `unnecessary_to_owned` lint This PR adds a lint to check for unnecessary calls to `ToOwned::to_owned` and other similar functions (e.g., `Cow::into_owned`, `ToString::to_string`, etc.). The lint checks for expressions of the form `&receiver.to_owned_like()` used in a position requiring type `&T` where one of the following is true: * `receiver`'s type is `T` exactly * `receiver`'s type implements `Deref<Target = T>` * `receiver`'s type implements `AsRef<T>` The lint additionally checks for expressions of the form `receiver.to_owned_like()` used as arguments of type `impl AsRef<T>`. It would be nice if the lint could also check for expressions used as arguments to functions like the following: ``` fn foo<T: AsRef<str>>(x: T) { ... } ``` However, I couldn't figure out how to determine whether a function input type was instantiated from a parameter with a trait bound. If someone could offer me some guidance, I would be happy to add such functionality. Closes rust-lang#7933 changelog: Add [`unnecessary_to_owned`] lint
Rustup r? `@ghost` changelog: none
Some changes occurred in src/tools/clippy. cc @rust-lang/clippy |
@bors r+ |
📌 Commit f1a779c has been approved by |
@bors p=1 |
☀️ Test successful - checks-actions |
Finished benchmarking commit (34dc0d0): comparison url. Summary: This change led to very large relevant regressions 😿 in compiler performance.
If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf. Next Steps: If you can justify the regressions found in this perf run, please indicate this with @rustbot label: +perf-regression |
Due to rust-lang/rustc-perf#1123. |
Oh good I thought we were in trouble. |
Only one day delayed! 😅
r? @Manishearth