-
Notifications
You must be signed in to change notification settings - Fork 13k
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 #112203
Update Clippy #112203
Conversation
Co-authored-by: llogiq <bogusandre@gmail.com>
* Replace variables inside | patterns in the if let: let v = if let V::A(v) | V::B(v) = v { v } else ... * Support nested patterns: let v = if let Ok(Ok(Ok(v))) = v { v } else ... * Support tuple structs with more than one arg: let v = V::W(v, _) = v { v } else ... * Correctly handle .. in tuple struct patterns: let v = V::X(v, ..) = v { v } else ...
These unit tests generate non-compilable code. I did NOT `bless` them on purpose because the stderr output is not good. I'm surprised we don't auto-compile the suggestions here - is this something that can be easily enabled? See rust-lang#10808
[`match_wild_err_arm`]: do not lint in const contexts Fixes rust-lang#10635. changelog: [`match_wild_err_arm`]: do not lint in const contexts as `Result::{unwrap, expect}` is not const-stable
[`large_stack_arrays`]: check array initializer expressions Fixes rust-lang#10741. Prior to this PR, the lint only checked array repeat expressions (ie. `[T; n]`). Now it also checks array initializer expressions. changelog: [`large_stack_arrays`]: check array initializer expressions
Fix missing block for unsafe code If a block is declared as unsafe, it needs an extra layer of curly braces around it. Fixes rust-lang#10808 This code adds handling for `UnsafeSource::UserProvided` block, i.e. `unsafe { ... }`. Note that we do not handle the `UnsafeSource::CompilerGenerated` as it seems to not be possible to generate that with the user code (?), or at least doesn't seem to be needed to be handled explicitly. There is an issue with this code: it does not add an extra indentation for the unsafe blocks. I think this is a relatively minor concern for such an edge case, and should probably be done by a separate PR (fixing compile bug is more important than getting styling perfect especially when `rustfmt` will fix it anyway) ```rust // original code unsafe { ... } // code that is now generated by this PR { unsafe { ... } } // what we would ideally like to get { unsafe { ... } } ``` changelog: [`single_match`](https://rust-lang.github.io/rust-clippy/master/#single_match): Fix suggestion for `unsafe` blocks
needless_else: new lint to check for empty `else` clauses Empty `else` clauses are useless. They happen in the wild and are not linted yet: /~https://github.com/uutils/coreutils/pull/4880/files `else` clauses containing or preceded by comments are not linted as the comments might be important. changelog: [`needless_else`]: new lint
new lint: `missing_fields_in_debug` Fixes rust-lang#10429 This PR adds a new lint that looks for manual `Debug` implementations that do not "use" all of the fields. This often happens when adding a new field to a struct. It also acts as a style lint in case leaving out a field was intentional. In that case, it's preferred to use [`DebugStruct::finish_non_exhaustive`](https://doc.rust-lang.org/stable/std/fmt/struct.DebugStruct.html#method.finish_non_exhaustive), which indicates that there are more fields that were explicitly not shown. ``` changelog: [`missing_fields_in_debug`]: missing fields in manual `Debug` implementation ```
…-doc, r=flip1995 Explain which paths clippy searches for configuration in docs Fixes rust-lang/rust-clippy#9921. Adds information on where to place the configuration files, it may be a bit verbose. Also added a comment to the section of the code where the search happens, to hopefully prevent changing that without updating the docs. changelog: Make documentation about where to place configuration files clearer.
Add spans to `clippy.toml` error messages Adds spans to errors and warnings encountered when parsing `clippy.toml`. changelog: Errors and warnings generated when parsing `clippy.toml` now point to the location in the TOML file the error/warning occurred.
Rustup r? `@ghost` changelog: none
These commits modify the If this was unintentional then you should revert the changes before this PR is merged. Some changes occurred in src/tools/clippy cc @rust-lang/clippy |
@bors rollup=never Includes a more involved |
@bors r+ p=1 |
☀️ Test successful - checks-actions |
Finished benchmarking commit (0939ec1): 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. Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 644.317s -> 647.393s (0.48%) |
Update Clippy r? `@Manishearth`
r? @Manishearth