Skip to content

[Merged by Bors] - Fix clippy issue for benches crate#6806

Closed
lewiszlw wants to merge 3 commits intobevyengine:mainfrom
lewiszlw:fix-clippy-for-benches
Closed

[Merged by Bors] - Fix clippy issue for benches crate#6806
lewiszlw wants to merge 3 commits intobevyengine:mainfrom
lewiszlw:fix-clippy-for-benches

Conversation

@lewiszlw
Copy link
Member

Objective

Solution

  • run cargo clippy --workspace --all-targets --all-features -- -Aclippy::type_complexity -Wclippy::doc_markdown -Wclippy::redundant_else -Wclippy::match_same_arms -Wclippy::semicolon_if_nothing_returned -Wclippy::explicit_iter_loop -Wclippy::map_flatten -Dwarnings under benches dir.
  • fix issue according to suggestion.

@james7132 james7132 added C-Code-Quality A section of code that is hard to understand or change A-Diagnostics Logging, crash handling, error reporting and performance analysis labels Dec 1, 2022
@alice-i-cecile alice-i-cecile added S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it and removed S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it labels Dec 11, 2022
@alice-i-cecile
Copy link
Member

This PR is mergeable in its current form, but the comments raised are valid and it'll be easier to do it here. @lewiszlw want to tackle it, or would you prefer I just merge?

@lewiszlw
Copy link
Member Author

Resolved comments. @alice-i-cecile

for i in 0..size as u64 {
let key = black_box(i);
black_box(map.insert(key, i));
map.insert(key, i);
Copy link
Member

Choose a reason for hiding this comment

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

should map be blackboxed?

Copy link
Member Author

Choose a reason for hiding this comment

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

black_box is a no-op according to hymm's comments, it should be deleted.

Copy link
Member

@mockersf mockersf Dec 11, 2022

Choose a reason for hiding this comment

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

black_box(()); is a no-op, not sure about black_box(map); in this case. black boxes are used to avoid rust optimising out something. in this case it seems map is consumed by the closure, so I don't know if rust will optimise it out.

I'm not saying a black box is needed here, I don't know and am asking 🙂

Copy link
Member Author

Choose a reason for hiding this comment

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

Sorry I misunderstood.

|| s.clone_dynamic(),
|mut s| {
black_box(s.insert(black_box(&field), ()));
s.insert(black_box(&field), ());
Copy link
Member

Choose a reason for hiding this comment

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

should s be blackboxed?

Copy link
Member Author

Choose a reason for hiding this comment

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

black_box is a no-op according to hymm's comments, it should be deleted.

Copy link
Member

Choose a reason for hiding this comment

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

black_box(()); is a no-op, not sure about black_box(s) in this case

@alice-i-cecile alice-i-cecile added S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it and removed S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it labels Dec 11, 2022
@alice-i-cecile
Copy link
Member

Waiting for more clarity on the points raised above.

@alice-i-cecile
Copy link
Member

@lewiszlw could you re-add those black box calls to this PR so we can merge it and investigate the matter elsewhere?

@lewiszlw
Copy link
Member Author

Re-added. Do I need to create an issue to track this?

@alice-i-cecile
Copy link
Member

Re-added. Do I need to create an issue to track this?

That would be lovely :)

bors r+

@alice-i-cecile alice-i-cecile added the S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it label Jan 11, 2023
bors bot pushed a commit that referenced this pull request Jan 11, 2023
# Objective

- #3505 marked `S-Adopt-Me` , this pr is to continue his work.

## Solution

- run `cargo clippy --workspace --all-targets --all-features -- -Aclippy::type_complexity -Wclippy::doc_markdown -Wclippy::redundant_else -Wclippy::match_same_arms -Wclippy::semicolon_if_nothing_returned -Wclippy::explicit_iter_loop -Wclippy::map_flatten -Dwarnings` under benches dir.
- fix issue according to suggestion.
@bors bors bot changed the title Fix clippy issue for benches crate [Merged by Bors] - Fix clippy issue for benches crate Jan 11, 2023
@bors bors bot closed this Jan 11, 2023
alradish pushed a commit to alradish/bevy that referenced this pull request Jan 22, 2023
# Objective

- bevyengine#3505 marked `S-Adopt-Me` , this pr is to continue his work.

## Solution

- run `cargo clippy --workspace --all-targets --all-features -- -Aclippy::type_complexity -Wclippy::doc_markdown -Wclippy::redundant_else -Wclippy::match_same_arms -Wclippy::semicolon_if_nothing_returned -Wclippy::explicit_iter_loop -Wclippy::map_flatten -Dwarnings` under benches dir.
- fix issue according to suggestion.
ItsDoot pushed a commit to ItsDoot/bevy that referenced this pull request Feb 1, 2023
# Objective

- bevyengine#3505 marked `S-Adopt-Me` , this pr is to continue his work.

## Solution

- run `cargo clippy --workspace --all-targets --all-features -- -Aclippy::type_complexity -Wclippy::doc_markdown -Wclippy::redundant_else -Wclippy::match_same_arms -Wclippy::semicolon_if_nothing_returned -Wclippy::explicit_iter_loop -Wclippy::map_flatten -Dwarnings` under benches dir.
- fix issue according to suggestion.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Diagnostics Logging, crash handling, error reporting and performance analysis C-Code-Quality A section of code that is hard to understand or change S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants