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

refactor: use Display instead of multiple println!s for inspection results #52

Merged
merged 1 commit into from
Sep 29, 2023

Conversation

divarvel
Copy link
Collaborator

This allows calling println only once

self.snapshot.render();
impl Display for SnapshotInspectionResults {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
self.snapshot.fmt(f)?;
Copy link

@romgus romgus Sep 28, 2023

Choose a reason for hiding this comment

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

Why fmt(f) and not writeln!(f, ...)?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This delegates to the snapshot's Display instance.

@divarvel divarvel merged commit dab47a1 into main Sep 29, 2023
1 check passed
@divarvel divarvel deleted the render branch September 29, 2023 08:45
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.

2 participants