Skip to content

Remove redundant closures#1655

Merged
photovoltex merged 7 commits intolibrespot-org:devfrom
xtqqczze:clippy/redundant_closure_for_method_calls
Dec 24, 2025
Merged

Remove redundant closures#1655
photovoltex merged 7 commits intolibrespot-org:devfrom
xtqqczze:clippy/redundant_closure_for_method_calls

Conversation

@xtqqczze
Copy link
Copy Markdown
Contributor

Checks for closures which only invoke a method on the closure argument and can be replaced by referencing the method directly.

https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure_for_method_calls

@xtqqczze xtqqczze marked this pull request as ready for review November 30, 2025 18:36
Copy link
Copy Markdown
Member

@photovoltex photovoltex left a comment

Choose a reason for hiding this comment

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

LGTM. But just out of curiosity... why the change? Were there any reports that the other way didn't work? Or was a clippy rule updated, or any other reason behind the changes?

Don't get me wrong, they seem fine and all, but they don't bring any improvement with them I think? So the curiosity wants to know what brought you to make these changes^^

Copy link
Copy Markdown
Member

@photovoltex photovoltex left a comment

Choose a reason for hiding this comment

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

As the rule you applied here is allowed out of the box, we need to add a global rule that marks the rule as deny or warning. Otherwise we will run out of sync again because the rule isn't enforced by anything.

@xtqqczze xtqqczze force-pushed the clippy/redundant_closure_for_method_calls branch from fa043c7 to 3bb6618 Compare December 24, 2025 13:06
@xtqqczze xtqqczze requested a review from photovoltex December 24, 2025 13:08
Comment thread Cargo.toml
Copy link
Copy Markdown
Member

@photovoltex photovoltex left a comment

Choose a reason for hiding this comment

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

Thanks for the addition. Seems like a reasonable lint to enable.

@photovoltex photovoltex merged commit 3eca1ab into librespot-org:dev Dec 24, 2025
12 checks passed
@xtqqczze xtqqczze deleted the clippy/redundant_closure_for_method_calls branch December 24, 2025 17:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants