-
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 #79765
Merged
Merged
Update Clippy #79765
Conversation
This file contains 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
Suggest using utility methods `is_pending` and `is_ready`.
This only happend when debug_assertions were enabled in rustc
Add exteranal macros for as_conversions Added external macros to this PR rust-lang/rust-clippy#4888. r? `@llogiq` changelog: none
Disable unnecessary_cast for cfg-dependant types changelog: Disable unnecessary_cast for cfg-dependant types Fix rust-lang#6331
Drop support for all cloudabi targets `cloudabi` is a tier-3 target, and [it is no longer being maintained upstream][no]. This PR drops supports for cloudabi targets. Those targets are: * aarch64-unknown-cloudabi * armv7-unknown-cloudabi * i686-unknown-cloudabi * x86_64-unknown-cloudabi Since this drops supports for a target, I'd like somebody to tag `relnotes` label to this PR. Some other issues: * The tidy exception for `cloudabi` crate is still remained because * `parking_lot v0.9.0` and `parking_lot v0.10.2` depends on `cloudabi v0.0.3`. * `parking_lot v0.11.0` depends on `cloudabi v0.1.0`. [no]: https://github.com/NuxiNL/cloudabi#note-this-project-is-unmaintained
Otherwise code like this #![no_implicit_prelude] fn main() { ::std::todo!(); ::std::unimplemented!(); } will fail to compile, which is unfortunate and presumably unintended. This changes many invocations of `panic!` in a `macro_rules!` definition to invocations of `$crate::panic!`, which makes the invocations hygienic. Note that this does not make the built-in macro `assert!` hygienic.
Qualify `panic!` as `core::panic!` in non-built-in `core` macros Fixes rust-lang#78333. ----- Otherwise code like this #![no_implicit_prelude] fn main() { ::std::todo!(); ::std::unimplemented!(); } will fail to compile, which is unfortunate and presumably unintended. This changes many invocations of `panic!` in a `macro_rules!` definition to invocations of `$crate::panic!`, which makes the invocations hygienic. Note that this does not make the built-in macro `assert!` hygienic.
Rustup changelog: none r? `@ghost`
…broto Fix FP in indirect `needless_collect` when used multiple times Fix rust-lang/rust-clippy#5991 Fix rust-lang/rust-clippy#6297 changelog: Fix FP in indirect `needless_collect` when used multiple times
Update Clippy Biweekly Clippy update r? `@Manishearth`
Also stop updating the lintlist module in clippy_dev update_lints
Rustup r? `@ghost` changelog: [`panic`],[`unimplemented`],[`unreachable`],[`todo`] now also handle the `core::` version of those macros correctly.
…=ebroto Change `redundant_pattern_matching` to also lint `std::task::Poll` `reduntant_pattern_matching` currently lints pattern matching on `Option` and `Result` where the `is_variant` utility methods could be used instead: `is_some`, `is_none`, `is_ok`, `is_err`. This PR extends this behaviour to `std::task::Poll`, suggesting the methods `is_pending` and `is_ready`. Motivation: The current description of `redundant_pattern_matching` mentions > It's more concise and clear to just use the proper utility function which in my mind applies to `Poll` as well. changelog: Enhance [`redundant_pattern_matching`] to also lint on `std::task::Poll`
rustc_ast currently has a few dependencies on rustc_lexer. Ideally, an AST would not have any dependency its lexer, for minimizing unnecessarily design-time dependencies. Breaking this dependency would also have practical benefits, since modifying rustc_lexer would not trigger a rebuild of rustc_ast. This commit does not remove the rustc_ast --> rustc_lexer dependency, but it does remove one of the sources of this dependency, which is the code that handles fuzzy matching between symbol names for making suggestions in diagnostics. Since that code depends only on Symbol, it is easy to move it to rustc_span. It might even be best to move it to a separate crate, since other tools such as Cargo use the same algorithm, and have simply contain a duplicate of the code. This changes the signature of find_best_match_for_name so that it is no longer generic over its input. I checked the optimized binaries, and this function was duplicated at nearly every call site, because most call sites used short-lived iterator chains, generic over Map and such. But there's no good reason for a function like this to be generic, since all it does is immediately convert the generic input (the Iterator impl) to a concrete Vec<Symbol>. This has all of the costs of generics (duplicated method bodies) with no benefit. Changing find_best_match_for_name to be non-generic removed about 10KB of code from the optimized binary. I know it's a drop in the bucket, but we have to start reducing binary size, and beginning to tame over-use of generics is part of that.
Suggest using utility methods `is_ipv4` and `is_ipv6`.
add configuration option for minimum supported rust version add msrv attribute to some lints listed in rust-lang#6097 add tests
Add support for minimum supported rust version add configuration option for minimum supported rust version add msrv attribute to some lints listed in rust-lang#6097 add tests addresses rust-lang#6097 changelog: Add `msrv` configuration to Clippy. This should get a longer changelog entry.
Specifically: - find std::ptr::write_bytes - find std::ptr::swap_nonoverlapping - find std::ptr::slice_from_raw_parts - find std::ptr::slice_from_raw_parts_mut - pointer_primitive::write_bytes
Also fix review comments: - Use const arrays and iterate them for the method/function names - merge 2 if_chain's into one using a rest pattern - remove unnecessary unsafe block in test And make the lint only point to the count expression instead of the entire function call
Specifically ptr::{sub, wrapping_sub, add, wrapping_add, offset, wrapping_offset} and slice::{from_raw_parts, from_raw_parts_mut} The lint now also looks for size_of calls through casts (Since offset takes an isize)
… r=ebroto Add lint size_of_in_element_count Fixes rust-lang#6381 changelog: Add lint to check for using size_of::<T> or size_of_val::<T> in the count parameter to ptr::copy or ptr::copy_nonoverlapping, which take a count of Ts (And not a count of bytes) - \[X] Followed [lint naming conventions][lint_naming] - \[X] Added passing UI tests (including committed `.stderr` file) - \[ ] `cargo test` passes locally - \[X] Executed `cargo dev update_lints` - \[X] Added lint documentation - \[X] Run `cargo dev fmt` [lint_naming]: https://rust-lang.github.io/rfcs/0344-conventions-galore.html#lints Running `cargo test` locally fails with this error: ``` running 1 test test fmt ... FAILED failures: ---- fmt stdout ---- status: exit code: 1 stdout: stderr: error: unable to unlink old fallback exe error: caused by: Access is denied. (os error 5) thread 'fmt' panicked at 'Formatting check failed. Run `cargo dev fmt` to update formatting.', tests\fmt.rs:32:5 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace failures: fmt test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out ``` But I did run `cargo dev fmt`
Moved map_err_ignore to restriction and updated help message This MR moves map_err_ignore lint from `pedantic` to the `restriction` category of lints and updates the help message to give the user an option to ignore the lint by naming the closure variable e.g. `.map_err(|_ignored| ...` --- changelog: move map_err_ignore to restriction category
…_of_in_element_count, r=flip1995 Fix a style of texts in `size_of_in_element_count` Add missing ` to texts changelog: none
Turn unnecessary_wraps applicability to MaybeIncorrect Fixes: rust-lang#6417 changelog: Turn [`unnecessary_wraps`] applicability to `MaybeIncorrect`
…fractal-option, r=Manishearth Added a lint-fraction-readability flag to the configuration This adds an option to disable the `unreadable_literal` lint for floats with a longer fraction. This allows users to write `0.100200300` without getting a warning. Fixes rust-lang#4176 I have some open questions about this PR: 1. I've named the option `lint-fraction-readability` is this a good name or should I rename it to something else? 2. What should the default configuration value be? * The current default value is `true` as this was also the previous default. 3. Do I have to document this new option somewhere else or will it be extracted from the code comment? 4. The current fix option will also rewrite the fraction if the integer part violates the `unreadable_literal` lint it would otherwise also trigger the `inconsistent_digit_grouping` lint. Is this also okay? * `1.100200300` will be unaffected by the fix function * `100200300.100200300` will be effected and fixed to `100_200_300.100_200_300` --- The project needed some getting used to but I'm happy with the result. A big thank you to `@flip1995` for giving me some pointers for this implementation and to everyone for the great introduction documentation! --- changelog: Added the `unreadable-literal-lint-fractions` configuration to disable the `unreadable_literal` lint for fractions
rust-highfive
added
the
S-waiting-on-review
Status: Awaiting review from the assignee but also interested parties.
label
Dec 6, 2020
@bors r+ rollup=never |
📌 Commit 898ef0f has been approved by |
bors
added
S-waiting-on-bors
Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
and removed
S-waiting-on-review
Status: Awaiting review from the assignee but also interested parties.
labels
Dec 6, 2020
☀️ Test successful - checks-actions |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
merged-by-bors
This PR was explicitly merged by bors.
S-waiting-on-bors
Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
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.
Biweekly Clippy update (which I forgot about on Thursday)
This includes a
Cargo.lock
update, so probably needsrollup=never
.r? @Manishearth