Rollup merge of #36396 - athulappadan:Default-docs, r=bluss

Documentation of what Default does for each type

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
This commit is contained in:
Guillaume Gomez 2016-09-14 17:15:37 +02:00 committed by GitHub
commit a89690ec00
30 changed files with 38 additions and 0 deletions

View file

@ -263,6 +263,7 @@ impl<T: Clone> Clone for BinaryHeap<T> {
#[stable(feature = "rust1", since = "1.0.0")]
impl<T: Ord> Default for BinaryHeap<T> {
/// Creates an empty `BinaryHeap<T>`.
#[inline]
fn default() -> BinaryHeap<T> {
BinaryHeap::new()

View file

@ -249,6 +249,7 @@ impl<'a, B: ?Sized> Default for Cow<'a, B>
where B: ToOwned,
<B as ToOwned>::Owned: Default
{
/// Creates an owned Cow<'a, B> with the default value for the contained owned value.
fn default() -> Cow<'a, B> {
Owned(<B as ToOwned>::Owned::default())
}

View file

@ -1667,6 +1667,7 @@ impl<K: Hash, V: Hash> Hash for BTreeMap<K, V> {
}
impl<K: Ord, V> Default for BTreeMap<K, V> {
/// Creates an empty `BTreeMap<K, V>`.
fn default() -> BTreeMap<K, V> {
BTreeMap::new()
}

View file

@ -674,6 +674,7 @@ impl<'a, T: 'a + Ord + Copy> Extend<&'a T> for BTreeSet<T> {
#[stable(feature = "rust1", since = "1.0.0")]
impl<T: Ord> Default for BTreeSet<T> {
/// Makes an empty `BTreeSet<T>` with a reasonable choice of B.
fn default() -> BTreeSet<T> {
BTreeSet::new()
}

View file

@ -164,6 +164,7 @@ impl<T> LinkedList<T> {
#[stable(feature = "rust1", since = "1.0.0")]
impl<T> Default for LinkedList<T> {
/// Creates an empty `LinkedList<T>`.
#[inline]
fn default() -> Self {
Self::new()

View file

@ -1567,6 +1567,7 @@ impl_eq! { Cow<'a, str>, String }
#[stable(feature = "rust1", since = "1.0.0")]
impl Default for String {
/// Creates an empty `String`.
#[inline]
fn default() -> String {
String::new()

View file

@ -1652,6 +1652,7 @@ impl<T> Drop for Vec<T> {
#[stable(feature = "rust1", since = "1.0.0")]
impl<T> Default for Vec<T> {
/// Creates an empty `Vec<T>`.
fn default() -> Vec<T> {
Vec::new()
}

View file

@ -84,6 +84,7 @@ impl<T> Drop for VecDeque<T> {
#[stable(feature = "rust1", since = "1.0.0")]
impl<T> Default for VecDeque<T> {
/// Creates an empty `VecDeque<T>`.
#[inline]
fn default() -> VecDeque<T> {
VecDeque::new()