Conversation
MinerSebas
left a comment
There was a problem hiding this comment.
There were several places where an fn was made const, that can't be actually called in a const context as the Type they are implemented for can only be constructed at runtime.
Please revert those functions or try to get a const-constructor.
Also please when change as many Files/Places as here, make 1. Commit for every clippy Lint. this makes it much easier to review each individual Lint.
|
@MinerSebas |
|
A Adding |
|
Some of this work was duplicated in #2934. I think I prefer the clarity and freshness of this PR, if we're picking one to merge. |
|
Thanks @mockersf (Merci François !) I'll apply the suggestions of @MinerSebas and remove the extra @alice-i-cecile I added more clippy fixes like Should I add to the CI config or the |
|
|
||
| /// Returns an iterator of entities that had components of type `T` removed | ||
| /// since the last call to [`World::clear_trackers`]. | ||
| // TODO: return `std::iter::Copied` instead |
There was a problem hiding this comment.
I think we should return a std::iter::Copied here but I don't know if it would be a breaking change or not
|
|
||
| /// Returns an iterator of entities that had components with the given `component_id` removed | ||
| /// since the last call to [`World::clear_trackers`]. | ||
| // TODO: return `std::iter::Copied` instead |
There was a problem hiding this comment.
I think we should return a std::iter::Copied here but I don't know if it would be a breaking change or not
|
Yeah, if we're going to fix pedantic / nursery lints we should toggle them on in CI so they stay fixed. |
To be transparent, this is exactly why I think most of those lints should not be fixed. Adding more things to check will slow down development. Some add enough values to be worth it, but that's not the case of most of the pedantic lints. Also, the pedantic lints are often quite... pedantic and a matter of taste. Some of them are fine, I disagree with a few, and some should be done only sometimes - doing them by a lint remove sense from the code. |
|
@mockersf I agree, many pedantic lints are not worth it. |
|
@ManevilleF do you want to rebase this? If so we can merge it in ASAP after rebasing; otherwise I think we should just close it out to reduce merge conflicts. |
|
As discussed I will close this and open it again from the @mockersf @cart I think the current list of warnings is a good start: Do you have more warnings you wish to add or some to remove? |
|
List of lints, for easy reference. |
|
Personal opinions:
|
# Objective Follow up to my previous MR #3718 to add new clippy warnings to bevy: - [x] [~~option_if_let_else~~](https://rust-lang.github.io/rust-clippy/master/#option_if_let_else) (reverted) - [x] [redundant_else](https://rust-lang.github.io/rust-clippy/master/#redundant_else) - [x] [match_same_arms](https://rust-lang.github.io/rust-clippy/master/#match_same_arms) - [x] [semicolon_if_nothing_returned](https://rust-lang.github.io/rust-clippy/master/#semicolon_if_nothing_returned) - [x] [explicit_iter_loop](https://rust-lang.github.io/rust-clippy/master/#explicit_iter_loop) - [x] [map_flatten](https://rust-lang.github.io/rust-clippy/master/#map_flatten) There is one commit per clippy warning, and the matching flags are added to the CI execution. To test the CI execution you may run `cargo run -p ci -- clippy` at the root. I choose the add the flags in the `ci` tool crate to avoid having them in every `lib.rs` but I guess it could become an issue with suprise warnings coming up after a commit/push Co-authored-by: Carter Anderson <mcanders1@gmail.com>
# Objective Follow up to my previous MR bevyengine#3718 to add new clippy warnings to bevy: - [x] [~~option_if_let_else~~](https://rust-lang.github.io/rust-clippy/master/#option_if_let_else) (reverted) - [x] [redundant_else](https://rust-lang.github.io/rust-clippy/master/#redundant_else) - [x] [match_same_arms](https://rust-lang.github.io/rust-clippy/master/#match_same_arms) - [x] [semicolon_if_nothing_returned](https://rust-lang.github.io/rust-clippy/master/#semicolon_if_nothing_returned) - [x] [explicit_iter_loop](https://rust-lang.github.io/rust-clippy/master/#explicit_iter_loop) - [x] [map_flatten](https://rust-lang.github.io/rust-clippy/master/#map_flatten) There is one commit per clippy warning, and the matching flags are added to the CI execution. To test the CI execution you may run `cargo run -p ci -- clippy` at the root. I choose the add the flags in the `ci` tool crate to avoid having them in every `lib.rs` but I guess it could become an issue with suprise warnings coming up after a commit/push Co-authored-by: Carter Anderson <mcanders1@gmail.com>
# Objective Follow up to my previous MR bevyengine#3718 to add new clippy warnings to bevy: - [x] [~~option_if_let_else~~](https://rust-lang.github.io/rust-clippy/master/#option_if_let_else) (reverted) - [x] [redundant_else](https://rust-lang.github.io/rust-clippy/master/#redundant_else) - [x] [match_same_arms](https://rust-lang.github.io/rust-clippy/master/#match_same_arms) - [x] [semicolon_if_nothing_returned](https://rust-lang.github.io/rust-clippy/master/#semicolon_if_nothing_returned) - [x] [explicit_iter_loop](https://rust-lang.github.io/rust-clippy/master/#explicit_iter_loop) - [x] [map_flatten](https://rust-lang.github.io/rust-clippy/master/#map_flatten) There is one commit per clippy warning, and the matching flags are added to the CI execution. To test the CI execution you may run `cargo run -p ci -- clippy` at the root. I choose the add the flags in the `ci` tool crate to avoid having them in every `lib.rs` but I guess it could become an issue with suprise warnings coming up after a commit/push Co-authored-by: Carter Anderson <mcanders1@gmail.com>
Objective
Fixes some
nurseryandpedanticclippy warnings likeclippy::missing_const_fnclippy::option_if_let_elseclippy::use_selfclippy::redundant_elseclippy::match_same_armsclippy::semicolon_if_returnedclippy::explicit_iter_loopclippy::cloned_instead_of_copiedclippy::map_flattenSolution
I applied many small changes accross all crates.