]> git.lizzy.rs Git - rust.git/commitdiff
Various fixes to wording consistency in the docs
authorStjepan Glavina <stjepang@gmail.com>
Wed, 22 Mar 2017 00:42:23 +0000 (01:42 +0100)
committerStjepan Glavina <stjepang@gmail.com>
Wed, 22 Mar 2017 16:19:52 +0000 (17:19 +0100)
18 files changed:
src/libcollections/binary_heap.rs
src/libcollections/btree/map.rs
src/libcollections/btree/set.rs
src/libcollections/enum_set.rs
src/libcollections/range.rs
src/libcollections/slice.rs
src/libcollections/str.rs
src/libcollections/vec_deque.rs
src/libcore/any.rs
src/libcore/cmp.rs
src/libcore/iter_private.rs
src/libcore/num/bignum.rs
src/libcore/num/mod.rs
src/libcore/ptr.rs
src/libcore/result.rs
src/libcore/slice/mod.rs
src/libcore/slice/sort.rs
src/libcore/str/mod.rs

index 519117ff9e5196ec1a686f5c4e2513c49d9d8707..efa96ca468e0143e23a6e0ef73dd4e6d6979a191 100644 (file)
@@ -930,13 +930,13 @@ fn pos(&self) -> usize {
         self.pos
     }
 
-    /// Return a reference to the element removed
+    /// Returns a reference to the element removed.
     #[inline]
     fn element(&self) -> &T {
         self.elt.as_ref().unwrap()
     }
 
-    /// Return a reference to the element at `index`.
+    /// Returns a reference to the element at `index`.
     ///
     /// Unsafe because index must be within the data slice and not equal to pos.
     #[inline]
index 53fe6b4bc9f4f6bbbbe1dc43d3fcce6e6085ee23..bed216ba3d111b83dd10fac0657854d2de7c08b1 100644 (file)
@@ -526,7 +526,7 @@ pub fn get<Q: ?Sized>(&self, key: &Q) -> Option<&V>
         }
     }
 
-    /// Returns true if the map contains a value for the specified key.
+    /// Returns `true` if the map contains a value for the specified key.
     ///
     /// The key may be any borrowed form of the map's key type, but the ordering
     /// on the borrowed form *must* match the ordering on the key type.
@@ -1965,7 +1965,7 @@ pub fn len(&self) -> usize {
         self.length
     }
 
-    /// Returns true if the map contains no elements.
+    /// Returns `true` if the map contains no elements.
     ///
     /// # Examples
     ///
index 72d25f87bca9515858b9765f7dc047d90841ddc1..9dbb61379379e9177145482ee3267c1c658c25db 100644 (file)
@@ -415,7 +415,7 @@ pub fn len(&self) -> usize {
         self.map.len()
     }
 
-    /// Returns true if the set contains no elements.
+    /// Returns `true` if the set contains no elements.
     ///
     /// # Examples
     ///
index 602e874aaeec0de2d0416b93f67e6733a3ed27a7..e56b94b2e1ea296d7c8531a647f2959b2c553bc9 100644 (file)
@@ -106,7 +106,7 @@ pub fn len(&self) -> usize {
         self.bits.count_ones() as usize
     }
 
-    /// Returns true if the `EnumSet` is empty.
+    /// Returns `true` if the `EnumSet` is empty.
     pub fn is_empty(&self) -> bool {
         self.bits == 0
     }
index 31e4d001397bf51fc93b148eca34d09a1bb98d52..d10ca087f93e7347b25ef06530802d73246d8afd 100644 (file)
@@ -20,9 +20,9 @@
 /// **RangeArgument** is implemented by Rust's built-in range types, produced
 /// by range syntax like `..`, `a..`, `..b` or `c..d`.
 pub trait RangeArgument<T: ?Sized> {
-    /// Start index bound
+    /// Start index bound.
     ///
-    /// Return start value as a `Bound`
+    /// Returns start value as a `Bound`.
     ///
     /// # Examples
     ///
@@ -42,9 +42,9 @@ pub trait RangeArgument<T: ?Sized> {
     /// ```
     fn start(&self) -> Bound<&T>;
 
-    /// End index bound
+    /// End index bound.
     ///
-    /// Return end value as a `Bound`
+    /// Returns end value as a `Bound`.
     ///
     /// # Examples
     ///
index 5233887620a91e48dff6b371181661d6a3f90122..d3723ace9efb332f4349be1bf37e62b3878cf55c 100644 (file)
@@ -195,7 +195,7 @@ pub fn is_empty(&self) -> bool {
         core_slice::SliceExt::is_empty(self)
     }
 
-    /// Returns the first element of a slice, or `None` if it is empty.
+    /// Returns the first element of the slice, or `None` if it is empty.
     ///
     /// # Examples
     ///
@@ -212,7 +212,7 @@ pub fn first(&self) -> Option<&T> {
         core_slice::SliceExt::first(self)
     }
 
-    /// Returns a mutable pointer to the first element of a slice, or `None` if it is empty.
+    /// Returns a mutable pointer to the first element of the slice, or `None` if it is empty.
     ///
     /// # Examples
     ///
@@ -230,7 +230,7 @@ pub fn first_mut(&mut self) -> Option<&mut T> {
         core_slice::SliceExt::first_mut(self)
     }
 
-    /// Returns the first and all the rest of the elements of a slice, or `None` if it is empty.
+    /// Returns the first and all the rest of the elements of the slice, or `None` if it is empty.
     ///
     /// # Examples
     ///
@@ -248,7 +248,7 @@ pub fn split_first(&self) -> Option<(&T, &[T])> {
         core_slice::SliceExt::split_first(self)
     }
 
-    /// Returns the first and all the rest of the elements of a slice, or `None` if it is empty.
+    /// Returns the first and all the rest of the elements of the slice, or `None` if it is empty.
     ///
     /// # Examples
     ///
@@ -268,7 +268,7 @@ pub fn split_first_mut(&mut self) -> Option<(&mut T, &mut [T])> {
         core_slice::SliceExt::split_first_mut(self)
     }
 
-    /// Returns the last and all the rest of the elements of a slice, or `None` if it is empty.
+    /// Returns the last and all the rest of the elements of the slice, or `None` if it is empty.
     ///
     /// # Examples
     ///
@@ -287,7 +287,7 @@ pub fn split_last(&self) -> Option<(&T, &[T])> {
 
     }
 
-    /// Returns the last and all the rest of the elements of a slice, or `None` if it is empty.
+    /// Returns the last and all the rest of the elements of the slice, or `None` if it is empty.
     ///
     /// # Examples
     ///
@@ -307,7 +307,7 @@ pub fn split_last_mut(&mut self) -> Option<(&mut T, &mut [T])> {
         core_slice::SliceExt::split_last_mut(self)
     }
 
-    /// Returns the last element of a slice, or `None` if it is empty.
+    /// Returns the last element of the slice, or `None` if it is empty.
     ///
     /// # Examples
     ///
@@ -485,7 +485,7 @@ pub fn as_mut_ptr(&mut self) -> *mut T {
         core_slice::SliceExt::as_mut_ptr(self)
     }
 
-    /// Swaps two elements in a slice.
+    /// Swaps two elements in the slice.
     ///
     /// # Arguments
     ///
@@ -509,7 +509,7 @@ pub fn swap(&mut self, a: usize, b: usize) {
         core_slice::SliceExt::swap(self, a, b)
     }
 
-    /// Reverses the order of elements in a slice, in place.
+    /// Reverses the order of elements in the slice, in place.
     ///
     /// # Example
     ///
@@ -955,7 +955,7 @@ pub fn ends_with(&self, needle: &[T]) -> bool
         core_slice::SliceExt::ends_with(self, needle)
     }
 
-    /// Binary search a sorted slice for a given element.
+    /// Binary searches this sorted slice for a given element.
     ///
     /// If the value is found then `Ok` is returned, containing the
     /// index of the matching element; if the value is not found then
@@ -984,7 +984,7 @@ pub fn binary_search(&self, x: &T) -> Result<usize, usize>
         core_slice::SliceExt::binary_search(self, x)
     }
 
-    /// Binary search a sorted slice with a comparator function.
+    /// Binary searches this sorted slice with a comparator function.
     ///
     /// The comparator function should implement an order consistent
     /// with the sort order of the underlying slice, returning an
@@ -1023,7 +1023,7 @@ pub fn binary_search_by<'a, F>(&'a self, f: F) -> Result<usize, usize>
         core_slice::SliceExt::binary_search_by(self, f)
     }
 
-    /// Binary search a sorted slice with a key extraction function.
+    /// Binary searches this sorted slice with a key extraction function.
     ///
     /// Assumes that the slice is sorted by the key, for instance with
     /// [`sort_by_key`] using the same key extraction function.
@@ -1092,7 +1092,7 @@ pub fn sort(&mut self)
         merge_sort(self, |a, b| a.lt(b));
     }
 
-    /// Sorts the slice using `compare` to compare elements.
+    /// Sorts the slice with a comparator function.
     ///
     /// This sort is stable (i.e. does not reorder equal elements) and `O(n log n)` worst-case.
     ///
@@ -1125,7 +1125,7 @@ pub fn sort_by<F>(&mut self, mut compare: F)
         merge_sort(self, |a, b| compare(a, b) == Less);
     }
 
-    /// Sorts the slice using `f` to extract a key to compare elements by.
+    /// Sorts the slice with a key extraction function.
     ///
     /// This sort is stable (i.e. does not reorder equal elements) and `O(n log n)` worst-case.
     ///
@@ -1191,8 +1191,8 @@ pub fn sort_unstable(&mut self)
         core_slice::SliceExt::sort_unstable(self);
     }
 
-    /// Sorts the slice using `compare` to compare elements, but may not preserve the order of
-    /// equal elements.
+    /// Sorts the slice with a comparator function, but may not preserve the order of equal
+    /// elements.
     ///
     /// This sort is unstable (i.e. may reorder equal elements), in-place (i.e. does not allocate),
     /// and `O(n log n)` worst-case.
@@ -1231,8 +1231,8 @@ pub fn sort_unstable_by<F>(&mut self, compare: F)
         core_slice::SliceExt::sort_unstable_by(self, compare);
     }
 
-    /// Sorts the slice using `f` to extract a key to compare elements by, but may not preserve the
-    /// order of equal elements.
+    /// Sorts the slice with a key extraction function, but may not preserve the order of equal
+    /// elements.
     ///
     /// This sort is unstable (i.e. may reorder equal elements), in-place (i.e. does not allocate),
     /// and `O(n log n)` worst-case.
@@ -1313,7 +1313,6 @@ pub fn copy_from_slice(&mut self, src: &[T]) where T: Copy {
         core_slice::SliceExt::copy_from_slice(self, src)
     }
 
-
     /// Copies `self` into a new `Vec`.
     ///
     /// # Examples
index 90e54a383d623730a0612d802f79473110e740a0..8abc9ca7e9fe87b19ee29c632480122bda4a7853 100644 (file)
@@ -204,7 +204,7 @@ pub fn len(&self) -> usize {
         core_str::StrExt::len(self)
     }
 
-    /// Returns true if this slice has a length of zero bytes.
+    /// Returns `true` if `self` has a length of zero bytes.
     ///
     /// # Examples
     ///
index 6a04d47a345e8e93de4e1c5e9dc6ae77ca14c69a..cb92236ec736cf8928f92da43e8efb5921d7feea 100644 (file)
@@ -133,7 +133,7 @@ unsafe fn buffer_write(&mut self, off: usize, value: T) {
         ptr::write(self.ptr().offset(off as isize), value);
     }
 
-    /// Returns true if and only if the buffer is at capacity
+    /// Returns `true` if and only if the buffer is at full capacity.
     #[inline]
     fn is_full(&self) -> bool {
         self.cap() - self.len() == 1
@@ -788,7 +788,7 @@ pub fn len(&self) -> usize {
         count(self.tail, self.head, self.cap())
     }
 
-    /// Returns true if the buffer contains no elements
+    /// Returns `true` if the `VecDeque` is empty.
     ///
     /// # Examples
     ///
index b8a4174766a78b9863140c8282f64750b63bc2a2..338e5c7fd95b47a07d7e780b3af976e6922830c5 100644 (file)
@@ -137,7 +137,7 @@ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
 }
 
 impl Any {
-    /// Returns true if the boxed type is the same as `T`.
+    /// Returns `true` if the boxed type is the same as `T`.
     ///
     /// # Examples
     ///
index cb39796eecd7ddfea530e25c3051c041e898b8e6..7db35359a1f7d427433a69d9a100f8a5587bfc1b 100644 (file)
@@ -210,7 +210,7 @@ pub enum Ordering {
 }
 
 impl Ordering {
-    /// Reverse the `Ordering`.
+    /// Reverses the `Ordering`.
     ///
     /// * `Less` becomes `Greater`.
     /// * `Greater` becomes `Less`.
@@ -616,7 +616,7 @@ fn ge(&self, other: &Rhs) -> bool {
     }
 }
 
-/// Compare and return the minimum of two values.
+/// Compares and returns the minimum of two values.
 ///
 /// Returns the first argument if the comparison determines them to be equal.
 ///
@@ -634,7 +634,7 @@ pub fn min<T: Ord>(v1: T, v2: T) -> T {
     if v1 <= v2 { v1 } else { v2 }
 }
 
-/// Compare and return the maximum of two values.
+/// Compares and returns the maximum of two values.
 ///
 /// Returns the second argument if the comparison determines them to be equal.
 ///
index bc1aaa09f3dbd35d3f566c667dc896564b591ce5..c4d54d2c7b81df6abb3adad2670d8afaf8f2003d 100644 (file)
@@ -22,7 +22,7 @@
 #[doc(hidden)]
 pub unsafe trait TrustedRandomAccess : ExactSizeIterator {
     unsafe fn get_unchecked(&mut self, i: usize) -> Self::Item;
-    /// Return `true` if getting an iterator element may have
+    /// Returns `true` if getting an iterator element may have
     /// side effects. Remember to take inner iterators into account.
     fn may_have_side_effect() -> bool;
 }
index a1f4630c304bf93dff849a7d479910658e085a43..8904322ca48f77b01db9b8a9bbbafe19c02438f7 100644 (file)
@@ -148,14 +148,14 @@ pub fn from_u64(mut v: u64) -> $name {
                 $name { size: sz, base: base }
             }
 
-            /// Return the internal digits as a slice `[a, b, c, ...]` such that the numeric
+            /// Returns the internal digits as a slice `[a, b, c, ...]` such that the numeric
             /// value is `a + b * 2^W + c * 2^(2W) + ...` where `W` is the number of bits in
             /// the digit type.
             pub fn digits(&self) -> &[$ty] {
                 &self.base[..self.size]
             }
 
-            /// Return the `i`-th bit where bit 0 is the least significant one.
+            /// Returns the `i`-th bit where bit 0 is the least significant one.
             /// In other words, the bit with weight `2^i`.
             pub fn get_bit(&self, i: usize) -> u8 {
                 use mem;
@@ -166,7 +166,7 @@ pub fn get_bit(&self, i: usize) -> u8 {
                 ((self.base[d] >> b) & 1) as u8
             }
 
-            /// Returns true if the bignum is zero.
+            /// Returns `true` if the bignum is zero.
             pub fn is_zero(&self) -> bool {
                 self.digits().iter().all(|&v| v == 0)
             }
index ccfe6364e6af6785061d76fd31c0b02edef62d39..df343c9d45f20ffa64a47ecb01f6c4af0d6071f3 100644 (file)
@@ -2568,17 +2568,17 @@ pub trait Float: Sized {
                                  implementable outside the standard library")]
     fn one() -> Self;
 
-    /// Returns true if this value is NaN and false otherwise.
+    /// Returns `true` if this value is NaN and false otherwise.
     #[stable(feature = "core", since = "1.6.0")]
     fn is_nan(self) -> bool;
-    /// Returns true if this value is positive infinity or negative infinity and
+    /// Returns `true` if this value is positive infinity or negative infinity and
     /// false otherwise.
     #[stable(feature = "core", since = "1.6.0")]
     fn is_infinite(self) -> bool;
-    /// Returns true if this number is neither infinite nor NaN.
+    /// Returns `true` if this number is neither infinite nor NaN.
     #[stable(feature = "core", since = "1.6.0")]
     fn is_finite(self) -> bool;
-    /// Returns true if this number is neither zero, infinite, denormal, or NaN.
+    /// Returns `true` if this number is neither zero, infinite, denormal, or NaN.
     #[stable(feature = "core", since = "1.6.0")]
     fn is_normal(self) -> bool;
     /// Returns the category that this number falls into.
index 98544f8ba5e73d87dbd310ff6991fac06f7885b6..d2830a6d00cec149ba22e64c98db7de2ce23d63c 100644 (file)
@@ -380,7 +380,7 @@ pub unsafe fn write_volatile<T>(dst: *mut T, src: T) {
 
 #[lang = "const_ptr"]
 impl<T: ?Sized> *const T {
-    /// Returns true if the pointer is null.
+    /// Returns `true` if the pointer is null.
     ///
     /// # Examples
     ///
@@ -504,7 +504,7 @@ pub fn wrapping_offset(self, count: isize) -> *const T where T: Sized {
 
 #[lang = "mut_ptr"]
 impl<T: ?Sized> *mut T {
-    /// Returns true if the pointer is null.
+    /// Returns `true` if the pointer is null.
     ///
     /// # Examples
     ///
index 00ff2fd2ce5efae5ca2a711dd0e0c200ca780a40..6ec8a37dfa4330042e62996c4b956f1a3b75a770 100644 (file)
@@ -268,7 +268,7 @@ impl<T, E> Result<T, E> {
     // Querying the contained values
     /////////////////////////////////////////////////////////////////////////
 
-    /// Returns true if the result is `Ok`.
+    /// Returns `true` if the result is `Ok`.
     ///
     /// # Examples
     ///
@@ -290,7 +290,7 @@ pub fn is_ok(&self) -> bool {
         }
     }
 
-    /// Returns true if the result is `Err`.
+    /// Returns `true` if the result is `Err`.
     ///
     /// # Examples
     ///
index 6f8b199f886b71e77380566d8a79c7e012d9f87e..af492b3c63976089744aade562e703545c5b2e1b 100644 (file)
@@ -1511,7 +1511,7 @@ fn ptrdistance<T>(start: *const T, end: *const T) -> usize {
 trait PointerExt : Copy {
     unsafe fn slice_offset(self, i: isize) -> Self;
 
-    /// Increment self by 1, but return the old value
+    /// Increments `self` by 1, but returns the old value.
     #[inline(always)]
     unsafe fn post_inc(&mut self) -> Self {
         let current = *self;
@@ -1519,7 +1519,7 @@ unsafe fn post_inc(&mut self) -> Self {
         current
     }
 
-    /// Decrement self by 1, and return the new value
+    /// Decrements `self` by 1, and returns the new value.
     #[inline(always)]
     unsafe fn pre_dec(&mut self) -> Self {
         *self = self.slice_offset(-1);
@@ -1545,7 +1545,7 @@ unsafe fn slice_offset(self, i: isize) -> Self {
 /// splitn, splitn_mut etc can be implemented once.
 #[doc(hidden)]
 trait SplitIter: DoubleEndedIterator {
-    /// Mark the underlying iterator as complete, extracting the remaining
+    /// Marks the underlying iterator as complete, extracting the remaining
     /// portion of the slice.
     fn finish(&mut self) -> Option<Self::Item>;
 }
@@ -2267,11 +2267,11 @@ pub fn heapsort<T, F>(v: &mut [T], mut is_less: F)
 //
 
 extern {
-    /// Call implementation provided memcmp
+    /// Calls implementation provided memcmp.
     ///
     /// Interprets the data as u8.
     ///
-    /// Return 0 for equal, < 0 for less than and > 0 for greater
+    /// Returns 0 for equal, < 0 for less than and > 0 for greater
     /// than.
     // FIXME(#32610): Return type should be c_int
     fn memcmp(s1: *const u8, s2: *const u8, n: usize) -> i32;
index fdfba33f8a9d951cac86bf639a736a43dc487ba9..d13d537d99301781dd6aa246c4008d529354e320 100644 (file)
@@ -104,7 +104,7 @@ fn shift_tail<T, F>(v: &mut [T], is_less: &mut F)
 
 /// Partially sorts a slice by shifting several out-of-order elements around.
 ///
-/// Returns true if the slice is sorted at the end. This function is `O(n)` worst-case.
+/// Returns `true` if the slice is sorted at the end. This function is `O(n)` worst-case.
 #[cold]
 fn partial_insertion_sort<T, F>(v: &mut [T], is_less: &mut F) -> bool
     where F: FnMut(&T, &T) -> bool
@@ -528,7 +528,7 @@ fn break_patterns<T>(v: &mut [T]) {
     }
 }
 
-/// Chooses a pivot in `v` and returns the index and true if the slice is likely already sorted.
+/// Chooses a pivot in `v` and returns the index and `true` if the slice is likely already sorted.
 ///
 /// Elements in `v` might be reordered in the process.
 fn choose_pivot<T, F>(v: &mut [T], is_less: &mut F) -> (usize, bool)
index cf3e8a684dfab1f1213be7da0ebda3604aaa2d75..1efd8137fa316fcc8b8f95ec91fdaba7f69128b2 100644 (file)
@@ -343,13 +343,13 @@ pub struct Chars<'a> {
     iter: slice::Iter<'a, u8>
 }
 
-/// Return the initial codepoint accumulator for the first byte.
+/// Returns the initial codepoint accumulator for the first byte.
 /// The first byte is special, only want bottom 5 bits for width 2, 4 bits
 /// for width 3, and 3 bits for width 4.
 #[inline]
 fn utf8_first_byte(byte: u8, width: u32) -> u32 { (byte & (0x7F >> width)) as u32 }
 
-/// Return the value of `ch` updated with continuation byte `byte`.
+/// Returns the value of `ch` updated with continuation byte `byte`.
 #[inline]
 fn utf8_acc_cont_byte(ch: u32, byte: u8) -> u32 { (ch << 6) | (byte & CONT_MASK) as u32 }
 
@@ -1244,13 +1244,13 @@ fn eq_slice(a: &str, b: &str) -> bool {
 // use truncation to fit u64 into usize
 const NONASCII_MASK: usize = 0x80808080_80808080u64 as usize;
 
-/// Return `true` if any byte in the word `x` is nonascii (>= 128).
+/// Returns `true` if any byte in the word `x` is nonascii (>= 128).
 #[inline]
 fn contains_nonascii(x: usize) -> bool {
     (x & NONASCII_MASK) != 0
 }
 
-/// Walk through `iter` checking that it's a valid UTF-8 sequence,
+/// Walks through `iter` checking that it's a valid UTF-8 sequence,
 /// returning `true` in that case, or, if it is invalid, `false` with
 /// `iter` reset such that it is pointing at the first byte in the
 /// invalid sequence.
@@ -1389,16 +1389,16 @@ macro_rules! next { () => {{
 4,4,4,4,4,0,0,0,0,0,0,0,0,0,0,0, // 0xFF
 ];
 
-/// Given a first byte, determine how many bytes are in this UTF-8 character
+/// Given a first byte, determines how many bytes are in this UTF-8 character.
 #[unstable(feature = "str_internals", issue = "0")]
 #[inline]
 pub fn utf8_char_width(b: u8) -> usize {
     return UTF8_CHAR_WIDTH[b as usize] as usize;
 }
 
-/// Mask of the value bits of a continuation byte
+/// Mask of the value bits of a continuation byte.
 const CONT_MASK: u8 = 0b0011_1111;
-/// Value of the tag bits (tag mask is !CONT_MASK) of a continuation byte
+/// Value of the tag bits (tag mask is !CONT_MASK) of a continuation byte.
 const TAG_CONT_U8: u8 = 0b1000_0000;
 
 /*