Skip to content

Commit d6da1d9

Browse files
author
Stjepan Glavina
committed
Various fixes to wording consistency in the docs
1 parent cab4bff commit d6da1d9

File tree

18 files changed

+61
-62
lines changed

18 files changed

+61
-62
lines changed

src/libcollections/binary_heap.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -930,13 +930,13 @@ impl<'a, T> Hole<'a, T> {
930930
self.pos
931931
}
932932

933-
/// Return a reference to the element removed
933+
/// Returns a reference to the element removed.
934934
#[inline]
935935
fn element(&self) -> &T {
936936
self.elt.as_ref().unwrap()
937937
}
938938

939-
/// Return a reference to the element at `index`.
939+
/// Returns a reference to the element at `index`.
940940
///
941941
/// Unsafe because index must be within the data slice and not equal to pos.
942942
#[inline]

src/libcollections/btree/map.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -526,7 +526,7 @@ impl<K: Ord, V> BTreeMap<K, V> {
526526
}
527527
}
528528

529-
/// Returns true if the map contains a value for the specified key.
529+
/// Returns `true` if the map contains a value for the specified key.
530530
///
531531
/// The key may be any borrowed form of the map's key type, but the ordering
532532
/// on the borrowed form *must* match the ordering on the key type.
@@ -1965,7 +1965,7 @@ impl<K, V> BTreeMap<K, V> {
19651965
self.length
19661966
}
19671967

1968-
/// Returns true if the map contains no elements.
1968+
/// Returns `true` if the map contains no elements.
19691969
///
19701970
/// # Examples
19711971
///

src/libcollections/btree/set.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,7 @@ impl<T: Ord> BTreeSet<T> {
415415
self.map.len()
416416
}
417417

418-
/// Returns true if the set contains no elements.
418+
/// Returns `true` if the set contains no elements.
419419
///
420420
/// # Examples
421421
///

src/libcollections/enum_set.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ impl<E: CLike> EnumSet<E> {
106106
self.bits.count_ones() as usize
107107
}
108108

109-
/// Returns true if the `EnumSet` is empty.
109+
/// Returns `true` if the `EnumSet` is empty.
110110
pub fn is_empty(&self) -> bool {
111111
self.bits == 0
112112
}

src/libcollections/range.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ use Bound::{self, Excluded, Included, Unbounded};
2020
/// **RangeArgument** is implemented by Rust's built-in range types, produced
2121
/// by range syntax like `..`, `a..`, `..b` or `c..d`.
2222
pub trait RangeArgument<T: ?Sized> {
23-
/// Start index bound
23+
/// Start index bound.
2424
///
25-
/// Return start value as a `Bound`
25+
/// Returns start value as a `Bound`.
2626
///
2727
/// # Examples
2828
///
@@ -42,9 +42,9 @@ pub trait RangeArgument<T: ?Sized> {
4242
/// ```
4343
fn start(&self) -> Bound<&T>;
4444

45-
/// End index bound
45+
/// End index bound.
4646
///
47-
/// Return end value as a `Bound`
47+
/// Returns end value as a `Bound`.
4848
///
4949
/// # Examples
5050
///

src/libcollections/slice.rs

+18-19
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ impl<T> [T] {
195195
core_slice::SliceExt::is_empty(self)
196196
}
197197

198-
/// Returns the first element of a slice, or `None` if it is empty.
198+
/// Returns the first element of the slice, or `None` if it is empty.
199199
///
200200
/// # Examples
201201
///
@@ -212,7 +212,7 @@ impl<T> [T] {
212212
core_slice::SliceExt::first(self)
213213
}
214214

215-
/// Returns a mutable pointer to the first element of a slice, or `None` if it is empty.
215+
/// Returns a mutable pointer to the first element of the slice, or `None` if it is empty.
216216
///
217217
/// # Examples
218218
///
@@ -230,7 +230,7 @@ impl<T> [T] {
230230
core_slice::SliceExt::first_mut(self)
231231
}
232232

233-
/// Returns the first and all the rest of the elements of a slice, or `None` if it is empty.
233+
/// Returns the first and all the rest of the elements of the slice, or `None` if it is empty.
234234
///
235235
/// # Examples
236236
///
@@ -248,7 +248,7 @@ impl<T> [T] {
248248
core_slice::SliceExt::split_first(self)
249249
}
250250

251-
/// Returns the first and all the rest of the elements of a slice, or `None` if it is empty.
251+
/// Returns the first and all the rest of the elements of the slice, or `None` if it is empty.
252252
///
253253
/// # Examples
254254
///
@@ -268,7 +268,7 @@ impl<T> [T] {
268268
core_slice::SliceExt::split_first_mut(self)
269269
}
270270

271-
/// Returns the last and all the rest of the elements of a slice, or `None` if it is empty.
271+
/// Returns the last and all the rest of the elements of the slice, or `None` if it is empty.
272272
///
273273
/// # Examples
274274
///
@@ -287,7 +287,7 @@ impl<T> [T] {
287287

288288
}
289289

290-
/// Returns the last and all the rest of the elements of a slice, or `None` if it is empty.
290+
/// Returns the last and all the rest of the elements of the slice, or `None` if it is empty.
291291
///
292292
/// # Examples
293293
///
@@ -307,7 +307,7 @@ impl<T> [T] {
307307
core_slice::SliceExt::split_last_mut(self)
308308
}
309309

310-
/// Returns the last element of a slice, or `None` if it is empty.
310+
/// Returns the last element of the slice, or `None` if it is empty.
311311
///
312312
/// # Examples
313313
///
@@ -485,7 +485,7 @@ impl<T> [T] {
485485
core_slice::SliceExt::as_mut_ptr(self)
486486
}
487487

488-
/// Swaps two elements in a slice.
488+
/// Swaps two elements in the slice.
489489
///
490490
/// # Arguments
491491
///
@@ -509,7 +509,7 @@ impl<T> [T] {
509509
core_slice::SliceExt::swap(self, a, b)
510510
}
511511

512-
/// Reverses the order of elements in a slice, in place.
512+
/// Reverses the order of elements in the slice, in place.
513513
///
514514
/// # Example
515515
///
@@ -955,7 +955,7 @@ impl<T> [T] {
955955
core_slice::SliceExt::ends_with(self, needle)
956956
}
957957

958-
/// Binary search a sorted slice for a given element.
958+
/// Binary searches this sorted slice for a given element.
959959
///
960960
/// If the value is found then `Ok` is returned, containing the
961961
/// index of the matching element; if the value is not found then
@@ -984,7 +984,7 @@ impl<T> [T] {
984984
core_slice::SliceExt::binary_search(self, x)
985985
}
986986

987-
/// Binary search a sorted slice with a comparator function.
987+
/// Binary searches this sorted slice with a comparator function.
988988
///
989989
/// The comparator function should implement an order consistent
990990
/// with the sort order of the underlying slice, returning an
@@ -1023,7 +1023,7 @@ impl<T> [T] {
10231023
core_slice::SliceExt::binary_search_by(self, f)
10241024
}
10251025

1026-
/// Binary search a sorted slice with a key extraction function.
1026+
/// Binary searches this sorted slice with a key extraction function.
10271027
///
10281028
/// Assumes that the slice is sorted by the key, for instance with
10291029
/// [`sort_by_key`] using the same key extraction function.
@@ -1092,7 +1092,7 @@ impl<T> [T] {
10921092
merge_sort(self, |a, b| a.lt(b));
10931093
}
10941094

1095-
/// Sorts the slice using `compare` to compare elements.
1095+
/// Sorts the slice with a comparator function.
10961096
///
10971097
/// This sort is stable (i.e. does not reorder equal elements) and `O(n log n)` worst-case.
10981098
///
@@ -1125,7 +1125,7 @@ impl<T> [T] {
11251125
merge_sort(self, |a, b| compare(a, b) == Less);
11261126
}
11271127

1128-
/// Sorts the slice using `f` to extract a key to compare elements by.
1128+
/// Sorts the slice with a key extraction function.
11291129
///
11301130
/// This sort is stable (i.e. does not reorder equal elements) and `O(n log n)` worst-case.
11311131
///
@@ -1191,8 +1191,8 @@ impl<T> [T] {
11911191
core_slice::SliceExt::sort_unstable(self);
11921192
}
11931193

1194-
/// Sorts the slice using `compare` to compare elements, but may not preserve the order of
1195-
/// equal elements.
1194+
/// Sorts the slice with a comparator function, but may not preserve the order of equal
1195+
/// elements.
11961196
///
11971197
/// This sort is unstable (i.e. may reorder equal elements), in-place (i.e. does not allocate),
11981198
/// and `O(n log n)` worst-case.
@@ -1231,8 +1231,8 @@ impl<T> [T] {
12311231
core_slice::SliceExt::sort_unstable_by(self, compare);
12321232
}
12331233

1234-
/// Sorts the slice using `f` to extract a key to compare elements by, but may not preserve the
1235-
/// order of equal elements.
1234+
/// Sorts the slice with a key extraction function, but may not preserve the order of equal
1235+
/// elements.
12361236
///
12371237
/// This sort is unstable (i.e. may reorder equal elements), in-place (i.e. does not allocate),
12381238
/// and `O(n log n)` worst-case.
@@ -1313,7 +1313,6 @@ impl<T> [T] {
13131313
core_slice::SliceExt::copy_from_slice(self, src)
13141314
}
13151315

1316-
13171316
/// Copies `self` into a new `Vec`.
13181317
///
13191318
/// # Examples

src/libcollections/str.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ impl str {
204204
core_str::StrExt::len(self)
205205
}
206206

207-
/// Returns true if this slice has a length of zero bytes.
207+
/// Returns `true` if `self` has a length of zero bytes.
208208
///
209209
/// # Examples
210210
///

src/libcollections/vec_deque.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ impl<T> VecDeque<T> {
133133
ptr::write(self.ptr().offset(off as isize), value);
134134
}
135135

136-
/// Returns true if and only if the buffer is at capacity
136+
/// Returns `true` if and only if the buffer is at full capacity.
137137
#[inline]
138138
fn is_full(&self) -> bool {
139139
self.cap() - self.len() == 1
@@ -788,7 +788,7 @@ impl<T> VecDeque<T> {
788788
count(self.tail, self.head, self.cap())
789789
}
790790

791-
/// Returns true if the buffer contains no elements
791+
/// Returns `true` if the `VecDeque` is empty.
792792
///
793793
/// # Examples
794794
///

src/libcore/any.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ impl fmt::Debug for Any + Send {
137137
}
138138

139139
impl Any {
140-
/// Returns true if the boxed type is the same as `T`.
140+
/// Returns `true` if the boxed type is the same as `T`.
141141
///
142142
/// # Examples
143143
///

src/libcore/cmp.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ pub enum Ordering {
210210
}
211211

212212
impl Ordering {
213-
/// Reverse the `Ordering`.
213+
/// Reverses the `Ordering`.
214214
///
215215
/// * `Less` becomes `Greater`.
216216
/// * `Greater` becomes `Less`.
@@ -616,7 +616,7 @@ pub trait PartialOrd<Rhs: ?Sized = Self>: PartialEq<Rhs> {
616616
}
617617
}
618618

619-
/// Compare and return the minimum of two values.
619+
/// Compares and returns the minimum of two values.
620620
///
621621
/// Returns the first argument if the comparison determines them to be equal.
622622
///
@@ -634,7 +634,7 @@ pub fn min<T: Ord>(v1: T, v2: T) -> T {
634634
if v1 <= v2 { v1 } else { v2 }
635635
}
636636

637-
/// Compare and return the maximum of two values.
637+
/// Compares and returns the maximum of two values.
638638
///
639639
/// Returns the second argument if the comparison determines them to be equal.
640640
///

src/libcore/iter_private.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
#[doc(hidden)]
2323
pub unsafe trait TrustedRandomAccess : ExactSizeIterator {
2424
unsafe fn get_unchecked(&mut self, i: usize) -> Self::Item;
25-
/// Return `true` if getting an iterator element may have
25+
/// Returns `true` if getting an iterator element may have
2626
/// side effects. Remember to take inner iterators into account.
2727
fn may_have_side_effect() -> bool;
2828
}

src/libcore/num/bignum.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -148,14 +148,14 @@ macro_rules! define_bignum {
148148
$name { size: sz, base: base }
149149
}
150150

151-
/// Return the internal digits as a slice `[a, b, c, ...]` such that the numeric
151+
/// Returns the internal digits as a slice `[a, b, c, ...]` such that the numeric
152152
/// value is `a + b * 2^W + c * 2^(2W) + ...` where `W` is the number of bits in
153153
/// the digit type.
154154
pub fn digits(&self) -> &[$ty] {
155155
&self.base[..self.size]
156156
}
157157

158-
/// Return the `i`-th bit where bit 0 is the least significant one.
158+
/// Returns the `i`-th bit where bit 0 is the least significant one.
159159
/// In other words, the bit with weight `2^i`.
160160
pub fn get_bit(&self, i: usize) -> u8 {
161161
use mem;
@@ -166,7 +166,7 @@ macro_rules! define_bignum {
166166
((self.base[d] >> b) & 1) as u8
167167
}
168168

169-
/// Returns true if the bignum is zero.
169+
/// Returns `true` if the bignum is zero.
170170
pub fn is_zero(&self) -> bool {
171171
self.digits().iter().all(|&v| v == 0)
172172
}

src/libcore/num/mod.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -2568,17 +2568,17 @@ pub trait Float: Sized {
25682568
implementable outside the standard library")]
25692569
fn one() -> Self;
25702570

2571-
/// Returns true if this value is NaN and false otherwise.
2571+
/// Returns `true` if this value is NaN and false otherwise.
25722572
#[stable(feature = "core", since = "1.6.0")]
25732573
fn is_nan(self) -> bool;
2574-
/// Returns true if this value is positive infinity or negative infinity and
2574+
/// Returns `true` if this value is positive infinity or negative infinity and
25752575
/// false otherwise.
25762576
#[stable(feature = "core", since = "1.6.0")]
25772577
fn is_infinite(self) -> bool;
2578-
/// Returns true if this number is neither infinite nor NaN.
2578+
/// Returns `true` if this number is neither infinite nor NaN.
25792579
#[stable(feature = "core", since = "1.6.0")]
25802580
fn is_finite(self) -> bool;
2581-
/// Returns true if this number is neither zero, infinite, denormal, or NaN.
2581+
/// Returns `true` if this number is neither zero, infinite, denormal, or NaN.
25822582
#[stable(feature = "core", since = "1.6.0")]
25832583
fn is_normal(self) -> bool;
25842584
/// Returns the category that this number falls into.

src/libcore/ptr.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,7 @@ pub unsafe fn write_volatile<T>(dst: *mut T, src: T) {
380380

381381
#[lang = "const_ptr"]
382382
impl<T: ?Sized> *const T {
383-
/// Returns true if the pointer is null.
383+
/// Returns `true` if the pointer is null.
384384
///
385385
/// # Examples
386386
///
@@ -504,7 +504,7 @@ impl<T: ?Sized> *const T {
504504

505505
#[lang = "mut_ptr"]
506506
impl<T: ?Sized> *mut T {
507-
/// Returns true if the pointer is null.
507+
/// Returns `true` if the pointer is null.
508508
///
509509
/// # Examples
510510
///

src/libcore/result.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ impl<T, E> Result<T, E> {
268268
// Querying the contained values
269269
/////////////////////////////////////////////////////////////////////////
270270

271-
/// Returns true if the result is `Ok`.
271+
/// Returns `true` if the result is `Ok`.
272272
///
273273
/// # Examples
274274
///
@@ -290,7 +290,7 @@ impl<T, E> Result<T, E> {
290290
}
291291
}
292292

293-
/// Returns true if the result is `Err`.
293+
/// Returns `true` if the result is `Err`.
294294
///
295295
/// # Examples
296296
///

0 commit comments

Comments
 (0)