[Merged by Bors] - Fix clippy issue for benches crate#6806
[Merged by Bors] - Fix clippy issue for benches crate#6806lewiszlw wants to merge 3 commits intobevyengine:mainfrom lewiszlw:fix-clippy-for-benches
Conversation
|
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? |
|
Resolved comments. @alice-i-cecile |
benches/benches/bevy_reflect/map.rs
Outdated
| for i in 0..size as u64 { | ||
| let key = black_box(i); | ||
| black_box(map.insert(key, i)); | ||
| map.insert(key, i); |
There was a problem hiding this comment.
black_box is a no-op according to hymm's comments, it should be deleted.
There was a problem hiding this comment.
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 🙂
| || s.clone_dynamic(), | ||
| |mut s| { | ||
| black_box(s.insert(black_box(&field), ())); | ||
| s.insert(black_box(&field), ()); |
There was a problem hiding this comment.
black_box is a no-op according to hymm's comments, it should be deleted.
There was a problem hiding this comment.
black_box(()); is a no-op, not sure about black_box(s) in this case
|
Waiting for more clarity on the points raised above. |
|
@lewiszlw could you re-add those black box calls to this PR so we can merge it and investigate the matter elsewhere? |
|
Re-added. Do I need to create an issue to track this? |
That would be lovely :) bors r+ |
# 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.
|
Pull request successfully merged into main. Build succeeded:
|
# 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.
# 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.
Objective
S-Adopt-Me, this pr is to continue his work.Solution
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 -Dwarningsunder benches dir.