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

Provide a cleaner documentation for 'write!' #35279

Merged
merged 3 commits into from
Aug 12, 2016
Merged

Provide a cleaner documentation for 'write!' #35279

merged 3 commits into from
Aug 12, 2016

Conversation

cengiz-io
Copy link
Contributor

Hello!

This is my attempt to fix #35110

Any feedback is more than welcome!

Cheers!

@rust-highfive
Copy link
Collaborator

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @brson (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. Due to 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 the contribution instructions for more information.

/// This macro takes an implementer of [`std::fmt::Write`][fmt_write] or
/// [`std::io::Write`][io_write] trait, a precompiled format string, and a list of arguments.
///
/// Implementors of the `Write` trait are sometimes called 'writers'.
Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure which is correct, but on line 237 we have "Implementors" (with an O) and on line 234 "implementer" (with an E).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmm. Thanks for noticing.

I'm not sure though. This says they're just different spellings. https://en.wiktionary.org/wiki/implementer#English

And I grepped both of them right now

user@host:~/Source/rust/src(master⚡) » ack "mplementor" -c -h
89
user@host:~/Source/rust/src(master⚡) » ack "mplementer" -c -h
13

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I decided to use "Implementor"

@brson
Copy link
Contributor

brson commented Aug 4, 2016

Thanks @cengizio. This is definitely an improvement.

The new description 'Calls write_fmt function on a writer' strikes me as slightly less helpful. The write_fmt function is more-or-less an implementation detail of the various formatting macros - most people won't know what it is. The idea that you are writing formatted data to that writer seems important to convey. Sorry I have no concrete suggestion just now.

cc @nagisa

@@ -231,8 +231,8 @@ macro_rules! try {

/// Calls `write_fmt` function on a writer
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@steveklabnik Hello. Can you suggest a better, "friendlier" description instead of this? 😄

@cengiz-io
Copy link
Contributor Author

cengiz-io commented Aug 4, 2016

@brson Thank you!

You're right. I wasn't happy with the new description I came up either.

We should come up with a better one.

I wanted to warn the developer about duck typing and two different return types with two different writers.

@@ -229,14 +229,26 @@ macro_rules! try {
})
}

/// Use the `format!` syntax to write data into a buffer.
/// Calls `write_fmt` function on a writer
Copy link
Member

@nagisa nagisa Aug 4, 2016

Choose a reason for hiding this comment

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

Perhaps

Write formatted data into a buffer

could be a better first sentence? Note that this sentence is a short summary that user will see in rustdoc search and various listings, so it is not necessary to provide implementation details here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That looks much better. Thank you.

I was already aware that it needed to be as short as possible, since I compiled the docs and experienced it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

One question, should it be "Writes" or "Write"?

Some macros "Ensure", some "Asserts". I'm confused

Copy link
Member

Choose a reason for hiding this comment

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

Either works, I guess. I’m ambivalent, but @steveklabnik might have a stronger preference towards one of them.

@nagisa
Copy link
Member

nagisa commented Aug 4, 2016

Thanks for taking this! It certainly looks better than before.

@steveklabnik
Copy link
Member

LGTM 👍

@brson
Copy link
Contributor

brson commented Aug 9, 2016

@bors r+ rollup thanks @cengizio !

@bors
Copy link
Contributor

bors commented Aug 9, 2016

📌 Commit c630bea has been approved by brson

@cengiz-io
Copy link
Contributor Author

Thanks everybody!

I think this will be merged later.

Am I right?

@steveklabnik
Copy link
Member

@cengizio yup! all r+'d commits go into a queue: https://buildbot.rust-lang.org/homu/queue/rust

@bors then tests them and does the merge. You shoudn't need to do anything unless for some reason, @bors finds a problem.

steveklabnik added a commit to steveklabnik/rust that referenced this pull request Aug 10, 2016
Provide a cleaner documentation for 'write!'

Hello!

This is my attempt to fix rust-lang#35110

Any feedback is more than welcome!

Cheers!
sophiajt pushed a commit to sophiajt/rust that referenced this pull request Aug 10, 2016
Provide a cleaner documentation for 'write!'

Hello!

This is my attempt to fix rust-lang#35110

Any feedback is more than welcome!

Cheers!
sophiajt pushed a commit to sophiajt/rust that referenced this pull request Aug 11, 2016
Provide a cleaner documentation for 'write!'

Hello!

This is my attempt to fix rust-lang#35110

Any feedback is more than welcome!

Cheers!
bors added a commit that referenced this pull request Aug 11, 2016
@bors bors merged commit c630bea into rust-lang:master Aug 12, 2016
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.

Documentation is not entirely clear what write! returns
7 participants