Skip to content

rustdoc: extend UdpSocket API doc (#657) - #44378

Merged
bors merged 1 commit into
rust-lang:masterfrom
frehberg:rustdoc
Sep 15, 2017
Merged

rustdoc: extend UdpSocket API doc (#657)#44378
bors merged 1 commit into
rust-lang:masterfrom
frehberg:rustdoc

Conversation

@frehberg

Copy link
Copy Markdown
Contributor

@rust-highfive

Copy link
Copy Markdown
Contributor

r? @aturon

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

@frehberg

Copy link
Copy Markdown
ContributorAuthor

@dtolnay please review

@matticomattico left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Some ideas about the wording

Comment threadsrc/libstd/net/udp.rs Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

// Read a single message from the socket.
// If `buf` is too small to hold the message, it will be cut off.

Comment threadsrc/libstd/net/udp.rs Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

// create a slice into the buffer that's no longer than the received data

@aidanhs

Copy link
Copy Markdown
Contributor

Thanks for the PR @frehberg! We'll check in now and again to make sure @aturon or another reviewer gets to this soon.

@aidanhsaidanhs added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Sep 7, 2017
@dtolnaydtolnay assigned dtolnay and unassigned aturonSep 7, 2017

@dtolnaydtolnay left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks! This is a nice improvement.

Both of my comments apply elsewhere in this PR as well.

Comment threadsrc/libstd/net/udp.rs Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

// Read a single message from the socket. If `buf` is too small to hold// the message, it will be cut off.letmut buf = [0;10];let(amt, src) = socket.recv_from(&mut buf)?;// send a reply to the socket we received data fromlet buf = &mut buf[..amt];// create a slice into the buffer that's// no longer than the received data

This feels jarring to me in that it uses a mix of sentence-case and lowercase, punctuation and no punctuation, and full line and end of line comments. Could you tidy this up to make it feel more consistent? Typically I prefer sentence-case, with punctuation, and comments without any code on the same line. But check the rest of this module because if everything else is consistently in a different style, let's follow that.

Comment threadsrc/libstd/net/udp.rs Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Quoting from the documentation documentation:

The first line of a documentation comment should be a short summary of its functionality. One sentence. Just the basics. High level.

(I think by "line" they mean "paragraph" -- everything before the first blank line. The first paragraph is special in rustdoc. For example it is visible in the module-level documentation before you click through on the function.)

Everything you wrote is important to document but not all of it is high level basics. Could you split this into two paragraphs? The first one should give a general understanding of what the function does, and the second fills in the details.

@frehberg

Copy link
Copy Markdown
ContributorAuthor

Text has been modified, hope it fits now

@steveklabnik

Copy link
Copy Markdown
Contributor
[00:02:54] tidy error: /checkout/src/libstd/net/udp.rs:107: trailing whitespace
[00:02:54] tidy error: /checkout/src/libstd/net/udp.rs:139: trailing whitespace

@dtolnaydtolnay left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Almost looks good to me but please rephrase all three other comments to be consistent with the one I indicated. There are a few inconsistencies.

Read a single message from the socket
Receives a single datagram message from socket
Receives a single datagram message on the socket
Receives single datagram on the socket

... on success returning number of bytes
On success returning number of bytes
On success, returns the number of bytes

Comment threadsrc/libstd/net/udp.rs Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This one is great.

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

one more iteration ;)

@steveklabnik

Copy link
Copy Markdown
Contributor
[00:03:28] tidy error: /checkout/src/libstd/net/udp.rs:107: trailing whitespace
[00:03:28] tidy error: /checkout/src/libstd/net/udp.rs:139: trailing whitespace

@dtolnay

Copy link
Copy Markdown
Member

I don't think #44378 (review) has been addressed yet.

@frehberg

Copy link
Copy Markdown
ContributorAuthor

finally. Thanks for your patience

@steveklabnik

Copy link
Copy Markdown
Contributor

No problem! Thanks for keeping with it!

@bors: r+ rollup

@bors

bors commented Sep 11, 2017

Copy link
Copy Markdown
Collaborator

📌 Commit 04b8747 has been approved by steveklabnik

@dtolnay

Copy link
Copy Markdown
Member

On success returning the number of bytes read.

I don't think this sentence is grammatically correct -- just like "Going fishing" is not a complete sentence. I would prefer to word this (and the other ones similarly) like the one I indicated in #44378 (review):

On success, returns the number of bytes read.

@bors r-

@frehberg

Copy link
Copy Markdown
ContributorAuthor

finally, finally

@frehberg

Copy link
Copy Markdown
ContributorAuthor

Ready to merge?

@dtolnaydtolnay left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@bors r+ rollup

@dtolnay

Copy link
Copy Markdown
Member

@bors r+ rollup

@bors

bors commented Sep 14, 2017

Copy link
Copy Markdown
Collaborator

📌 Commit 85a9d97 has been approved by dtolnay

frewsxcv added a commit to frewsxcv/rust that referenced this pull request Sep 15, 2017
@frewsxcvfrewsxcv mentioned this pull request Sep 15, 2017
bors added a commit that referenced this pull request Sep 15, 2017
@bors
bors merged commit 85a9d97 into rust-lang:masterSep 15, 2017
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-reviewStatus: Awaiting review from the assignee but also interested parties.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants

@frehberg@rust-highfive@aidanhs@steveklabnik@dtolnay@bors@mattico@XuHuanTiem@aturon