Skip to content

fix: redundant_clone FP in overlapping lifetime #14237

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 1 commit into from
Apr 11, 2025

Conversation

profetia
Copy link
Contributor

fixes #13900

changelog: [redundant_clone]: fix FP in overlapping lifetime

@rustbot
Copy link
Collaborator

rustbot commented Feb 17, 2025

r? @Alexendoo

rustbot has assigned @Alexendoo.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Feb 17, 2025
@profetia profetia force-pushed the issue13900 branch 2 times, most recently from 1f39cb0 to 5853c9d Compare February 17, 2025 19:28
@profetia
Copy link
Contributor Author

r? clippy

@profetia
Copy link
Contributor Author

r? clippy

@rustbot rustbot assigned llogiq and unassigned Centri3 Mar 12, 2025
@profetia profetia force-pushed the issue13900 branch 2 times, most recently from f2d9b0b to f234dc7 Compare March 28, 2025 16:27
@profetia
Copy link
Contributor Author

r? clippy

@rustbot rustbot assigned flip1995 and unassigned llogiq Mar 28, 2025
@profetia
Copy link
Contributor Author

profetia commented Apr 8, 2025

r? clippy

@rustbot rustbot assigned llogiq and unassigned flip1995 Apr 8, 2025
@samueltardieu
Copy link
Contributor

r? @samueltardieu

@rustbot rustbot assigned samueltardieu and unassigned llogiq Apr 8, 2025
Copy link
Contributor

@samueltardieu samueltardieu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The following is a false positive and the suggestion will cause an error:

    let mut a = String::new();
    let mut b = String::new();
    for _ in 1..10 {
        b = a.clone();
    }

This shows in the lintcheck run.

@samueltardieu
Copy link
Contributor

@rustbot author

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action from the author. (Use `@rustbot ready` to update this status) and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties labels Apr 8, 2025
@rustbot
Copy link
Collaborator

rustbot commented Apr 8, 2025

Reminder, once the PR becomes ready for a review, use @rustbot ready.

@profetia
Copy link
Contributor Author

@rustbot ready

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties and removed S-waiting-on-author Status: This is awaiting some action from the author. (Use `@rustbot ready` to update this status) labels Apr 11, 2025
Copy link
Contributor

@samueltardieu samueltardieu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add the test case that would wrongly trigger the lint (the assignment in a loop) so that it can act as a non regression test?

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action from the author. (Use `@rustbot ready` to update this status) and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties labels Apr 11, 2025
@samueltardieu samueltardieu enabled auto-merge April 11, 2025 15:45
@samueltardieu
Copy link
Contributor

Looks good, thanks!

@samueltardieu samueltardieu added this pull request to the merge queue Apr 11, 2025
Merged via the queue into rust-lang:master with commit ec105ba Apr 11, 2025
11 checks passed
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
S-waiting-on-author Status: This is awaiting some action from the author. (Use `@rustbot ready` to update this status)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

FP redundant-clone impl trait
7 participants