Skip to content

Commit d6da1d9

Browse files
author
Stjepan Glavina
committedMar 22, 2017
Various fixes to wording consistency in the docs
1 parent cab4bff commit d6da1d9

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
///

‎src/libcore/slice/mod.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -1511,15 +1511,15 @@ fn ptrdistance<T>(start: *const T, end: *const T) -> usize {
15111511
trait PointerExt : Copy {
15121512
unsafe fn slice_offset(self, i: isize) -> Self;
15131513

1514-
/// Increment self by 1, but return the old value
1514+
/// Increments `self` by 1, but returns the old value.
15151515
#[inline(always)]
15161516
unsafe fn post_inc(&mut self) -> Self {
15171517
let current = *self;
15181518
*self = self.slice_offset(1);
15191519
current
15201520
}
15211521

1522-
/// Decrement self by 1, and return the new value
1522+
/// Decrements `self` by 1, and returns the new value.
15231523
#[inline(always)]
15241524
unsafe fn pre_dec(&mut self) -> Self {
15251525
*self = self.slice_offset(-1);
@@ -1545,7 +1545,7 @@ impl<T> PointerExt for *mut T {
15451545
/// splitn, splitn_mut etc can be implemented once.
15461546
#[doc(hidden)]
15471547
trait SplitIter: DoubleEndedIterator {
1548-
/// Mark the underlying iterator as complete, extracting the remaining
1548+
/// Marks the underlying iterator as complete, extracting the remaining
15491549
/// portion of the slice.
15501550
fn finish(&mut self) -> Option<Self::Item>;
15511551
}
@@ -2267,11 +2267,11 @@ pub fn heapsort<T, F>(v: &mut [T], mut is_less: F)
22672267
//
22682268

22692269
extern {
2270-
/// Call implementation provided memcmp
2270+
/// Calls implementation provided memcmp.
22712271
///
22722272
/// Interprets the data as u8.
22732273
///
2274-
/// Return 0 for equal, < 0 for less than and > 0 for greater
2274+
/// Returns 0 for equal, < 0 for less than and > 0 for greater
22752275
/// than.
22762276
// FIXME(#32610): Return type should be c_int
22772277
fn memcmp(s1: *const u8, s2: *const u8, n: usize) -> i32;

‎src/libcore/slice/sort.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ fn shift_tail<T, F>(v: &mut [T], is_less: &mut F)
104104

105105
/// Partially sorts a slice by shifting several out-of-order elements around.
106106
///
107-
/// Returns true if the slice is sorted at the end. This function is `O(n)` worst-case.
107+
/// Returns `true` if the slice is sorted at the end. This function is `O(n)` worst-case.
108108
#[cold]
109109
fn partial_insertion_sort<T, F>(v: &mut [T], is_less: &mut F) -> bool
110110
where F: FnMut(&T, &T) -> bool
@@ -528,7 +528,7 @@ fn break_patterns<T>(v: &mut [T]) {
528528
}
529529
}
530530

531-
/// Chooses a pivot in `v` and returns the index and true if the slice is likely already sorted.
531+
/// Chooses a pivot in `v` and returns the index and `true` if the slice is likely already sorted.
532532
///
533533
/// Elements in `v` might be reordered in the process.
534534
fn choose_pivot<T, F>(v: &mut [T], is_less: &mut F) -> (usize, bool)

‎src/libcore/str/mod.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -343,13 +343,13 @@ pub struct Chars<'a> {
343343
iter: slice::Iter<'a, u8>
344344
}
345345

346-
/// Return the initial codepoint accumulator for the first byte.
346+
/// Returns the initial codepoint accumulator for the first byte.
347347
/// The first byte is special, only want bottom 5 bits for width 2, 4 bits
348348
/// for width 3, and 3 bits for width 4.
349349
#[inline]
350350
fn utf8_first_byte(byte: u8, width: u32) -> u32 { (byte & (0x7F >> width)) as u32 }
351351

352-
/// Return the value of `ch` updated with continuation byte `byte`.
352+
/// Returns the value of `ch` updated with continuation byte `byte`.
353353
#[inline]
354354
fn utf8_acc_cont_byte(ch: u32, byte: u8) -> u32 { (ch << 6) | (byte & CONT_MASK) as u32 }
355355

@@ -1244,13 +1244,13 @@ Section: UTF-8 validation
12441244
// use truncation to fit u64 into usize
12451245
const NONASCII_MASK: usize = 0x80808080_80808080u64 as usize;
12461246

1247-
/// Return `true` if any byte in the word `x` is nonascii (>= 128).
1247+
/// Returns `true` if any byte in the word `x` is nonascii (>= 128).
12481248
#[inline]
12491249
fn contains_nonascii(x: usize) -> bool {
12501250
(x & NONASCII_MASK) != 0
12511251
}
12521252

1253-
/// Walk through `iter` checking that it's a valid UTF-8 sequence,
1253+
/// Walks through `iter` checking that it's a valid UTF-8 sequence,
12541254
/// returning `true` in that case, or, if it is invalid, `false` with
12551255
/// `iter` reset such that it is pointing at the first byte in the
12561256
/// invalid sequence.
@@ -1389,16 +1389,16 @@ static UTF8_CHAR_WIDTH: [u8; 256] = [
13891389
4,4,4,4,4,0,0,0,0,0,0,0,0,0,0,0, // 0xFF
13901390
];
13911391

1392-
/// Given a first byte, determine how many bytes are in this UTF-8 character
1392+
/// Given a first byte, determines how many bytes are in this UTF-8 character.
13931393
#[unstable(feature = "str_internals", issue = "0")]
13941394
#[inline]
13951395
pub fn utf8_char_width(b: u8) -> usize {
13961396
return UTF8_CHAR_WIDTH[b as usize] as usize;
13971397
}
13981398

1399-
/// Mask of the value bits of a continuation byte
1399+
/// Mask of the value bits of a continuation byte.
14001400
const CONT_MASK: u8 = 0b0011_1111;
1401-
/// Value of the tag bits (tag mask is !CONT_MASK) of a continuation byte
1401+
/// Value of the tag bits (tag mask is !CONT_MASK) of a continuation byte.
14021402
const TAG_CONT_U8: u8 = 0b1000_0000;
14031403

14041404
/*

0 commit comments

Comments
 (0)
Please sign in to comment.