Skip to content

collections: update docs of slice get() and friends#38216

Closed
birkenfeld wants to merge 1 commit into
rust-lang:masterfrom
birkenfeld:slice-doc
Closed

collections: update docs of slice get() and friends#38216
birkenfeld wants to merge 1 commit into
rust-lang:masterfrom
birkenfeld:slice-doc

Conversation

@birkenfeld

Copy link
Copy Markdown
Contributor

for the new SliceIndex trait. Also made the docs of the unchecked
versions a bit clearer; they return a reference, not an "unsafe
pointer".

@rust-highfive

Copy link
Copy Markdown
Contributor

r? @aturon

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

@frewsxcv

frewsxcv commented Dec 7, 2016

Copy link
Copy Markdown
Contributor

Looks like Travis found an error in a doc example.

Comment thread src/libcollections/slice.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.

It might be more clear to spell out the overloading in more detail here -- that is, to say something like:

  • If given a position, returns the element at that position of None if out of bounds.
  • If given a range, returns the subslice corresponding to that range, or None if out of bounds.

And similarly elsewhere.

Otherwise r=me once travis is happy.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Tried to do that now without too much repetition. Let me know if you want the details in all the method docs.

Comment thread src/libcollections/slice.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.

Extra whitespace in here.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixing.

Comment thread src/libcollections/slice.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.

Missing url for None.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Huh? There are more instances of None without a link in the file. Does it have to be linked every time?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Not to mention that every reference to None seems to be different. There's (all in non-std crates that get re-exported to std)

[`None`]: ../../std/option/enum.Option.html#variant.None
[`None`]: option/enum.Option.html#variant.None
[option]: ../../std/option/enum.Option.html

Which is the preferred one?

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.

The first one. And yes, every method/struct/enum/... should be linked. I'm currently fixing all this but when I see a PR, I try to enforce it there as well.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done!

Comment thread src/libcollections/slice.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.

Same.

@GuillaumeGomez GuillaumeGomez 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.

Just one last issue! :)

Comment thread src/libcollections/slice.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.

Missing get url. Also, should be get().

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

So that's just #method.get I assume?

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.

Normally yes.

@birkenfeld

Copy link
Copy Markdown
Contributor Author

ping?

@GuillaumeGomez

Copy link
Copy Markdown
Member

Don't forget to ping people (just like you did) once you updated. :)

Thanks for your work!

@bors: r+ rollup

@bors

bors commented Dec 15, 2016

Copy link
Copy Markdown
Collaborator

📌 Commit 6a80241 has been approved by GuillaumeGomez

@frewsxcv

Copy link
Copy Markdown
Contributor

It looks like the Option links are broken in this PR:

Linkcheck stage2 (x86_64-unknown-linux-gnu)
std/primitive.slice.html:185: broken link - /checkout/obj/build/x86_64-unknown-linux-gnu/std/option/enum.Option.html
std/primitive.slice.html:187: broken link - /checkout/obj/build/x86_64-unknown-linux-gnu/std/option/enum.Option.html
std/primitive.slice.html:199: broken link - /checkout/obj/build/x86_64-unknown-linux-gnu/std/option/enum.Option.html

@frewsxcv

Copy link
Copy Markdown
Contributor

@bors r-

@frewsxcv

Copy link
Copy Markdown
Contributor

No need to hold these changes up for the links, so feel free to remove them. The doc links are very fragile right now and need improvement.

Comment thread src/libcollections/slice.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.

There is an extra "..". Should be: ../std/option/enum.Option.html#variant.None.

Comment thread src/libcollections/slice.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.

Same as above.

@GuillaumeGomez

Copy link
Copy Markdown
Member

Please fix the url. If this change doesn't work, then just remove them but I'd like to give it a try first.

for the new SliceIndex trait.  Also made the docs of the unchecked
versions a bit clearer; they return a reference, not an "unsafe
pointer".
@birkenfeld

birkenfeld commented Dec 16, 2016

Copy link
Copy Markdown
Contributor Author

Ok, updated. If it is still not ok, you got access to the branch. I think project owners can do these small fixups much quicker on their own.

@GuillaumeGomez

Copy link
Copy Markdown
Member

Still broken urls. Well, let's just forget about them this time. I'll remove them from your PR in the next days (if you don't update it before). :)

@birkenfeld

Copy link
Copy Markdown
Contributor Author

Aren't they now exactly how you said they should be?

@GuillaumeGomez

Copy link
Copy Markdown
Member

Yes, but now they need a supplementary ".." it said it wasn't needed previously (take a look at the CI for the details). Since I can't explain this behaviour, let's just forget about the urls (even if it pains me a lot...).

@alexcrichton

Copy link
Copy Markdown
Member

Closing due to inactivity, but feel free to resubmit with tests fixed!

GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this pull request Jan 19, 2017
collections: update docs of slice get() and friends

Resubmit of rust-lang#38216.

r? @GuillaumeGomez

BTW, instead of closing a PR just because it is old and the team member who offered to fix it up did not have the time to do so, why not ping them instead? (cc @alexcrichton)
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.

7 participants