-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Advertise Vec in LinkedList docs #38297
Conversation
479923f
to
8a4a8ca
Compare
Question: how should I cross-link the docs? Relative paths won't work for |
This is one area where we can't 😦 |
//! in constant time. | ||
//! | ||
//! Almost always it is better to use [`Vec`](../vec/struct.Vec.html) or | ||
//! [`VecDeque`](./vec_deque/struct.VecDeque.html) instead of `LinkedList`. |
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.
Since this is a module-level doc comment, I guess LinkedList
should have an url.
/// The `LinkedList` allows pushing and popping elements at either end | ||
/// in constant time. | ||
/// | ||
/// Almost always it is better to use [`Vec`](../vec/struct.Vec.html) or |
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.
We don't use this linking syntax, we use:
text long text etc [link] blabla
blablabla
[link]: url
/// in constant time. | ||
/// | ||
/// Almost always it is better to use [`Vec`](../vec/struct.Vec.html) or | ||
/// [`VecDeque`](./vec_deque/struct.VecDeque.html) instead of `LinkedList`. |
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.
Same comment.
//! in constant time. | ||
//! | ||
//! Almost always it is better to use [`Vec`](../vec/struct.Vec.html) or | ||
//! [`VecDeque`](./vec_deque/struct.VecDeque.html) instead of `LinkedList`. |
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.
Same comment.
//! The `LinkedList` allows pushing and popping elements at either end | ||
//! in constant time. | ||
//! | ||
//! Almost always it is better to use [`Vec`](../vec/struct.Vec.html) or |
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.
Same comment.
1065395
to
8ea3d32
Compare
So let's use links in the module docs, because they always work, and let's avoid links on the struct directly, because it is reexported. |
|
d46374d
to
1c868ee
Compare
1c868ee
to
71de148
Compare
Linking to |
/// The `LinkedList` allows pushing and popping elements at either end | ||
/// in constant time. | ||
/// | ||
/// Almost always it is better to use `Vec` or `VecDeque` instead of |
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.
Why not linking to VecDeque here? You did it just above.
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.
LinkedList struct is visible as both https://doc.rust-lang.org/std/collections/struct.LinkedList.html and https://doc.rust-lang.org/std/collections/linked_list/struct.LinkedList.html, so I can't craft a relative link that will be valid in both cases.
but for the linked_list
module I can do this.
@GuillaumeGomez anything else to clean up here? |
Nothing, thanks! @bors: r+ rollup |
📌 Commit 71de148 has been approved by |
⌛ Testing commit 71de148 with merge d365d32... |
💔 Test failed - auto-mac-32-opt |
@bors: retry |
…r=GuillaumeGomez Advertise Vec in LinkedList docs r? @steveklabnik Hi! We already [advise](https://doc.rust-lang.org/std/collections/#use-a-linkedlist-when) to use `Vec` instead of `LinkedList` in the top-level collections documentation. But I think it may be missed by someone who just directly finds `LinkedList`. What do you feel about advertising `Vec` directly in `LinkedList` docs as well?
r? @steveklabnik
Hi! We already advise to use
Vec
instead ofLinkedList
in the top-level collections documentation. But I think it may be missed by someone who just directly findsLinkedList
.What do you feel about advertising
Vec
directly inLinkedList
docs as well?