Skip to content

Conversation

@samueltardieu
Copy link
Member

@samueltardieu samueltardieu commented Dec 29, 2024

Removing .map(identity) may result in invalid code if the receiver of map() is an immutable binding, and the result of map() is used as the receiver of a method call expecting a mutable reference.

Fix #13904

changelog: [map_identity]: do not lint if this would cause mandatory mutability to be lost

@rustbot
Copy link
Collaborator

rustbot commented Dec 29, 2024

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 Dec 29, 2024
Removing `.map(identity)` may result in invalid code if the receiver of
`map()` is an immutable binding, and the result of `map()` is used as
the receiver of a method call expecting a mutable reference.
Copy link
Member

@Alexendoo Alexendoo left a comment

Choose a reason for hiding this comment

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

👍

@Alexendoo Alexendoo added this pull request to the merge queue Jan 7, 2025
Merged via the queue into rust-lang:master with commit f5ca68f Jan 7, 2025
9 checks passed
@samueltardieu samueltardieu deleted the push-rwrvpsulqryx branch January 10, 2025 12:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review Status: Awaiting review from the assignee but also interested parties

Projects

None yet

Development

Successfully merging this pull request may close these issues.

FP map_identity: fix requires mutability

3 participants