Skip to content

Commit 99ed06e

Browse files
author
Alexander Regueiro
committed
libs: doc comments
1 parent b87363e commit 99ed06e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

102 files changed

+394
-387
lines changed

src/liballoc/borrow.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -137,11 +137,11 @@ impl<T> ToOwned for T
137137
/// ```
138138
/// use std::borrow::{Cow, ToOwned};
139139
///
140-
/// struct Items<'a, X: 'a> where [X]: ToOwned<Owned=Vec<X>> {
140+
/// struct Items<'a, X: 'a> where [X]: ToOwned<Owned = Vec<X>> {
141141
/// values: Cow<'a, [X]>,
142142
/// }
143143
///
144-
/// impl<'a, X: Clone + 'a> Items<'a, X> where [X]: ToOwned<Owned=Vec<X>> {
144+
/// impl<'a, X: Clone + 'a> Items<'a, X> where [X]: ToOwned<Owned = Vec<X>> {
145145
/// fn new(v: Cow<'a, [X]>) -> Self {
146146
/// Items { values: v }
147147
/// }

src/liballoc/collections/binary_heap.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -863,7 +863,7 @@ struct Hole<'a, T: 'a> {
863863
}
864864

865865
impl<'a, T> Hole<'a, T> {
866-
/// Create a new Hole at index `pos`.
866+
/// Create a new `Hole` at index `pos`.
867867
///
868868
/// Unsafe because pos must be within the data slice.
869869
#[inline]

src/liballoc/collections/btree/map.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2368,7 +2368,7 @@ impl<'a, K: Ord, V> OccupiedEntry<'a, K, V> {
23682368

23692369
/// Gets a mutable reference to the value in the entry.
23702370
///
2371-
/// If you need a reference to the `OccupiedEntry` which may outlive the
2371+
/// If you need a reference to the `OccupiedEntry` that may outlive the
23722372
/// destruction of the `Entry` value, see [`into_mut`].
23732373
///
23742374
/// [`into_mut`]: #method.into_mut

src/liballoc/collections/btree/node.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1295,7 +1295,7 @@ impl<'a, K, V> Handle<NodeRef<marker::Mut<'a>, K, V, marker::Internal>, marker::
12951295
}
12961296
}
12971297

1298-
/// Returns whether it is valid to call `.merge()`, i.e., whether there is enough room in
1298+
/// Returns `true` if it is valid to call `.merge()`, i.e., whether there is enough room in
12991299
/// a node to hold the combination of the nodes to the left and right of this handle along
13001300
/// with the key/value pair at this handle.
13011301
pub fn can_merge(&self) -> bool {
@@ -1573,7 +1573,7 @@ unsafe fn move_edges<K, V>(
15731573
impl<BorrowType, K, V, HandleType>
15741574
Handle<NodeRef<BorrowType, K, V, marker::LeafOrInternal>, HandleType> {
15751575

1576-
/// Check whether the underlying node is an `Internal` node or a `Leaf` node.
1576+
/// Checks whether the underlying node is an `Internal` node or a `Leaf` node.
15771577
pub fn force(self) -> ForceResult<
15781578
Handle<NodeRef<BorrowType, K, V, marker::Leaf>, HandleType>,
15791579
Handle<NodeRef<BorrowType, K, V, marker::Internal>, HandleType>

src/liballoc/collections/btree/set.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -556,7 +556,7 @@ impl<T: Ord> BTreeSet<T> {
556556
Recover::replace(&mut self.map, value)
557557
}
558558

559-
/// Removes a value from the set. Returns `true` if the value was
559+
/// Removes a value from the set. Returns whether the value was
560560
/// present in the set.
561561
///
562562
/// The value may be any borrowed form of the set's value type,
@@ -988,7 +988,7 @@ impl<'a, T> DoubleEndedIterator for Range<'a, T> {
988988
#[stable(feature = "fused", since = "1.26.0")]
989989
impl<T> FusedIterator for Range<'_, T> {}
990990

991-
/// Compare `x` and `y`, but return `short` if x is None and `long` if y is None
991+
/// Compares `x` and `y`, but return `short` if x is None and `long` if y is None
992992
fn cmp_opt<T: Ord>(x: Option<&T>, y: Option<&T>, short: Ordering, long: Ordering) -> Ordering {
993993
match (x, y) {
994994
(None, _) => short,

src/liballoc/collections/vec_deque.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ impl<T> VecDeque<T> {
124124
ptr::write(self.ptr().add(off), value);
125125
}
126126

127-
/// Returns `true` if and only if the buffer is at full capacity.
127+
/// Returns `true` if the buffer is at full capacity.
128128
#[inline]
129129
fn is_full(&self) -> bool {
130130
self.cap() - self.len() == 1
@@ -560,7 +560,7 @@ impl<T> VecDeque<T> {
560560
/// Does nothing if the capacity is already sufficient.
561561
///
562562
/// Note that the allocator may give the collection more space than it
563-
/// requests. Therefore capacity can not be relied upon to be precisely
563+
/// requests. Therefore, capacity can not be relied upon to be precisely
564564
/// minimal. Prefer `reserve` if future insertions are expected.
565565
///
566566
/// # Errors
@@ -924,15 +924,15 @@ impl<T> VecDeque<T> {
924924
self.tail == self.head
925925
}
926926

927-
/// Create a draining iterator that removes the specified range in the
927+
/// Creates a draining iterator that removes the specified range in the
928928
/// `VecDeque` and yields the removed items.
929929
///
930930
/// Note 1: The element range is removed even if the iterator is not
931931
/// consumed until the end.
932932
///
933933
/// Note 2: It is unspecified how many elements are removed from the deque,
934934
/// if the `Drain` value is not dropped, but the borrow it holds expires
935-
/// (eg. due to mem::forget).
935+
/// (e.g., due to `mem::forget`).
936936
///
937937
/// # Panics
938938
///

src/liballoc/macros.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ macro_rules! vec {
6767
///
6868
/// Additional parameters passed to `format!` replace the `{}`s within the
6969
/// formatting string in the order given unless named or positional parameters
70-
/// are used, see [`std::fmt`][fmt] for more information.
70+
/// are used; see [`std::fmt`][fmt] for more information.
7171
///
7272
/// A common use for `format!` is concatenation and interpolation of strings.
7373
/// The same convention is used with [`print!`] and [`write!`] macros,

src/liballoc/raw_vec.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ impl<T, A: Alloc> RawVec<T, A> {
335335
/// enough to want to do that it's easiest to just have a dedicated method. Slightly
336336
/// more efficient logic can be provided for this than the general case.
337337
///
338-
/// Returns true if the reallocation attempt has succeeded, or false otherwise.
338+
/// Returns `true` if the reallocation attempt has succeeded.
339339
///
340340
/// # Panics
341341
///
@@ -504,7 +504,7 @@ impl<T, A: Alloc> RawVec<T, A> {
504504
/// the requested space. This is not really unsafe, but the unsafe
505505
/// code *you* write that relies on the behavior of this function may break.
506506
///
507-
/// Returns true if the reallocation attempt has succeeded, or false otherwise.
507+
/// Returns `true` if the reallocation attempt has succeeded.
508508
///
509509
/// # Panics
510510
///

src/liballoc/rc.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -512,7 +512,7 @@ impl<T: ?Sized> Rc<T> {
512512
this.strong()
513513
}
514514

515-
/// Returns true if there are no other `Rc` or [`Weak`][weak] pointers to
515+
/// Returns `true` if there are no other `Rc` or [`Weak`][weak] pointers to
516516
/// this inner value.
517517
///
518518
/// [weak]: struct.Weak.html
@@ -561,7 +561,7 @@ impl<T: ?Sized> Rc<T> {
561561

562562
#[inline]
563563
#[stable(feature = "ptr_eq", since = "1.17.0")]
564-
/// Returns true if the two `Rc`s point to the same value (not
564+
/// Returns `true` if the two `Rc`s point to the same value (not
565565
/// just values that compare as equal).
566566
///
567567
/// # Examples
@@ -1334,8 +1334,8 @@ impl<T: ?Sized> Weak<T> {
13341334
})
13351335
}
13361336

1337-
/// Return `None` when the pointer is dangling and there is no allocated `RcBox`,
1338-
/// i.e., this `Weak` was created by `Weak::new`
1337+
/// Returns `None` when the pointer is dangling and there is no allocated `RcBox`
1338+
/// (i.e., when this `Weak` was created by `Weak::new`).
13391339
#[inline]
13401340
fn inner(&self) -> Option<&RcBox<T>> {
13411341
if is_dangling(self.ptr) {
@@ -1345,7 +1345,7 @@ impl<T: ?Sized> Weak<T> {
13451345
}
13461346
}
13471347

1348-
/// Returns true if the two `Weak`s point to the same value (not just values
1348+
/// Returns `true` if the two `Weak`s point to the same value (not just values
13491349
/// that compare as equal).
13501350
///
13511351
/// # Notes

src/liballoc/slice.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -205,10 +205,10 @@ impl<T> [T] {
205205
///
206206
/// The comparator function must define a total ordering for the elements in the slice. If
207207
/// the ordering is not total, the order of the elements is unspecified. An order is a
208-
/// total order if it is (for all a, b and c):
208+
/// total order if it is (for all `a`, `b` and `c`):
209209
///
210-
/// * total and antisymmetric: exactly one of a < b, a == b or a > b is true; and
211-
/// * transitive, a < b and b < c implies a < c. The same must hold for both == and >.
210+
/// * total and antisymmetric: exactly one of `a < b`, `a == b` or `a > b` is true, and
211+
/// * transitive, `a < b` and `b < c` implies `a < c`. The same must hold for both `==` and `>`.
212212
///
213213
/// For example, while [`f64`] doesn't implement [`Ord`] because `NaN != NaN`, we can use
214214
/// `partial_cmp` as our sort function when we know the slice doesn't contain a `NaN`.

src/liballoc/string.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -963,7 +963,7 @@ impl String {
963963
/// Does nothing if the capacity is already sufficient.
964964
///
965965
/// Note that the allocator may give the collection more space than it
966-
/// requests. Therefore capacity can not be relied upon to be precisely
966+
/// requests. Therefore, capacity can not be relied upon to be precisely
967967
/// minimal. Prefer `reserve` if future insertions are expected.
968968
///
969969
/// # Errors
@@ -1377,9 +1377,7 @@ impl String {
13771377
self.vec.len()
13781378
}
13791379

1380-
/// Returns `true` if this `String` has a length of zero.
1381-
///
1382-
/// Returns `false` otherwise.
1380+
/// Returns `true` if this `String` has a length of zero, and `false` otherwise.
13831381
///
13841382
/// # Examples
13851383
///

src/liballoc/sync.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -560,7 +560,7 @@ impl<T: ?Sized> Arc<T> {
560560

561561
#[inline]
562562
#[stable(feature = "ptr_eq", since = "1.17.0")]
563-
/// Returns true if the two `Arc`s point to the same value (not
563+
/// Returns `true` if the two `Arc`s point to the same value (not
564564
/// just values that compare as equal).
565565
///
566566
/// # Examples
@@ -1191,8 +1191,8 @@ impl<T: ?Sized> Weak<T> {
11911191
})
11921192
}
11931193

1194-
/// Return `None` when the pointer is dangling and there is no allocated `ArcInner`,
1195-
/// i.e., this `Weak` was created by `Weak::new`
1194+
/// Returns `None` when the pointer is dangling and there is no allocated `ArcInner`,
1195+
/// (i.e., when this `Weak` was created by `Weak::new`).
11961196
#[inline]
11971197
fn inner(&self) -> Option<&ArcInner<T>> {
11981198
if is_dangling(self.ptr) {
@@ -1202,7 +1202,7 @@ impl<T: ?Sized> Weak<T> {
12021202
}
12031203
}
12041204

1205-
/// Returns true if the two `Weak`s point to the same value (not just values
1205+
/// Returns `true` if the two `Weak`s point to the same value (not just values
12061206
/// that compare as equal).
12071207
///
12081208
/// # Notes

src/liballoc/tests/heap.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
use std::alloc::{Global, Alloc, Layout, System};
44

5-
/// https://github.com/rust-lang/rust/issues/45955
5+
/// Issue #45955.
66
#[test]
77
fn alloc_system_overaligned_request() {
88
check_overalign_requests(System)

src/liballoc/vec.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -463,7 +463,7 @@ impl<T> Vec<T> {
463463
/// Does nothing if the capacity is already sufficient.
464464
///
465465
/// Note that the allocator may give the collection more space than it
466-
/// requests. Therefore capacity can not be relied upon to be precisely
466+
/// requests. Therefore, capacity can not be relied upon to be precisely
467467
/// minimal. Prefer `reserve` if future insertions are expected.
468468
///
469469
/// # Panics
@@ -525,7 +525,7 @@ impl<T> Vec<T> {
525525
/// Does nothing if the capacity is already sufficient.
526526
///
527527
/// Note that the allocator may give the collection more space than it
528-
/// requests. Therefore capacity can not be relied upon to be precisely
528+
/// requests. Therefore, capacity can not be relied upon to be precisely
529529
/// minimal. Prefer `reserve` if future insertions are expected.
530530
///
531531
/// # Errors
@@ -2608,7 +2608,7 @@ impl<T> Drain<'_, T> {
26082608
/// The range from `self.vec.len` to `self.tail_start` contains elements
26092609
/// that have been moved out.
26102610
/// Fill that range as much as possible with new elements from the `replace_with` iterator.
2611-
/// Return whether we filled the entire range. (`replace_with.next()` didn’t return `None`.)
2611+
/// Returns `true` if we filled the entire range. (`replace_with.next()` didn’t return `None`.)
26122612
unsafe fn fill<I: Iterator<Item=T>>(&mut self, replace_with: &mut I) -> bool {
26132613
let vec = self.vec.as_mut();
26142614
let range_start = vec.len;
@@ -2628,7 +2628,7 @@ impl<T> Drain<'_, T> {
26282628
true
26292629
}
26302630

2631-
/// Make room for inserting more elements before the tail.
2631+
/// Makes room for inserting more elements before the tail.
26322632
unsafe fn move_tail(&mut self, extra_capacity: usize) {
26332633
let vec = self.vec.as_mut();
26342634
let used_capacity = self.tail_start + self.tail_len;

src/libcore/cell.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@
130130
//!
131131
//! This is simply a special - but common - case of the previous: hiding mutability for operations
132132
//! that appear to be immutable. The `clone` method is expected to not change the source value, and
133-
//! is declared to take `&self`, not `&mut self`. Therefore any mutation that happens in the
133+
//! is declared to take `&self`, not `&mut self`. Therefore, any mutation that happens in the
134134
//! `clone` method must use cell types. For example, `Rc<T>` maintains its reference counts within a
135135
//! `Cell<T>`.
136136
//!
@@ -1145,7 +1145,7 @@ impl<'b, T: ?Sized> Ref<'b, T> {
11451145
}
11461146
}
11471147

1148-
/// Make a new `Ref` for a component of the borrowed data.
1148+
/// Makes a new `Ref` for a component of the borrowed data.
11491149
///
11501150
/// The `RefCell` is already immutably borrowed, so this cannot fail.
11511151
///
@@ -1217,7 +1217,7 @@ impl<T: ?Sized + fmt::Display> fmt::Display for Ref<'_, T> {
12171217
}
12181218

12191219
impl<'b, T: ?Sized> RefMut<'b, T> {
1220-
/// Make a new `RefMut` for a component of the borrowed data, e.g., an enum
1220+
/// Makes a new `RefMut` for a component of the borrowed data, e.g., an enum
12211221
/// variant.
12221222
///
12231223
/// The `RefCell` is already mutably borrowed, so this cannot fail.
@@ -1416,7 +1416,7 @@ impl<T: ?Sized + fmt::Display> fmt::Display for RefMut<'_, T> {
14161416
/// co-exist with it. A `&mut T` must always be unique.
14171417
///
14181418
/// Note that while mutating or mutably aliasing the contents of an `&UnsafeCell<T>` is
1419-
/// okay (provided you enforce the invariants some other way), it is still undefined behavior
1419+
/// ok (provided you enforce the invariants some other way), it is still undefined behavior
14201420
/// to have multiple `&mut UnsafeCell<T>` aliases.
14211421
///
14221422
/// # Examples

src/libcore/char/decode.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ pub struct DecodeUtf16Error {
2020
code: u16,
2121
}
2222

23-
/// Create an iterator over the UTF-16 encoded code points in `iter`,
23+
/// Creates an iterator over the UTF-16 encoded code points in `iter`,
2424
/// returning unpaired surrogates as `Err`s.
2525
///
2626
/// # Examples

0 commit comments

Comments
 (0)