-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Assorted cleanliness refactors #16250
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
base: main
Are you sure you want to change the base?
Conversation
Please try to include a basic PR description and title: it makes this sort of thing much easier to review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code looks good, but this seems to touch more than just bevy_reflect
. That should probably be mentioned in the title/description as well.
Merging. Please split these out and have a proper description next time though. |
@@ -95,8 +95,7 @@ impl RelativeCursorPosition { | |||
/// A helper function to check if the mouse is over the node | |||
pub fn mouse_over(&self) -> bool { | |||
self.normalized | |||
.map(|position| self.normalized_visible_node_rect.contains(position)) | |||
.unwrap_or(false) | |||
.map_or(false, |position| self.normalized_visible_node_rect.contains(position)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as in #16205, there's some distaste amongst some contributors (me included) with using map_or as it's harder to read because it put the "or" case first
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, hate it.
If map_or
is used in the middle of a chain of composed functions then I can see it might be okay (maybe?). Placed at the end of a chain thouigh I very strongly prefer unwrap_or
.
fn custom_default() -> i32 { | ||
-1 | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would prefer to keep this where it was, duplicated in both tests. this function doesn't really make sense as a "global" function, and it reduces readability by making it far away from where it's used
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this doesn't pass CI and should be fixed first
and please don't open duplicate PRs but update the one you already have, and use the description and title of the PR to provide meaningful information
} | ||
} | ||
name.map(String::into_boxed_str) | ||
name |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ickshonpe is this still relevant? https://github.com/bevyengine/bevy/pull/16205/files#r1829513146
I don't see the issue. 🤔
Looks like #16205 should be closed in favor of this PR. |
Small refactor for some assorted code quality issues.