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

Lines changed: 2 additions & 2 deletions
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 2 additions & 2 deletions
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

Lines changed: 2 additions & 2 deletions
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

Lines changed: 4 additions & 4 deletions
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 2 additions & 2 deletions
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

Lines changed: 5 additions & 5 deletions
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

Lines changed: 3 additions & 3 deletions
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`.

0 commit comments

Comments
 (0)