Clippy subtree update#155996
Open
flip1995 wants to merge 69 commits intorust-lang:mainfrom
Open
Conversation
changelog: new lint: [`inline_modules`] Signed-off-by: Zihan <zihanli0822@gmail.com>
`span_suggestions` is to provide mutually exclusive suggestions. When it was introduced, we made its behavior be that if a single suggestion is given to it, we present the suggestion inline, otherwise in patch format. Changing this to make all of its uses be verbose, as that is closer in intent of output.
The `Residual` trait was even more experimental than `Try`, but now that RFC3721 is merged, I think it would make sense to require this.
…`question_mark` lint
If all the ways to "leave" the closure is through a divergent statement other than `return` (not detected as a potential return value by the visitor), do not trigger the lint.
Rollup of 18 pull requests Successful merges: - rust-lang#154451 (Require that a `<_ as Try>::Residual` implement the `Residual` trait) - rust-lang#154595 (Emit fatal on invalid const args with nested defs) - rust-lang#154599 (report the `varargs_without_pattern` lint in deps) - rust-lang#154699 (`core::unicode`: Replace `Cased` table with `Lt`) - rust-lang#155353 (resolve: Remove `inaccessible_ctor_reexport` resolver field) - rust-lang#155357 (Add `--remap-path-scope` as unstable in rustdoc) - rust-lang#150649 (clippy fix: non_canonical_clone_impl) - rust-lang#154604 (abort in core) - rust-lang#154616 (Add `--quiet` flag to x.py and bootstrap to suppress output) - rust-lang#155215 (Clean up `AttributeLintKind` and refactor diagnostic attribute linting) - rust-lang#155228 (Check diagnostic output in incremental `cpass` and `rpass` revisions) - rust-lang#155266 (Adjust release notes for post-merge feedback) - rust-lang#155326 (Disallow ZST allocations with `TypedArena`.) - rust-lang#155334 (docs: Use `0b1` instead of `NonZero::MIN` in `NonZero::bit_width` doctests) - rust-lang#155340 (Handle nonnull pattern types in size skeleton) - rust-lang#155347 (Add push_mut and new Layout methods to release notes) - rust-lang#155356 (remove calls to AliasTyKind::def_id) - rust-lang#155364 (Reduce diagnostic type visibilities.)
…lang#16867) If all the ways to "leave" the closure is through a divergent statement other than `return` (not detected as a potential return value by the visitor), do not trigger the lint. changelog: [`bind_instead_of_map`]: do not propose to rewrite the expression if the only way to leave the closure is through a divergent statement other than `return` Fixes rust-lang/rust-clippy#16861
minor code cleanup getting ready for the `useless_borrows_in_formatting` lint
minor code cleanup getting ready for the `useless_borrows_in_formatting` lint See rust-lang/rust-clippy#16523 r? @samueltardieu --- changelog: none
Only curl and stacker still depends on it.
Detect format macros where an argument
is passed with an explicit `&` even though the formatter already takes
references, e.g. `println!("{}", &s)` when `s: &str`.
Some original micro-benchmarks showed ~6% performance improvement when redundant refs are removed.
- Lint runs for both Display (`{}`) and Debug (`{:?}`) placeholders when
the inner type is Sized and implements the corresponding trait.
- Applies to the main value argument and to width/precision arguments
(e.g. `format!("{0:1$.2$}", &v1, &v2, &v3)`).
- Suggests removing the redundant `&` with MachineApplicable fix.
- Skip when the argument comes from expansion or a proc macro.
…nishearth Clippy subtree update r? Manishearth `Cargo.lock` update due to Clippy version bump and cargo_metadata dep bump in Clippy.
Co-authored-by: Samuel Tardieu <sam@rfc1149.net>
Refactor FnDecl and FnSig non-type fields into a new wrapper type #### Why this Refactor? This PR is part of an initial cleanup for the [arg splat experiment](rust-lang#153629), but it's a useful refactor by itself. It refactors the non-type fields of `FnDecl`, `FnSig`, and `FnHeader` into a new packed wrapper types, based on this comment in the `splat` experiment PR: rust-lang#153697 (comment) It also refactors some common `FnSig` creation settings into their own methods. I did this instead of creating a struct with defaults. #### Relationship to `splat` Experiment I don't think we can use functional struct updates (`..default()`) to create `FnDecl` and `FnSig`, because we need the bit-packing for the `splat` experiment. Bit-packing will avoid breaking "type is small" assertions for commonly used types when `splat` is added. This PR packs these types: - ExternAbi: enum + `unwind` variants (38) -> 6 bits - ImplicitSelfKind: enum variants (5) -> 3 bits - lifetime_elision_allowed, safety, c_variadic: bool -> 1 bit #### Minor Changes Fixes some typos, and applies rustfmt to clippy files that got skipped somehow.
*[View all comments](https://triagebot.infra.rust-lang.org/gh-comments/rust-lang/rust-clippy/pull/16523)* Fixes rust-lang/rust-clippy#10851 This is a workaround for the current [compiler limitation](rust-lang#112156) that results in a ~6% performance degradation. This lint detects format macros where an argument is passed with an explicit `&` references, e.g. `println!("{}", &s)` - Lint runs for both Display (`{}`) and Debug (`{:?}`) placeholders when the inner type is Sized and implements the corresponding trait. - Applies to the main value argument and to width/precision arguments (e.g. `format!("{0:1$.2$}", &v1, &v2, &v3)`). - Suggests removing the redundant `&` with MachineApplicable fix. - Skip when the argument comes from expansion or a proc macro. changelog: [`useless_borrows_in_formatting`]: detect redundant `&` in format macro arguments P.S. I think this lint should go into `perf` category once the code is reviewed
Warn when a format width is less than the minimum output size for the
format trait (e.g. `{:#02x}` yields "0x1", so width 2 is ignored).
Help suggests removing the width or increasing it above the minimum.
Update a bunch of dependencies to reduce windows-sys duplication This gets rid of windows-sys 0.60 and with the exception of curl and stacker it gets rid of windows-sys 0.59. For stacker getting rid of windows-sys 0.59 is blocked on rust-lang/stacker#145 and rust-lang#155438.
…=lcnr Introduce `Unnormalized` wrapper This is the first step of the [eager normalization](https://rust-lang.zulipchat.com/#narrow/channel/364551-t-types.2Ftrait-system-refactor/topic/Eager.20normalization.2C.20ahoy.21/with/582996293) series. This PR introduce an `Unnormalized` wrapper and make most normalization routines consume it. The purpose is to make normalization explicit. This PR contains no behavior change. API changes are in the first two commit. There're some normalization routines left untouched: - `normalize` in the type checker of borrowck: better do it together with `field.ty()` returning `Unnormalized`. - `normalize_with_depth`: only used inside the old solver. Can be done later. - `query_normalize`: rarely used. - misc local normalization helpers. The compiler errors are mostly fixed via `ast-grep`, with exceptions handled manually.
Closes rust-lang/rust-clippy#16822 changelog: [`for_kv_map`] fix FN when using `iter` and `iter_mut`
…st-lang#16907) Follow-up to rust-lang/rust-clippy#16732 changelog: none
rust-lang#16881) fixes rust-lang/rust-clippy#16823 This is my first contribution to Clippy, happy to make changes if the approach isn't quite right changelog: [`from_over_into`]: don't lint when a blanket `From` impl would cause a coherence conflict
Fix deprecation warning that Node20.js will stop working in June. changelog: none
…rochenkov Change `ItemKind::Trait` to a field variant. This changes `ItemKind::Trait` from an octuple(!!) to an enum variant with fields. Their names were chosen to match up with existing usage and minimize renaming. I'm leaning towards renaming `ident` to `name` as well; let me know if that's desired.
`MpscReceiver` aligns with `MpscSender`. The original name appears to not actually have been in use, for better or worse. Along the way, sprinkle the attribute onto `mpmc::Receiver` and `mpmc::Sender` too.
…r=mejrs Rename the diagnostic item for `std::sync::mpsc::Receiver` `MpscReceiver` aligns with `MpscSender`. The original name appears to not actually have been in use, for better or worse. r? mejrs
Closes rust-lang/rust-clippy#16935 changelog: [`bad_bit_mask`] fix ICE for overloaded bit ops
r? @ghost changelog: none
…6921) Fixed a small typo in the docs. changelog: none
Collaborator
|
The Clippy subtree was changed cc @rust-lang/clippy |
Collaborator
|
This comment has been minimized.
This comment has been minimized.
Member
|
@bors r+ p=1 rollup=never |
Contributor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
r? Manishearth