-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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 #100419
Update Clippy #100419
Conversation
Fix redundant_closure_call for single-expression async closures Add Sugg::asyncify Use Sugg for redundant_closure_call implementation
…lint is not allowed
Address issue rust-lang#99265 by checking each positionally used argument to see if the argument is named and adding a lint to use the name instead. This way, when named arguments are used positionally in a different order than their argument order, the suggested lint is correct. For example: ``` println!("{b} {}", a=1, b=2); ``` This will now generate the suggestion: ``` println!("{b} {a}", a=1, b=2); ``` Additionally, this check now also correctly replaces or inserts only where the positional argument is (or would be if implicit). Also, width and precision are replaced with their argument names when they exists. Since the issues were so closely related, this fix for issue rust-lang#99265 also fixes issue rust-lang#99266. Fixes rust-lang#99265 Fixes rust-lang#99266
Co-authored-by: Andy Caldwell <andycaldwell@microsoft.com>
…rcho Read and use deprecated configuration (as well as emitting a warning) Original change written by `@flip1995` I've simply rebased to master and fixed up the formatting/tests. This change teaches the configuration parser which config key replaced a deprecated key and attempts to populate the latter from the former. If both keys are provided this fails with a duplicate key error (rather than attempting to guess which the user intended). Currently this on affects `cyclomatic-complexity-threshold` -> `cognitive-complexity-threshold` but will also be used in rust-lang#8974 to handle `blacklisted-names` -> `disallowed-names`. ``` changelog: deprecated configuration keys are still applied as if they were provided as their non-deprecated name. ``` - [x] `cargo test` passes locally - [x] Run `cargo dev fmt`
…rrors Generate correct suggestion with named arguments used positionally Address issue rust-lang#99265 by checking each positionally used argument to see if the argument is named and adding a lint to use the name instead. This way, when named arguments are used positionally in a different order than their argument order, the suggested lint is correct. For example: ``` println!("{b} {}", a=1, b=2); ``` This will now generate the suggestion: ``` println!("{b} {a}", a=1, b=2); ``` Additionally, this check now also correctly replaces or inserts only where the positional argument is (or would be if implicit). Also, width and precision are replaced with their argument names when they exists. Since the issues were so closely related, this fix for issue rust-lang#99265 also fixes issue rust-lang#99266. Fixes rust-lang#99265 Fixes rust-lang#99266
A `TokenStream` contains a `Lrc<Vec<(TokenTree, Spacing)>>`. But this is not quite right. `Spacing` makes sense for `TokenTree::Token`, but does not make sense for `TokenTree::Delimited`, because a `TokenTree::Delimited` cannot be joined with another `TokenTree`. This commit fixes this problem, by adding `Spacing` to `TokenTree::Token`, changing `TokenStream` to contain a `Lrc<Vec<TokenTree>>`, and removing the `TreeAndSpacing` typedef. The commit removes these two impls: - `impl From<TokenTree> for TokenStream` - `impl From<TokenTree> for TreeAndSpacing` These were useful, but also resulted in code with many `.into()` calls that was hard to read, particularly for anyone not highly familiar with the relevant types. This commit makes some other changes to compensate: - `TokenTree::token()` becomes `TokenTree::token_{alone,joint}()`. - `TokenStream::token_{alone,joint}()` are added. - `TokenStream::delimited` is added. This results in things like this: ```rust TokenTree::token(token::Semi, stmt.span).into() ``` changing to this: ```rust TokenStream::token_alone(token::Semi, stmt.span) ``` This makes the type of the result, and its spacing, clearer. These changes also simplifies `Cursor` and `CursorRef`, because they no longer need to distinguish between `next` and `next_with_spacing`.
…y, r=Manishearth Remove "blacklist" terminology Picking up where rust-lang/rust-clippy#5896 left off, this renames the `blacklisted_name` lint to `disallowed_names` (pluralised for compliance with naming conventions). The old name is still available though is deprecated (both in the lint name, and in the TOML configuration file). This has been proposed/requested a few times, most recently in rust-lang/rust-clippy#7582 where `@xFrednet` suggested pinging the Clippy team when a PR was created hence... cc: `@rust-lang/clippy` changelog: [`disallowed_names`] lint replaces `blacklisted_name`
Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
The expect_used lint is allow-by-default, so it would be better to show the case where this is enabled. Co-authored-by: Takayuki Nakata <f.seasons017@gmail.com>
…ochenkov Remove `TreeAndSpacing`. A `TokenStream` contains a `Lrc<Vec<(TokenTree, Spacing)>>`. But this is not quite right. `Spacing` makes sense for `TokenTree::Token`, but does not make sense for `TokenTree::Delimited`, because a `TokenTree::Delimited` cannot be joined with another `TokenTree`. This commit fixes this problem, by adding `Spacing` to `TokenTree::Token`, changing `TokenStream` to contain a `Lrc<Vec<TokenTree>>`, and removing the `TreeAndSpacing` typedef. The commit removes these two impls: - `impl From<TokenTree> for TokenStream` - `impl From<TokenTree> for TreeAndSpacing` These were useful, but also resulted in code with many `.into()` calls that was hard to read, particularly for anyone not highly familiar with the relevant types. This commit makes some other changes to compensate: - `TokenTree::token()` becomes `TokenTree::token_{alone,joint}()`. - `TokenStream::token_{alone,joint}()` are added. - `TokenStream::delimited` is added. This results in things like this: ```rust TokenTree::token(token::Semi, stmt.span).into() ``` changing to this: ```rust TokenStream::token_alone(token::Semi, stmt.span) ``` This makes the type of the result, and its spacing, clearer. These changes also simplifies `Cursor` and `CursorRef`, because they no longer need to distinguish between `next` and `next_with_spacing`. r? `@petrochenkov`
Rollup of 5 pull requests Successful merges: - rust-lang#99311 (change maybe_body_owned_by to take local def id) - rust-lang#99862 (Improve type mismatch w/ function signatures) - rust-lang#99895 (don't call type ascription "cast") - rust-lang#99900 (remove some manual hash stable impls) - rust-lang#99903 (Add diagnostic when using public instead of pub) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
…gillot Use LocalDefId for closures more
Some changes occurred in src/tools/clippy cc @rust-lang/clippy |
@bors r+ p=1 |
⌛ Testing commit ea90d4b with merge 00c071d1229639228176e80837672e56f58f9215... |
💔 Test failed - checks-actions |
seems spurious @bors retry |
☀️ Test successful - checks-actions |
Finished benchmarking commit (b998821): comparison url. Instruction count
Max RSS (memory usage)This benchmark run did not return any relevant results for this metric. CyclesResults
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 Footnotes |
Untagging as a regression. This PR didn't change any benchmarked code (including e.g. for PGO purposes). |
Update Clippy r? `@Manishearth`
r? @Manishearth