Skip to content

Commit b87363e

Browse files
author
Alexander Regueiro
committed
tests: doc comments
1 parent c3e182c commit b87363e

Some content is hidden

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

61 files changed

+164
-164
lines changed

src/liballoc/collections/btree/node.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,11 @@ pub const CAPACITY: usize = 2 * B - 1;
5050
///
5151
/// We have a separate type for the header and rely on it matching the prefix of `LeafNode`, in
5252
/// order to statically allocate a single dummy node to avoid allocations. This struct is
53-
/// `repr(C)` to prevent them from being reordered. `LeafNode` does not just contain a
53+
/// `repr(C)` to prevent them from being reordered. `LeafNode` does not just contain a
5454
/// `NodeHeader` because we do not want unnecessary padding between `len` and the keys.
55-
/// Crucially, `NodeHeader` can be safely transmuted to different K and V. (This is exploited
55+
/// Crucially, `NodeHeader` can be safely transmuted to different K and V. (This is exploited
5656
/// by `as_header`.)
57-
/// See `into_key_slice` for an explanation of K2. K2 cannot be safely transmuted around
57+
/// See `into_key_slice` for an explanation of K2. K2 cannot be safely transmuted around
5858
/// because the size of `NodeHeader` depends on its alignment!
5959
#[repr(C)]
6060
struct NodeHeader<K, V, K2 = ()> {

src/liballoc/collections/vec_deque.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1922,7 +1922,7 @@ impl<T> VecDeque<T> {
19221922
///
19231923
/// # Panics
19241924
///
1925-
/// If `mid` is greater than `len()`. Note that `mid == len()`
1925+
/// If `mid` is greater than `len()`. Note that `mid == len()`
19261926
/// does _not_ panic and is a no-op rotation.
19271927
///
19281928
/// # Complexity
@@ -1967,7 +1967,7 @@ impl<T> VecDeque<T> {
19671967
///
19681968
/// # Panics
19691969
///
1970-
/// If `k` is greater than `len()`. Note that `k == len()`
1970+
/// If `k` is greater than `len()`. Note that `k == len()`
19711971
/// does _not_ panic and is a no-op rotation.
19721972
///
19731973
/// # Complexity

src/liballoc/fmt.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
//! will then parse the format string and determine if the list of arguments
2828
//! provided is suitable to pass to this format string.
2929
//!
30-
//! To convert a single value to a string, use the [`to_string`] method. This
30+
//! To convert a single value to a string, use the [`to_string`] method. This
3131
//! will use the [`Display`] formatting trait.
3232
//!
3333
//! ## Positional parameters
@@ -102,7 +102,7 @@
102102
//! When requesting that an argument be formatted with a particular type, you
103103
//! are actually requesting that an argument ascribes to a particular trait.
104104
//! This allows multiple actual types to be formatted via `{:x}` (like [`i8`] as
105-
//! well as [`isize`]). The current mapping of types to traits is:
105+
//! well as [`isize`]). The current mapping of types to traits is:
106106
//!
107107
//! * *nothing* ⇒ [`Display`]
108108
//! * `?` ⇒ [`Debug`]
@@ -427,7 +427,7 @@
427427
//! 3. An asterisk `.*`:
428428
//!
429429
//! `.*` means that this `{...}` is associated with *two* format inputs rather than one: the
430-
//! first input holds the `usize` precision, and the second holds the value to print. Note that
430+
//! first input holds the `usize` precision, and the second holds the value to print. Note that
431431
//! in this case, if one uses the format string `{<arg>:<spec>.*}`, then the `<arg>` part refers
432432
//! to the *value* to print, and the `precision` must come in the input preceding `<arg>`.
433433
//!

src/liballoc/macros.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ macro_rules! vec {
6262

6363
/// Creates a `String` using interpolation of runtime expressions.
6464
///
65-
/// The first argument `format!` receives is a format string. This must be a string
66-
/// literal. The power of the formatting string is in the `{}`s contained.
65+
/// The first argument `format!` receives is a format string. This must be a string
66+
/// literal. The power of the formatting string is in the `{}`s contained.
6767
///
6868
/// Additional parameters passed to `format!` replace the `{}`s within the
6969
/// formatting string in the order given unless named or positional parameters
@@ -73,7 +73,7 @@ macro_rules! vec {
7373
/// The same convention is used with [`print!`] and [`write!`] macros,
7474
/// depending on the intended destination of the string.
7575
///
76-
/// To convert a single value to a string, use the [`to_string`] method. This
76+
/// To convert a single value to a string, use the [`to_string`] method. This
7777
/// will use the [`Display`] formatting trait.
7878
///
7979
/// [fmt]: ../std/fmt/index.html

src/liballoc/vec.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -738,7 +738,7 @@ impl<T> Vec<T> {
738738
/// Forces the length of the vector to `new_len`.
739739
///
740740
/// This is a low-level operation that maintains none of the normal
741-
/// invariants of the type. Normally changing the length of a vector
741+
/// invariants of the type. Normally changing the length of a vector
742742
/// is done using one of the safe operations instead, such as
743743
/// [`truncate`], [`resize`], [`extend`], or [`clear`].
744744
///

src/libcore/alloc.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,7 @@ impl fmt::Display for CannotReallocInPlace {
425425
/// The `GlobalAlloc` trait is an `unsafe` trait for a number of reasons, and
426426
/// implementors must ensure that they adhere to these contracts:
427427
///
428-
/// * It's undefined behavior if global allocators unwind. This restriction may
428+
/// * It's undefined behavior if global allocators unwind. This restriction may
429429
/// be lifted in the future, but currently a panic from any of these
430430
/// functions may lead to memory unsafety.
431431
///

src/libcore/any.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
//!
1919
//! Consider a situation where we want to log out a value passed to a function.
2020
//! We know the value we're working on implements Debug, but we don't know its
21-
//! concrete type. We want to give special treatment to certain types: in this
21+
//! concrete type. We want to give special treatment to certain types: in this
2222
//! case printing out the length of String values prior to their value.
2323
//! We don't know the concrete type of our value at compile time, so we need to
2424
//! use runtime reflection instead.
@@ -31,8 +31,8 @@
3131
//! fn log<T: Any + Debug>(value: &T) {
3232
//! let value_any = value as &dyn Any;
3333
//!
34-
//! // try to convert our value to a String. If successful, we want to
35-
//! // output the String's length as well as its value. If not, it's a
34+
//! // Try to convert our value to a `String`. If successful, we want to
35+
//! // output the String`'s length as well as its value. If not, it's a
3636
//! // different type: just print it out unadorned.
3737
//! match value_any.downcast_ref::<String>() {
3838
//! Some(as_string) => {

src/libcore/cell.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -1133,7 +1133,7 @@ impl<'b, T: ?Sized> Ref<'b, T> {
11331133
/// The `RefCell` is already immutably borrowed, so this cannot fail.
11341134
///
11351135
/// This is an associated function that needs to be used as
1136-
/// `Ref::clone(...)`. A `Clone` implementation or a method would interfere
1136+
/// `Ref::clone(...)`. A `Clone` implementation or a method would interfere
11371137
/// with the widespread use of `r.borrow().clone()` to clone the contents of
11381138
/// a `RefCell`.
11391139
#[stable(feature = "cell_extras", since = "1.15.0")]
@@ -1174,7 +1174,7 @@ impl<'b, T: ?Sized> Ref<'b, T> {
11741174
}
11751175
}
11761176

1177-
/// Split a `Ref` into multiple `Ref`s for different components of the
1177+
/// Splits a `Ref` into multiple `Ref`s for different components of the
11781178
/// borrowed data.
11791179
///
11801180
/// The `RefCell` is already immutably borrowed, so this cannot fail.
@@ -1223,7 +1223,7 @@ impl<'b, T: ?Sized> RefMut<'b, T> {
12231223
/// The `RefCell` is already mutably borrowed, so this cannot fail.
12241224
///
12251225
/// This is an associated function that needs to be used as
1226-
/// `RefMut::map(...)`. A method would interfere with methods of the same
1226+
/// `RefMut::map(...)`. A method would interfere with methods of the same
12271227
/// name on the contents of a `RefCell` used through `Deref`.
12281228
///
12291229
/// # Examples
@@ -1253,7 +1253,7 @@ impl<'b, T: ?Sized> RefMut<'b, T> {
12531253
}
12541254
}
12551255

1256-
/// Split a `RefMut` into multiple `RefMut`s for different components of the
1256+
/// Splits a `RefMut` into multiple `RefMut`s for different components of the
12571257
/// borrowed data.
12581258
///
12591259
/// The underlying `RefCell` will remain mutably borrowed until both

src/libcore/cmp.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ use self::Ordering::*;
2626
/// relations](http://en.wikipedia.org/wiki/Partial_equivalence_relation).
2727
///
2828
/// This trait allows for partial equality, for types that do not have a full
29-
/// equivalence relation. For example, in floating point numbers `NaN != NaN`,
29+
/// equivalence relation. For example, in floating point numbers `NaN != NaN`,
3030
/// so floating point types implement `PartialEq` but not `Eq`.
3131
///
3232
/// Formally, the equality must be (for all `a`, `b` and `c`):

src/libcore/convert.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ pub trait AsMut<T: ?Sized> {
217217
///
218218
/// There is one exception to implementing `Into`, and it's kind of esoteric.
219219
/// If the destination type is not part of the current crate, and it uses a
220-
/// generic variable, then you can't implement `From` directly. For example,
220+
/// generic variable, then you can't implement `From` directly. For example,
221221
/// take this crate:
222222
///
223223
/// ```compile_fail

src/libcore/intrinsics.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
//! rustc compiler intrinsics.
1+
//! Compiler intrinsics.
22
//!
3-
//! The corresponding definitions are in librustc_codegen_llvm/intrinsic.rs.
3+
//! The corresponding definitions are in `librustc_codegen_llvm/intrinsic.rs`.
44
//!
55
//! # Volatiles
66
//!
@@ -697,7 +697,7 @@ extern "rust-intrinsic" {
697697
/// Creates a value initialized to zero.
698698
///
699699
/// `init` is unsafe because it returns a zeroed-out datum,
700-
/// which is unsafe unless T is `Copy`. Also, even if T is
700+
/// which is unsafe unless `T` is `Copy`. Also, even if T is
701701
/// `Copy`, an all-zero value may not correspond to any legitimate
702702
/// state for the type in question.
703703
pub fn init<T>() -> T;
@@ -988,7 +988,7 @@ extern "rust-intrinsic" {
988988
/// beginning at `dst` with the same size.
989989
///
990990
/// Like [`read`], `copy_nonoverlapping` creates a bitwise copy of `T`, regardless of
991-
/// whether `T` is [`Copy`]. If `T` is not [`Copy`], using *both* the values
991+
/// whether `T` is [`Copy`]. If `T` is not [`Copy`], using *both* the values
992992
/// in the region beginning at `*src` and the region beginning at `*dst` can
993993
/// [violate memory safety][read-ownership].
994994
///
@@ -1055,7 +1055,7 @@ extern "rust-intrinsic" {
10551055
/// [`copy_nonoverlapping`] can be used instead.
10561056
///
10571057
/// `copy` is semantically equivalent to C's [`memmove`], but with the argument
1058-
/// order swapped. Copying takes place as if the bytes were copied from `src`
1058+
/// order swapped. Copying takes place as if the bytes were copied from `src`
10591059
/// to a temporary array and then copied from the array to `dst`.
10601060
///
10611061
/// [`copy_nonoverlapping`]: ./fn.copy_nonoverlapping.html
@@ -1072,7 +1072,7 @@ extern "rust-intrinsic" {
10721072
/// * Both `src` and `dst` must be properly aligned.
10731073
///
10741074
/// Like [`read`], `copy` creates a bitwise copy of `T`, regardless of
1075-
/// whether `T` is [`Copy`]. If `T` is not [`Copy`], using both the values
1075+
/// whether `T` is [`Copy`]. If `T` is not [`Copy`], using both the values
10761076
/// in the region beginning at `*src` and the region beginning at `*dst` can
10771077
/// [violate memory safety][read-ownership].
10781078
///

src/libcore/iter/traits/iterator.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -564,9 +564,9 @@ pub trait Iterator {
564564
/// Calls a closure on each element of an iterator.
565565
///
566566
/// This is equivalent to using a [`for`] loop on the iterator, although
567-
/// `break` and `continue` are not possible from a closure. It's generally
567+
/// `break` and `continue` are not possible from a closure. It's generally
568568
/// more idiomatic to use a `for` loop, but `for_each` may be more legible
569-
/// when processing items at the end of longer iterator chains. In some
569+
/// when processing items at the end of longer iterator chains. In some
570570
/// cases `for_each` may also be faster than a loop, because it will use
571571
/// internal iteration on adaptors like `Chain`.
572572
///
@@ -1515,7 +1515,7 @@ pub trait Iterator {
15151515
/// is propagated back to the caller immediately (short-circuiting).
15161516
///
15171517
/// The initial value is the value the accumulator will have on the first
1518-
/// call. If applying the closure succeeded against every element of the
1518+
/// call. If applying the closure succeeded against every element of the
15191519
/// iterator, `try_fold()` returns the final accumulator as success.
15201520
///
15211521
/// Folding is useful whenever you have a collection of something, and want
@@ -1528,10 +1528,10 @@ pub trait Iterator {
15281528
/// do something better than the default `for` loop implementation.
15291529
///
15301530
/// In particular, try to have this call `try_fold()` on the internal parts
1531-
/// from which this iterator is composed. If multiple calls are needed,
1531+
/// from which this iterator is composed. If multiple calls are needed,
15321532
/// the `?` operator may be convenient for chaining the accumulator value
15331533
/// along, but beware any invariants that need to be upheld before those
1534-
/// early returns. This is a `&mut self` method, so iteration needs to be
1534+
/// early returns. This is a `&mut self` method, so iteration needs to be
15351535
/// resumable after hitting an error here.
15361536
///
15371537
/// # Examples

src/libcore/macros.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,7 @@ macro_rules! writeln {
432432
/// * Iterators that dynamically terminate.
433433
///
434434
/// If the determination that the code is unreachable proves incorrect, the
435-
/// program immediately terminates with a [`panic!`]. The function [`unreachable_unchecked`],
435+
/// program immediately terminates with a [`panic!`]. The function [`unreachable_unchecked`],
436436
/// which belongs to the [`std::hint`] module, informs the compiler to
437437
/// optimize the code out of the release version entirely.
438438
///

src/libcore/mem.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1101,7 +1101,7 @@ impl<T> MaybeUninit<T> {
11011101
}
11021102

11031103
/// Create a new `MaybeUninit` in an uninitialized state, with the memory being
1104-
/// filled with `0` bytes. It depends on `T` whether that already makes for
1104+
/// filled with `0` bytes. It depends on `T` whether that already makes for
11051105
/// proper initialization. For example, `MaybeUninit<usize>::zeroed()` is initialized,
11061106
/// but `MaybeUninit<&'static i32>::zeroed()` is not because references must not
11071107
/// be null.
@@ -1130,7 +1130,7 @@ impl<T> MaybeUninit<T> {
11301130
}
11311131
}
11321132

1133-
/// Extract the value from the `MaybeUninit` container. This is a great way
1133+
/// Extract the value from the `MaybeUninit` container. This is a great way
11341134
/// to ensure that the data will get dropped, because the resulting `T` is
11351135
/// subject to the usual drop handling.
11361136
///

src/libcore/num/dec2flt/mod.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
//!
3838
//! In addition, there are numerous helper functions that are used in the paper but not available
3939
//! in Rust (or at least in core). Our version is additionally complicated by the need to handle
40-
//! overflow and underflow and the desire to handle subnormal numbers. Bellerophon and
40+
//! overflow and underflow and the desire to handle subnormal numbers. Bellerophon and
4141
//! Algorithm R have trouble with overflow, subnormals, and underflow. We conservatively switch to
4242
//! Algorithm M (with the modifications described in section 8 of the paper) well before the
4343
//! inputs get into the critical region.
@@ -148,7 +148,7 @@ macro_rules! from_str_float_impl {
148148
/// # Return value
149149
///
150150
/// `Err(ParseFloatError)` if the string did not represent a valid
151-
/// number. Otherwise, `Ok(n)` where `n` is the floating-point
151+
/// number. Otherwise, `Ok(n)` where `n` is the floating-point
152152
/// number represented by `src`.
153153
#[inline]
154154
fn from_str(src: &str) -> Result<Self, ParseFloatError> {
@@ -209,7 +209,7 @@ fn pfe_invalid() -> ParseFloatError {
209209
ParseFloatError { kind: FloatErrorKind::Invalid }
210210
}
211211

212-
/// Split decimal string into sign and the rest, without inspecting or validating the rest.
212+
/// Splits a decimal string into sign and the rest, without inspecting or validating the rest.
213213
fn extract_sign(s: &str) -> (Sign, &str) {
214214
match s.as_bytes()[0] {
215215
b'+' => (Sign::Positive, &s[1..]),

src/libcore/num/dec2flt/rawfp.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,10 @@ pub trait RawFloat
5959
/// Type used by `to_bits` and `from_bits`.
6060
type Bits: Add<Output = Self::Bits> + From<u8> + TryFrom<u64>;
6161

62-
/// Raw transmutation to integer.
62+
/// Performs a raw transmutation to an integer.
6363
fn to_bits(self) -> Self::Bits;
6464

65-
/// Raw transmutation from integer.
65+
/// Performs a raw transmutation from an integer.
6666
fn from_bits(v: Self::Bits) -> Self;
6767

6868
/// Returns the category that this number falls into.
@@ -71,14 +71,14 @@ pub trait RawFloat
7171
/// Returns the mantissa, exponent and sign as integers.
7272
fn integer_decode(self) -> (u64, i16, i8);
7373

74-
/// Decode the float.
74+
/// Decodes the float.
7575
fn unpack(self) -> Unpacked;
7676

77-
/// Cast from a small integer that can be represented exactly. Panic if the integer can't be
77+
/// Casts from a small integer that can be represented exactly. Panic if the integer can't be
7878
/// represented, the other code in this module makes sure to never let that happen.
7979
fn from_int(x: u64) -> Self;
8080

81-
/// Get the value 10<sup>e</sup> from a pre-computed table.
81+
/// Gets the value 10<sup>e</sup> from a pre-computed table.
8282
/// Panics for `e >= CEIL_LOG5_OF_MAX_SIG`.
8383
fn short_fast_pow10(e: usize) -> Self;
8484

src/libcore/ops/arith.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -518,7 +518,7 @@ pub trait Rem<RHS=Self> {
518518

519519
macro_rules! rem_impl_integer {
520520
($($t:ty)*) => ($(
521-
/// This operation satisfies `n % d == n - (n / d) * d`. The
521+
/// This operation satisfies `n % d == n - (n / d) * d`. The
522522
/// result has the same sign as the left operand.
523523
#[stable(feature = "rust1", since = "1.0.0")]
524524
impl Rem for $t {

src/libcore/ops/try.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/// A trait for customizing the behavior of the `?` operator.
22
///
33
/// A type implementing `Try` is one that has a canonical way to view it
4-
/// in terms of a success/failure dichotomy. This trait allows both
4+
/// in terms of a success/failure dichotomy. This trait allows both
55
/// extracting those success or failure values from an existing instance and
66
/// creating a new instance from a success or failure value.
77
#[unstable(feature = "try_trait", issue = "42327")]

0 commit comments

Comments
 (0)