Clarify last element in str.{r,}splitn documentation#36930
Clarify last element in str.{r,}splitn documentation#36930bors merged 1 commit intorust-lang:masterfrom angelsl:issue-36202
Conversation
|
r? @brson (rust_highfive has picked a reviewer for you, use r? to override) |
src/libcollections/str.rs
Outdated
There was a problem hiding this comment.
I think, as a whole, your changes are an improvement and make it easier to understand this concept.
If a
countth substring
I personally stumbled on this though. It took me a few re-reads to understand this is talking about "substring with countth number of items". I can't think of a better suggestion at the moment without making it too verbose. Going to think about this...
There was a problem hiding this comment.
For non-english reader, this is particurlarly hard.
There was a problem hiding this comment.
How about this:
If
countsubstrings are returned, the last substring i.e. thecountth substring will contain the remainder of the string.
There was a problem hiding this comment.
I think that's better. Or maybe even:
If
countsubstrings are returned, the last substring (thecountth substring) will contain the remainder of the string.
What do you think @GuillaumeGomez ?
There was a problem hiding this comment.
Crazy idea: rename the parameter from count to n (slice::splitn's parameter is called n). Then we can say "the nth substring" which is probably easier to parse.
There was a problem hiding this comment.
I'm generally against single letter variable names, but considering the method name is splitn, I think n makes sense. What do you think @angelsl? If you're alright with it, can you rename the parameter and update the instances of count in the doc comment?
There was a problem hiding this comment.
Sounds good to me. I've amended the commit.
|
Looks great, thanks! r=me |
|
@bors: r=frewsxcv rollup |
|
📌 Commit a4e9c39 has been approved by |
Clarify last element in str.{r,}splitn documentation
An attempt at rust-lang#36202.
I'm not sure if my wording is actually clearer, to be honest...
An attempt at #36202.
I'm not sure if my wording is actually clearer, to be honest...