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

Update debug helpers and use it for stdlib collections #23810

Merged
merged 4 commits into from
Mar 29, 2015

Conversation

sfackler
Copy link
Member

The collections debug helpers no longer prefix output with the
collection name, in line with the current conventions for Debug
implementations. Implementations that want to preserve the current
behavior can simply add a try!(write!(fmt, "TypeName ")); at the
beginning of the fmt method.

[breaking-change]

@sfackler
Copy link
Member Author

r? @aturon

@rust-highfive rust-highfive assigned aturon and unassigned nikomatsakis Mar 28, 2015
@rust-highfive
Copy link
Collaborator

r? @nikomatsakis

(rust_highfive has picked a reviewer for you, use r? to override)

The collections debug helpers no longer prefix output with the
collection name, in line with the current conventions for Debug
implementations. Implementations that want to preserve the current
behavior can simply add a `try!(write!(fmt, "TypeName "));` at the
beginning of the `fmt` method.

[breaking-change]
}

write!(f, "}}")
builder.finish()
Copy link
Member

Choose a reason for hiding this comment

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

This may actually be a prime spot for a fold:

self.iter().fold(f.debug_map(), |b, (k, v)| b.entry(k, v)).finish()

Copy link
Member Author

Choose a reason for hiding this comment

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

Ooh nice!

@alexcrichton
Copy link
Member

r=me with some fold usage, thanks!

@sfackler
Copy link
Member Author

By the way, [T]'s Debug impl currently uses the alternate flag to drop the []s. Seems like it should be converted over to the new conventions though, right?

@alexcrichton
Copy link
Member

Yeah that sounds good to me

Also convert [T]'s Debug impl. The behavior of the alternate flag here's
changing.
@sfackler
Copy link
Member Author

@bors r=alexcrichton b82bcec

@sfackler
Copy link
Member Author

@bors r=alexcrichton 14926ca

@bors
Copy link
Contributor

bors commented Mar 28, 2015

⌛ Testing commit 14926ca with merge b37e37e...

@bors
Copy link
Contributor

bors commented Mar 28, 2015

💔 Test failed - auto-mac-64-opt

@sfackler
Copy link
Member Author

@bors r=alexcrichton 842e6cf

@sfackler
Copy link
Member Author

@bors r=alexcrichton 10feb40

@bors
Copy link
Contributor

bors commented Mar 29, 2015

⌛ Testing commit 10feb40 with merge c67e4b4...

@bors
Copy link
Contributor

bors commented Mar 29, 2015

💔 Test failed - auto-mac-64-opt

@sfackler
Copy link
Member Author

@bors r=alexcrichton 3c0c8fc

bors added a commit that referenced this pull request Mar 29, 2015
The collections debug helpers no longer prefix output with the
collection name, in line with the current conventions for Debug
implementations. Implementations that want to preserve the current
behavior can simply add a `try!(write!(fmt, "TypeName "));` at the
beginning of the `fmt` method.

[breaking-change]
@bors
Copy link
Contributor

bors commented Mar 29, 2015

⌛ Testing commit 3c0c8fc with merge 227b46b...

@bors bors merged commit 3c0c8fc into rust-lang:master Mar 29, 2015
@sfackler sfackler deleted the debug-collections branch November 26, 2016 05:50
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.

6 participants