Skip to content
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

Clippy subtree update #120345

Merged
merged 112 commits into from
Jan 26, 2024
Merged

Clippy subtree update #120345

merged 112 commits into from
Jan 26, 2024

Conversation

flip1995
Copy link
Member

@flip1995 flip1995 commented Jan 25, 2024

dswij and others added 30 commits November 7, 2023 18:29
This commit:
- now makes `HirEqInterExpr::eq_block` take comments into account. Identical code with varying comments will no longer be considered equal.
- makes necessary adjustments to UI tests.
Arc's documentation uses the term "thread", aligning to that terminology. Fix typo in "Rc".
One consequence is that errors returned by
`maybe_new_parser_from_source_str` now must be consumed, so a bunch of
places that previously ignored those errors now cancel them. (Most of
them explicitly dropped the errors before. I guess that was to indicate
"we are explicitly ignoring these", though I'm not 100% sure.)
…iaskrgr

Rollup of 8 pull requests

Successful merges:

 - rust-lang#119448 (annotate-snippets: update to 0.10)
 - rust-lang#119813 (Silence some follow-up errors [2/x])
 - rust-lang#119836 (chore: remove unnecessary blank line)
 - rust-lang#119841 (Remove `DiagnosticBuilder::buffer`)
 - rust-lang#119842 (coverage: Add enums to accommodate other kinds of coverage mappings)
 - rust-lang#119845 (rint: further doc tweaks)
 - rust-lang#119852 (give const-err4 a more descriptive name)
 - rust-lang#119853 (rustfmt.toml: don't ignore just any tests path, only root one)

r? `@ghost`
`@rustbot` modify labels: rollup
…dnet

I'm not on vacation (again)

A few weeks ago I opened rust-lang#12011 removing me from `users_on_vacation`, it got merged. The subtree sync reverted this change (weirdly)

changelog: none

r? `@xFrednet`
Fix suggestion for `map_clone` lint on types implementing `Copy`

Follow-up of rust-lang/rust-clippy#12104.

It was missing this check to suggest the correct method.

r? `@llogiq`

changelog: Fix suggestion for `map_clone` lint on types implementing `Copy`
… r=davidtwco

Check rust lints when an unknown lint is detected

Fixes rust-lang#118183
…rsion-false-positive, r=llogiq

Fix false positive in `PartialEq` check in `unconditional_recursion` lint

Fixes rust-lang/rust-clippy#12133.

We needed to check for the type of the previous element <del>in case it's a field</del>.

EDIT: After some extra thoughts, no need to check if it's a field, just if it's the same type as `Self`.

r? `@llogiq`

changelog: Fix false positive in `PartialEq` check in `unconditional_recursion` lint
- lint if the lock was in a nested pattern
- lint if the lock is inside a `Result<Lock, _>`
…_is_some, r=llogiq

Improve help message for `search_is_some` lint

Fixes rust-lang#11681.

Like mentioned in the issue, we tend to use the formulation "consider using", which we didn't in this case. I think it clears both the confusion and also makes help message more coherent overall.

r? `@llogiq`

changelog: Improve help message for `search_is_some` lint
…,lcnr

Delegation implementation: step 1

See rust-lang#118212 for more details.

r? `@petrochenkov`
y21 and others added 8 commits January 25, 2024 00:11
Suggest existing configuration option if one is found

While working on/testing rust-lang#12179, I made the mistake of using underscores instead of dashes for the field name in the clippy.toml file and ended up being confused for a few minutes until I found out what's wrong. With this change, clippy will suggest an existing field if there's one that's similar.
```
1 | allow_mixed_uninlined_format_args = true
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: perhaps you meant: `allow-mixed-uninlined-format-args`
```
(in hindsight, the current behavior of printing all the config options makes it obvious in most cases but I still think a suggestion like this would be nice to have)

I had to play around with the value a bit. A max distance of 5 seemed a bit too strong since it'd suggest changing `foobar` to `msrv`, which seemed odd, and 4 seemed just good enough to detect a typo of five underscores.

changelog: when an invalid field in clippy.toml is found, suggest the closest existing one if one is found
Consolidating rustc Dependencies

changelog: none

For dependencies in rustc where there are multiple versions used, this moves the older dependency to the newer dependency. These are the updates to clippy as mentioned here: rust-lang#120177
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jan 25, 2024
@rustbot
Copy link
Collaborator

rustbot commented Jan 25, 2024

Some changes occurred in src/tools/clippy

cc @rust-lang/clippy

These commits modify the Cargo.lock file. Unintentional changes to Cargo.lock can be introduced when switching branches and rebasing PRs.

If this was unintentional then you should revert the changes before this PR is merged.
Otherwise, you can ignore this comment.

@rust-log-analyzer

This comment has been minimized.

@matthiaskrgr matthiaskrgr added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jan 25, 2024
@Manishearth
Copy link
Member

r=me but build fails

@y21
Copy link
Member

y21 commented Jan 25, 2024

Looks like the ICE happens because of None here, which ends up turning into an empty suggestion

Only conditionally adding the suggestion seems to be the right thing to do here?
diff --git a/clippy_lints/src/from_over_into.rs b/clippy_lints/src/from_over_into.rs
index 93527bcdf..1933a0089 100644
--- a/clippy_lints/src/from_over_into.rs
+++ b/clippy_lints/src/from_over_into.rs
@@ -181,9 +181,6 @@ fn convert_to_from(
     let from = snippet_opt(cx, self_ty.span)?;
     let into = snippet_opt(cx, target_ty.span)?;
 
-    let return_type = matches!(sig.decl.output, FnRetTy::Return(_))
-        .then_some(String::from("Self"))
-        .unwrap_or_default();
     let mut suggestions = vec![
         // impl Into<T> for U  ->  impl From<T> for U
         //      ~~~~                    ~~~~
@@ -200,10 +197,13 @@ fn convert_to_from(
         // fn into([mut] self) -> T  ->  fn into([mut] v: T) -> T
         //               ~~~~                          ~~~~
         (self_ident.span, format!("val: {from}")),
+    ];
+
+    if let FnRetTy::Return(_) = sig.decl.output {
         // fn into(self) -> T  ->  fn into(self) -> Self
         //                  ~                       ~~~~
-        (sig.decl.output.span(), return_type),
-    ];
+        suggestions.push((sig.decl.output.span(), String::from("Self")));
+    }
 
     let mut finder = SelfFinder {
         cx,

@flip1995
Copy link
Member Author

@y21 Thanks for providing the fix, that's a nice thing to wake up to!

@bors r=Manishearth

@bors
Copy link
Contributor

bors commented Jan 26, 2024

📌 Commit de8ccdb has been approved by Manishearth

It is now in the queue for this repository.

@bors 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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jan 26, 2024
bors added a commit to rust-lang-ci/rust that referenced this pull request Jan 26, 2024
…iaskrgr

Rollup of 9 pull requests

Successful merges:

 - rust-lang#117420 (Make `#![allow_internal_unstable(..)]` work with `stmt_expr_attributes`)
 - rust-lang#117678 (Stabilize `slice_group_by`)
 - rust-lang#119917 (Remove special-case handling of `vec.split_off(0)`)
 - rust-lang#120117 (Update `std::io::Error::downcast` return type)
 - rust-lang#120329 (RFC 3349 precursors)
 - rust-lang#120339 (privacy: Refactor top-level visiting in `NamePrivacyVisitor`)
 - rust-lang#120345 (Clippy subtree update)
 - rust-lang#120360 (Don't fire `OPAQUE_HIDDEN_INFERRED_BOUND` on sized return of AFIT)
 - rust-lang#120372 (Fix outdated comment on Box)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 37b9022 into rust-lang:master Jan 26, 2024
11 checks passed
@rustbot rustbot added this to the 1.77.0 milestone Jan 26, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Jan 26, 2024
Rollup merge of rust-lang#120345 - flip1995:clippy-subtree-update, r=Manishearth

Clippy subtree update

r? `@Manishearth`

Closes rust-lang/rust-clippy#12148
flip1995 pushed a commit to flip1995/rust that referenced this pull request Feb 8, 2024
…Manishearth

Clippy subtree update

r? `@Manishearth`

Closes rust-lang/rust-clippy#12148
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Issue with map(clone) on Option in latest nightly