-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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 fmt traits for collections #20932
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @alexcrichton (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. The way Github handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see CONTRIBUTING.md for more information. |
if i != 0 { try!(write!(f, ", ")); } | ||
try!(write!(f, "{:?}: {:?}", *k, *v)); | ||
} | ||
macro_rules! fmt_btree_map { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps these macros could be refactored to generic functions? I think basically all of them work off some form of iterator, so perhaps that could be a private implementation detail of this library for now?
cc @gankro, curious what you think of this. |
We already leverage a fair amount of iterator-utility magic in the collections, I would think that a lot of these can be written in terms of some basic iterator utility that is added to appropriate iterators via some trait. You would need to have seperate utils for printing like a map vs a sequence, though. |
Also have we actually settled the conventions for the output these should produce? CC @aturon |
@gankro still settling: rust-lang/rfcs#565 |
- added some tests to run-pass/ifmt as well
This does not merge cleanly any more. |
(Conventions are now settled, rust-lang/rfcs#565) |
I'll have an updated PR soon (2-3 days) |
c7a7bc0
to
af1f2aa
Compare
Closing due to inactivity, but feel free to reopen with a rebase! |
@alexcrichton |
@skullzzz Just submit a new PR :) |
@skullzzz just for github knowledge: you can only re-open an issue or pull request if you closed it or have push access to the repository. |
@skullzzz ah yes sorry, I always forget that github only shows the reopen button to committers I think.. A new PR would do well though :) |
Closes #19670