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: disable the box_default lint #3360

Merged
merged 1 commit into from
Apr 29, 2024
Merged

Conversation

bnjbvr
Copy link
Member

@bnjbvr bnjbvr commented Apr 29, 2024

The clippy website explains that Box::new(Default::default()) can be shortened to Box::default() and that it's more readable. That's true… when you don't have a generic parameter in the mix (which may be required if rustc can't infer the type of the boxee), in which case it just looks bad, e.g. Box::<MyType>::default() instead of Box::new(MyType::default()).

I do strongly prefer the latter, and propose to get rid of the lint, as a result.

The clippy website explains that `Box::new(Default::default())` can be
shortened to `Box::default()` and that it's more readable. That's true…
when you don't have a generic parameter in the mix (which may be
required if rustc can't infer the type of the boxee), in which case it
just looks bad, e.g. `Box::<MyType>::default()` instead of
`Box::new(MyType::default())`.

I do strongly prefer the latter, and propose to get rid of the lint, as
a result.
@bnjbvr bnjbvr requested a review from a team as a code owner April 29, 2024 11:15
@bnjbvr bnjbvr requested review from Hywan and removed request for a team April 29, 2024 11:15
Copy link

codecov bot commented Apr 29, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 83.65%. Comparing base (5e2a246) to head (502ee96).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3360   +/-   ##
=======================================
  Coverage   83.65%   83.65%           
=======================================
  Files         242      242           
  Lines       25012    25012           
=======================================
+ Hits        20923    20925    +2     
+ Misses       4089     4087    -2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@bnjbvr bnjbvr merged commit 16eb449 into main Apr 29, 2024
35 checks passed
@bnjbvr bnjbvr deleted the bnjbvr/disable-box-default-clippy branch April 29, 2024 12:32
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.

3 participants