Skip to content
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

Make OPoint call T::fmt to respect formatting modifiers #1336

Merged
merged 2 commits into from
Dec 20, 2023

Conversation

kurtlawrence
Copy link
Contributor

Invokes T::fmt rather than write!, which allows points to be formatted with modifiers like so:

let p = Point3::new(1.23, 3.45, 5.67);
assert_eq!(&format!("{p}"), "{1.23, 3.45, 5.67}");
assert_eq!(&format!("{p:.1}"), "{1.2, 3.5, 5.7}");
assert_eq!(&format!("{p:.0}"), "{1, 3, 6}");

I was not sure where to place the simple test code, it is currently adjacent in the file.

@Ralith
Copy link
Collaborator

Ralith commented Dec 20, 2023

Nice fix, thanks!

I was not sure where to place the simple test code, it is currently adjacent in the file.

Maybe tests/geometry/point.rs?

@kurtlawrence
Copy link
Contributor Author

Good call, I've moved it there 🙂

Copy link
Collaborator

@Ralith Ralith left a comment

Choose a reason for hiding this comment

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

Thanks!

@Ralith Ralith merged commit 6dce471 into dimforge:dev Dec 20, 2023
11 of 12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants