Skip to content

Conversation

Breakdown-Dog
Copy link
Contributor

Objective

  • This commit refactors the from_viewport_and_override function to improve readability and safety.

Solution

  • Replaces the initial cloned() and subsequent if/else logic with a clearer if let structure.
  • Removes the need for unwrap() by handling both Some and None cases

Testing

  • I don't know how to make sure there is no probelm, but I run some examples and I don't see the errors.

@janis-bhm janis-bhm added D-Trivial Nice and easy! A great choice to get started with Bevy C-Code-Quality A section of code that is hard to understand or change S-Needs-Review Needs reviewer attention (from anyone!) to move forward A-Camera User-facing camera APIs and controllers. labels Oct 11, 2025
Copy link
Contributor

@janis-bhm janis-bhm left a comment

Choose a reason for hiding this comment

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

Getting rid of the unwrap() is definitely an improvement! Personally, I do think it could be made even clearer with unwrap_or_default and/or map_or_else on the override.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Camera User-facing camera APIs and controllers. C-Code-Quality A section of code that is hard to understand or change D-Trivial Nice and easy! A great choice to get started with Bevy S-Needs-Review Needs reviewer attention (from anyone!) to move forward

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants