From 49e77dbf25ed6526fb5d37c32e55797fb04522f0 Mon Sep 17 00:00:00 2001 From: athulappadan Date: Sun, 11 Sep 2016 17:00:09 +0530 Subject: Documentation of what does for each type --- src/libsyntax/ptr.rs | 1 + 1 file changed, 1 insertion(+) (limited to 'src/libsyntax/ptr.rs') diff --git a/src/libsyntax/ptr.rs b/src/libsyntax/ptr.rs index c3f8a977a65..a65c54ac1e2 100644 --- a/src/libsyntax/ptr.rs +++ b/src/libsyntax/ptr.rs @@ -154,6 +154,7 @@ impl P<[T]> { } impl Default for P<[T]> { + /// Creates a new `P`, with the `Default` value for T. fn default() -> P<[T]> { P::new() } -- cgit 1.4.1-3-g733a5 From 41881e85bd832127f2a6eee5821eaae353dea281 Mon Sep 17 00:00:00 2001 From: athulappadan Date: Sun, 11 Sep 2016 22:58:01 +0530 Subject: Documentation for default types modified --- src/liballoc/arc.rs | 2 +- src/libcollections/borrow.rs | 2 +- src/libcollections/btree/set.rs | 2 +- src/libcollections/vec_deque.rs | 2 +- src/libcore/option.rs | 2 +- src/libcore/slice.rs | 4 ++-- src/libcore/sync/atomic.rs | 2 +- src/libcoretest/hash/mod.rs | 2 -- src/librustc/session/config.rs | 1 - src/libstd/collections/hash/map.rs | 2 +- src/libstd/collections/hash/set.rs | 2 +- src/libstd/ffi/c_str.rs | 2 +- src/libsyntax/ptr.rs | 2 +- 13 files changed, 12 insertions(+), 15 deletions(-) (limited to 'src/libsyntax/ptr.rs') diff --git a/src/liballoc/arc.rs b/src/liballoc/arc.rs index a2923091fb5..3d579641b96 100644 --- a/src/liballoc/arc.rs +++ b/src/liballoc/arc.rs @@ -718,7 +718,7 @@ impl Clone for Weak { #[stable(feature = "downgraded_weak", since = "1.10.0")] impl Default for Weak { - /// Creates a new `Weak`. + /// Constructs a new `Weak` without an accompanying instance of T. fn default() -> Weak { Weak::new() } diff --git a/src/libcollections/borrow.rs b/src/libcollections/borrow.rs index ef136f3356a..700f88dc0f2 100644 --- a/src/libcollections/borrow.rs +++ b/src/libcollections/borrow.rs @@ -249,7 +249,7 @@ impl<'a, B: ?Sized> Default for Cow<'a, B> where B: ToOwned, ::Owned: Default { - /// Creates a `Cow<'a, B>` pointer. + /// Creates an owned Cow<'a, B> with the default value for the contained owned value. fn default() -> Cow<'a, B> { Owned(::Owned::default()) } diff --git a/src/libcollections/btree/set.rs b/src/libcollections/btree/set.rs index 24da81c3e93..49da3aa480c 100644 --- a/src/libcollections/btree/set.rs +++ b/src/libcollections/btree/set.rs @@ -674,7 +674,7 @@ impl<'a, T: 'a + Ord + Copy> Extend<&'a T> for BTreeSet { #[stable(feature = "rust1", since = "1.0.0")] impl Default for BTreeSet { - /// Creates a new `BTreeSet`. + /// Makes a empty `BTreeSet` with a reasonable choice of B. fn default() -> BTreeSet { BTreeSet::new() } diff --git a/src/libcollections/vec_deque.rs b/src/libcollections/vec_deque.rs index efee4914a11..2e561dabb47 100644 --- a/src/libcollections/vec_deque.rs +++ b/src/libcollections/vec_deque.rs @@ -84,7 +84,7 @@ impl Drop for VecDeque { #[stable(feature = "rust1", since = "1.0.0")] impl Default for VecDeque { - /// Creates a `VecDeque` with a constant initial capacity. + /// Creates an empty `VecDeque`. #[inline] fn default() -> VecDeque { VecDeque::new() diff --git a/src/libcore/option.rs b/src/libcore/option.rs index 4c449c6562e..7733b90ec01 100644 --- a/src/libcore/option.rs +++ b/src/libcore/option.rs @@ -698,7 +698,7 @@ fn expect_failed(msg: &str) -> ! { #[stable(feature = "rust1", since = "1.0.0")] impl Default for Option { - /// Creates an instance of None. + /// Returns None. #[inline] fn default() -> Option { None } } diff --git a/src/libcore/slice.rs b/src/libcore/slice.rs index 53d2b3ded67..7b147faccd2 100644 --- a/src/libcore/slice.rs +++ b/src/libcore/slice.rs @@ -755,13 +755,13 @@ impl ops::IndexMut> for [T] { #[stable(feature = "rust1", since = "1.0.0")] impl<'a, T> Default for &'a [T] { - /// Creates an empty Slice. + /// Creates an empty slice. fn default() -> &'a [T] { &[] } } #[stable(feature = "mut_slice_default", since = "1.5.0")] impl<'a, T> Default for &'a mut [T] { - /// Creates a mutable empty Slice. + /// Creates a mutable empty slice. fn default() -> &'a mut [T] { &mut [] } } diff --git a/src/libcore/sync/atomic.rs b/src/libcore/sync/atomic.rs index a5efda702df..f5f37be52de 100644 --- a/src/libcore/sync/atomic.rs +++ b/src/libcore/sync/atomic.rs @@ -118,7 +118,7 @@ pub struct AtomicPtr { #[cfg(target_has_atomic = "ptr")] #[stable(feature = "rust1", since = "1.0.0")] impl Default for AtomicPtr { - /// Creates an `AtomicPtr` with an initial mutable null pointer. + /// Creates a null `AtomicPtr`. fn default() -> AtomicPtr { AtomicPtr::new(::ptr::null_mut()) } diff --git a/src/libcoretest/hash/mod.rs b/src/libcoretest/hash/mod.rs index dec8b57518f..4ea42644ecd 100644 --- a/src/libcoretest/hash/mod.rs +++ b/src/libcoretest/hash/mod.rs @@ -18,7 +18,6 @@ struct MyHasher { } impl Default for MyHasher { - /// Constructs a `MyHasher` with initial value zero. fn default() -> MyHasher { MyHasher { hash: 0 } } @@ -91,7 +90,6 @@ impl Hasher for CustomHasher { } impl Default for CustomHasher { - /// Constructs a `CustomHasher` with initial value zero. fn default() -> CustomHasher { CustomHasher { output: 0 } } diff --git a/src/librustc/session/config.rs b/src/librustc/session/config.rs index 5708f961ada..2009e18f6ee 100644 --- a/src/librustc/session/config.rs +++ b/src/librustc/session/config.rs @@ -84,7 +84,6 @@ pub enum ErrorOutputType { } impl Default for ErrorOutputType { - /// Creates an `HumanReadble`, initialised with `ColorConfig` enum type `Auto`. fn default() -> ErrorOutputType { ErrorOutputType::HumanReadable(ColorConfig::Auto) } diff --git a/src/libstd/collections/hash/map.rs b/src/libstd/collections/hash/map.rs index 48c54c16ed8..eb1653f18cb 100644 --- a/src/libstd/collections/hash/map.rs +++ b/src/libstd/collections/hash/map.rs @@ -1218,7 +1218,7 @@ impl Default for HashMap where K: Eq + Hash, S: BuildHasher + Default, { - /// Creates a `HashMap`, with initial `Default` hasher. + /// Creates an empty `HashMap`, with the `Default` value for the hasher. fn default() -> HashMap { HashMap::with_hasher(Default::default()) } diff --git a/src/libstd/collections/hash/set.rs b/src/libstd/collections/hash/set.rs index b5652bcabf1..ff56747fee6 100644 --- a/src/libstd/collections/hash/set.rs +++ b/src/libstd/collections/hash/set.rs @@ -665,7 +665,7 @@ impl Default for HashSet where T: Eq + Hash, S: BuildHasher + Default, { - /// Creates a `HashSet` with initial `Default` hasher. + /// Creates an empty `HashSet` with the `Default` value for the hasher. fn default() -> HashSet { HashSet::with_hasher(Default::default()) } diff --git a/src/libstd/ffi/c_str.rs b/src/libstd/ffi/c_str.rs index 044112ea136..0f7dc3889f0 100644 --- a/src/libstd/ffi/c_str.rs +++ b/src/libstd/ffi/c_str.rs @@ -339,7 +339,7 @@ impl<'a> Default for &'a CStr { #[stable(feature = "cstr_default", since = "1.10.0")] impl Default for CString { - /// Creates a new `CString`, by calling the `Default` of `CStr`, and then owns it. + /// Creates an empty `CString`. fn default() -> CString { let a: &CStr = Default::default(); a.to_owned() diff --git a/src/libsyntax/ptr.rs b/src/libsyntax/ptr.rs index a65c54ac1e2..58750158931 100644 --- a/src/libsyntax/ptr.rs +++ b/src/libsyntax/ptr.rs @@ -154,7 +154,7 @@ impl P<[T]> { } impl Default for P<[T]> { - /// Creates a new `P`, with the `Default` value for T. + /// Creates an empty `P<[T]>`. fn default() -> P<[T]> { P::new() } -- cgit 1.4.1-3-g733a5