-
Notifications
You must be signed in to change notification settings - Fork 64
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
Impl fmt::Write
for Either
#113
Conversation
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.
Thanks for the PR! Just one small nit/question.
Happy to hear we can do something to make rustdoc a little better. :)
src/lib.rs
Outdated
R: fmt::Write, | ||
{ | ||
fn write_str(&mut self, s: &str) -> fmt::Result { | ||
for_both!(*self, ref mut inner => inner.write_str(s)) |
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.
If you write this instead, can you do this without the ref mut
?
for_both!(*self, ref mut inner => inner.write_str(s)) | |
for_both!(self, inner => inner.write_str(s)) |
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.
Fixed and rebased.
BTW, I was doing this just to be consistent with the rest of the code, e.g.:
Line 1410 in bd0fe70
for_both!(*self, ref inner => inner.fmt(f)) |
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.
Looks like that was pushed 10 years ago, so it's either a historical accident, or.a quirk of pattern ergonomics.
We'll see if the change passes CI...
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.
Probably happened before match ergonomics were improved. I was gonna open a PR to simplify all those patterns, but have already opened 3 just today, so I'll wait with that. 😅
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.
LGTM!
BTW, I was surprised CI is green without #112 , but I think it's just because the registry is cached! |
In my experience with maintaining zerocopy (msrv of 1.55), if you blow away the |
Except 1.37 is so old it doesn't respect the |
Ah, I could have sworn we already had this, but that was |
Found myself needing this (while working on
rustdoc
).