Skip to content

Conversation

JohnTheCoolingFan
Copy link

Usage of magic numbers is discouraged in rust in favor of enums. I've replaced magic numbers that denote axes with an enum that can be converted to an integer when needed. The enum uses less bytes and does not allow invalid states.

pub enum Axis {
X = 0,
Y = 1,
Z = 2,
Copy link
Contributor

@ThierryBerger ThierryBerger May 29, 2024

Choose a reason for hiding this comment

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

in case of 2d dimension, the ZAxis is invalid though, this line should be gated by a

Suggested change
Z = 2,
#[cfg(feature = "dim3")]
Z = 2,

@ThierryBerger ThierryBerger added C-Enhancement New feature or request C-User experience Potential user-experience improvements 2D The issue is specifically about the 2D version of Rapier. 3D The issue is specifically about the 3D version of Rapier. A-Dynamics P-Low D-Easy labels May 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

2D The issue is specifically about the 2D version of Rapier. 3D The issue is specifically about the 3D version of Rapier. A-Dynamics C-Enhancement New feature or request C-User experience Potential user-experience improvements D-Easy P-Low

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants