Documentation of what Default does for each type#36396
Documentation of what Default does for each type#36396bors merged 3 commits intorust-lang:masterfrom
Conversation
|
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @steveklabnik (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. |
src/libcollections/borrow.rs
Outdated
| where B: ToOwned, | ||
| <B as ToOwned>::Owned: Default | ||
| { | ||
| /// Creates a `Cow<'a, B>` pointer. |
There was a problem hiding this comment.
This is wrong. Cow is not a pointer either. Default for Cow is
Creates an owned
Cow<'a, B>with the default value for the contained owned value.
or something.
src/libcore/sync/atomic.rs
Outdated
| #[cfg(target_has_atomic = "ptr")] | ||
| #[stable(feature = "rust1", since = "1.0.0")] | ||
| impl<T> Default for AtomicPtr<T> { | ||
| /// Creates an `AtomicPtr<T>` with an initial mutable null pointer. |
There was a problem hiding this comment.
Mutability is irrelevant here.
Creates a null
AtomicPtr<T>
might be better and more concise.
|
Thanks, documenting these properly is a big improvement to docs. The readers had to guess what Default would do previously |
|
Thanks for the suggestions. Will push the changes soon. |
41881e8 to
49e77db
Compare
|
@bors r+ |
|
📌 Commit 41881e8 has been approved by |
|
@bors rollup |
src/libcollections/btree/set.rs
Outdated
|
|
||
| #[stable(feature = "rust1", since = "1.0.0")] | ||
| impl<T: Ord> Default for BTreeSet<T> { | ||
| /// Makes a empty `BTreeSet<T>` with a reasonable choice of B. |
|
@bors: r=bluss rollup (Also, thank you so much for this PR!) |
|
📌 Commit 5798003 has been approved by |
Documentation of what Default does for each type Addresses rust-lang#36265 I haven't changed the following types due to doubts: 1)src/libstd/ffi/c_str.rs 2)src/libcore/iter/sources.rs 3)src/libcore/hash/mod.rs 4)src/libcore/hash/mod.rs 5)src/librustc/middle/privacy.rs r? @steveklabnik
Addresses #36265
I haven't changed the following types due to doubts:
1)src/libstd/ffi/c_str.rs
2)src/libcore/iter/sources.rs
3)src/libcore/hash/mod.rs
4)src/libcore/hash/mod.rs
5)src/librustc/middle/privacy.rs
r? @steveklabnik