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

Implement Display and Debug traits #244

Merged
merged 1 commit into from Feb 18, 2019

Conversation

Projects
None yet
3 participants
@GuillaumeGomez
Copy link
Member

GuillaumeGomez commented Feb 15, 2019

I realised that there were a lot of missing Debug/Display traits implementations. Going through it.

cc @sdroege @EPashkin

impl fmt::Debug for RectangleList {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
if self.ptr.is_null() {
write!(f, "RectangleList")

This comment has been minimized.

@sdroege

sdroege Feb 15, 2019

Member

Is this even valid? Judging from other code here it's not so we don't need to handle that here.

.join(", "))
};

write!(f, "RectangleList {{

This comment has been minimized.

@sdroege

sdroege Feb 15, 2019

Member

Always use the Formatter::debug_*() functions for such things, in this case debug_list() or even simpler

f.debug_tuple("RectangleList")
    .field(&*self)  // &* gives you a &[Rectangle]
    .finish()
@sdroege

This comment has been minimized.

Copy link
Member

sdroege commented Feb 15, 2019

I disagree with all these Display impls but keep them if you really want. Just like in glib/etc they don't fulfill the purpose of Display.

@GuillaumeGomez GuillaumeGomez force-pushed the GuillaumeGomez:display-and-debug branch from 05d8e69 to 8efbcba Feb 15, 2019

@GuillaumeGomez GuillaumeGomez changed the title [WIP] Implement Display and Debug traits Implement Display and Debug traits Feb 15, 2019

@EPashkin

This comment has been minimized.

Copy link
Member

EPashkin commented Feb 15, 2019

@GuillaumeGomez Thanks, 👍 after rebase to master

@GuillaumeGomez GuillaumeGomez force-pushed the GuillaumeGomez:display-and-debug branch from 8efbcba to 58f6481 Feb 15, 2019

@GuillaumeGomez GuillaumeGomez force-pushed the GuillaumeGomez:display-and-debug branch from 58f6481 to d53ab0d Feb 17, 2019

@GuillaumeGomez

This comment has been minimized.

Copy link
Member Author

GuillaumeGomez commented Feb 17, 2019

Updated!

@sdroege

This comment has been minimized.

Copy link
Member

sdroege commented Feb 18, 2019

Go for it then

@GuillaumeGomez

This comment has been minimized.

Copy link
Member Author

GuillaumeGomez commented Feb 18, 2019

Yes sir!

@GuillaumeGomez GuillaumeGomez merged commit 6c211fd into gtk-rs:master Feb 18, 2019

2 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@GuillaumeGomez GuillaumeGomez deleted the GuillaumeGomez:display-and-debug branch Feb 18, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.