diff options
| author | Alexander Regueiro <alexreg@me.com> | 2019-02-09 22:16:58 +0000 |
|---|---|---|
| committer | Alexander Regueiro <alexreg@me.com> | 2019-02-10 23:57:25 +0000 |
| commit | 99ed06eb8864e704c4a1871ccda4648273bee4ef (patch) | |
| tree | fedfce65fa389e4fc58636bfbb9d9997656e3470 /src/libcore | |
| parent | b87363e7632b3f20f9b529696ffb5d5d9c3927cd (diff) | |
| download | rust-99ed06eb8864e704c4a1871ccda4648273bee4ef.tar.gz rust-99ed06eb8864e704c4a1871ccda4648273bee4ef.zip | |
libs: doc comments
Diffstat (limited to 'src/libcore')
37 files changed, 142 insertions, 138 deletions
diff --git a/src/libcore/cell.rs b/src/libcore/cell.rs index fb8d7e5d088..8383d305518 100644 --- a/src/libcore/cell.rs +++ b/src/libcore/cell.rs @@ -130,7 +130,7 @@ //! //! This is simply a special - but common - case of the previous: hiding mutability for operations //! that appear to be immutable. The `clone` method is expected to not change the source value, and -//! is declared to take `&self`, not `&mut self`. Therefore any mutation that happens in the +//! is declared to take `&self`, not `&mut self`. Therefore, any mutation that happens in the //! `clone` method must use cell types. For example, `Rc<T>` maintains its reference counts within a //! `Cell<T>`. //! @@ -1145,7 +1145,7 @@ impl<'b, T: ?Sized> Ref<'b, T> { } } - /// Make a new `Ref` for a component of the borrowed data. + /// Makes a new `Ref` for a component of the borrowed data. /// /// The `RefCell` is already immutably borrowed, so this cannot fail. /// @@ -1217,7 +1217,7 @@ impl<T: ?Sized + fmt::Display> fmt::Display for Ref<'_, T> { } impl<'b, T: ?Sized> RefMut<'b, T> { - /// Make a new `RefMut` for a component of the borrowed data, e.g., an enum + /// Makes a new `RefMut` for a component of the borrowed data, e.g., an enum /// variant. /// /// The `RefCell` is already mutably borrowed, so this cannot fail. @@ -1416,7 +1416,7 @@ impl<T: ?Sized + fmt::Display> fmt::Display for RefMut<'_, T> { /// co-exist with it. A `&mut T` must always be unique. /// /// Note that while mutating or mutably aliasing the contents of an `&UnsafeCell<T>` is -/// okay (provided you enforce the invariants some other way), it is still undefined behavior +/// ok (provided you enforce the invariants some other way), it is still undefined behavior /// to have multiple `&mut UnsafeCell<T>` aliases. /// /// # Examples diff --git a/src/libcore/char/decode.rs b/src/libcore/char/decode.rs index 510c46cdca0..133c9169df8 100644 --- a/src/libcore/char/decode.rs +++ b/src/libcore/char/decode.rs @@ -20,7 +20,7 @@ pub struct DecodeUtf16Error { code: u16, } -/// Create an iterator over the UTF-16 encoded code points in `iter`, +/// Creates an iterator over the UTF-16 encoded code points in `iter`, /// returning unpaired surrogates as `Err`s. /// /// # Examples diff --git a/src/libcore/char/methods.rs b/src/libcore/char/methods.rs index fbc9a4a6b8e..72967b9adf7 100644 --- a/src/libcore/char/methods.rs +++ b/src/libcore/char/methods.rs @@ -524,7 +524,7 @@ impl char { } } - /// Returns true if this `char` is an alphabetic code point, and false if not. + /// Returns `true` if this `char` is an alphabetic code point, and false if not. /// /// # Examples /// @@ -548,7 +548,7 @@ impl char { } } - /// Returns true if this `char` satisfies the 'XID_Start' Unicode property, and false + /// Returns `true` if this `char` satisfies the 'XID_Start' Unicode property, and false /// otherwise. /// /// 'XID_Start' is a Unicode Derived Property specified in @@ -562,7 +562,7 @@ impl char { derived_property::XID_Start(self) } - /// Returns true if this `char` satisfies the 'XID_Continue' Unicode property, and false + /// Returns `true` if this `char` satisfies the 'XID_Continue' Unicode property, and false /// otherwise. /// /// 'XID_Continue' is a Unicode Derived Property specified in @@ -576,7 +576,7 @@ impl char { derived_property::XID_Continue(self) } - /// Returns true if this `char` is lowercase, and false otherwise. + /// Returns `true` if this `char` is lowercase. /// /// 'Lowercase' is defined according to the terms of the Unicode Derived Core /// Property `Lowercase`. @@ -604,7 +604,7 @@ impl char { } } - /// Returns true if this `char` is uppercase, and false otherwise. + /// Returns `true` if this `char` is uppercase. /// /// 'Uppercase' is defined according to the terms of the Unicode Derived Core /// Property `Uppercase`. @@ -632,7 +632,7 @@ impl char { } } - /// Returns true if this `char` is whitespace, and false otherwise. + /// Returns `true` if this `char` is whitespace. /// /// 'Whitespace' is defined according to the terms of the Unicode Derived Core /// Property `White_Space`. @@ -659,7 +659,7 @@ impl char { } } - /// Returns true if this `char` is alphanumeric, and false otherwise. + /// Returns `true` if this `char` is alphanumeric. /// /// 'Alphanumeric'-ness is defined in terms of the Unicode General Categories /// 'Nd', 'Nl', 'No' and the Derived Core Property 'Alphabetic'. @@ -684,7 +684,7 @@ impl char { self.is_alphabetic() || self.is_numeric() } - /// Returns true if this `char` is a control code point, and false otherwise. + /// Returns `true` if this `char` is a control code point. /// /// 'Control code point' is defined in terms of the Unicode General /// Category `Cc`. @@ -704,7 +704,7 @@ impl char { general_category::Cc(self) } - /// Returns true if this `char` is an extended grapheme character, and false otherwise. + /// Returns `true` if this `char` is an extended grapheme character. /// /// 'Extended grapheme character' is defined in terms of the Unicode Shaping and Rendering /// Category `Grapheme_Extend`. @@ -713,7 +713,7 @@ impl char { derived_property::Grapheme_Extend(self) } - /// Returns true if this `char` is numeric, and false otherwise. + /// Returns `true` if this `char` is numeric. /// /// 'Numeric'-ness is defined in terms of the Unicode General Categories /// 'Nd', 'Nl', 'No'. diff --git a/src/libcore/default.rs b/src/libcore/default.rs index 0e47c2fd0b5..5ad05b38247 100644 --- a/src/libcore/default.rs +++ b/src/libcore/default.rs @@ -54,7 +54,7 @@ /// /// ## How can I implement `Default`? /// -/// Provide an implementation for the `default()` method that returns the value of +/// Provides an implementation for the `default()` method that returns the value of /// your type that should be the default: /// /// ``` diff --git a/src/libcore/ffi.rs b/src/libcore/ffi.rs index 644380c69f2..d88793f2801 100644 --- a/src/libcore/ffi.rs +++ b/src/libcore/ffi.rs @@ -184,7 +184,7 @@ impl<'a> VaList<'a> { va_arg(self) } - /// Copy the `va_list` at the current location. + /// Copies the `va_list` at the current location. #[unstable(feature = "c_variadic", reason = "the `c_variadic` feature has not been properly tested on \ all supported platforms", @@ -213,7 +213,7 @@ extern "rust-intrinsic" { /// `va_copy`. fn va_end(ap: &mut VaList); - /// Copy the current location of arglist `src` to the arglist `dst`. + /// Copies the current location of arglist `src` to the arglist `dst`. #[cfg(any(all(not(target_arch = "aarch64"), not(target_arch = "powerpc"), not(target_arch = "x86_64")), windows))] diff --git a/src/libcore/fmt/mod.rs b/src/libcore/fmt/mod.rs index 530b2f52c0d..2ce58c803b8 100644 --- a/src/libcore/fmt/mod.rs +++ b/src/libcore/fmt/mod.rs @@ -483,12 +483,12 @@ impl Display for Arguments<'_> { /// implementations, such as [`debug_struct`][debug_struct]. /// /// `Debug` implementations using either `derive` or the debug builder API -/// on [`Formatter`] support pretty printing using the alternate flag: `{:#?}`. +/// on [`Formatter`] support pretty-printing using the alternate flag: `{:#?}`. /// /// [debug_struct]: ../../std/fmt/struct.Formatter.html#method.debug_struct /// [`Formatter`]: ../../std/fmt/struct.Formatter.html /// -/// Pretty printing with `#?`: +/// Pretty-printing with `#?`: /// /// ``` /// #[derive(Debug)] diff --git a/src/libcore/future/future.rs b/src/libcore/future/future.rs index 539b07fc21e..0f142347a95 100644 --- a/src/libcore/future/future.rs +++ b/src/libcore/future/future.rs @@ -60,7 +60,7 @@ pub trait Future { /// progress, meaning that each time the current task is woken up, it should /// actively re-`poll` pending futures that it still has an interest in. /// - /// The `poll` function is not called repeatedly in a tight loop-- instead, + /// The `poll` function is not called repeatedly in a tight loop -- instead, /// it should only be called when the future indicates that it is ready to /// make progress (by calling `wake()`). If you're familiar with the /// `poll(2)` or `select(2)` syscalls on Unix it's worth noting that futures diff --git a/src/libcore/hash/sip.rs b/src/libcore/hash/sip.rs index 18f09f4c5dd..235c79307ab 100644 --- a/src/libcore/hash/sip.rs +++ b/src/libcore/hash/sip.rs @@ -10,7 +10,7 @@ use mem; /// An implementation of SipHash 1-3. /// /// This is currently the default hashing function used by standard library -/// (eg. `collections::HashMap` uses it by default). +/// (e.g., `collections::HashMap` uses it by default). /// /// See: <https://131002.net/siphash> #[unstable(feature = "hashmap_internals", issue = "0")] @@ -90,7 +90,7 @@ macro_rules! compress { }); } -/// Load an integer of the desired type from a byte stream, in LE order. Uses +/// Loads an integer of the desired type from a byte stream, in LE order. Uses /// `copy_nonoverlapping` to let the compiler generate the most efficient way /// to load it from a possibly unaligned address. /// @@ -107,7 +107,7 @@ macro_rules! load_int_le { }); } -/// Load an u64 using up to 7 bytes of a byte slice. +/// Loads an u64 using up to 7 bytes of a byte slice. /// /// Unsafe because: unchecked indexing at start..start+len #[inline] diff --git a/src/libcore/hint.rs b/src/libcore/hint.rs index ad5a2071a73..89de5c1bc8a 100644 --- a/src/libcore/hint.rs +++ b/src/libcore/hint.rs @@ -34,7 +34,7 @@ use intrinsics; /// use std::hint::unreachable_unchecked; /// /// // `b.saturating_add(1)` is always positive (not zero), -/// // hence `checked_div` will never return None. +/// // hence `checked_div` will never return `None`. /// // Therefore, the else branch is unreachable. /// a.checked_div(b.saturating_add(1)) /// .unwrap_or_else(|| unsafe { unreachable_unchecked() }) diff --git a/src/libcore/intrinsics.rs b/src/libcore/intrinsics.rs index c29358c4c4a..f6de7566be9 100644 --- a/src/libcore/intrinsics.rs +++ b/src/libcore/intrinsics.rs @@ -315,35 +315,35 @@ extern "rust-intrinsic" { /// [`AtomicBool::swap`](../../std/sync/atomic/struct.AtomicBool.html#method.swap). pub fn atomic_xchg_relaxed<T>(dst: *mut T, src: T) -> T; - /// Add to the current value, returning the previous value. + /// Adds to the current value, returning the previous value. /// The stabilized version of this intrinsic is available on the /// `std::sync::atomic` types via the `fetch_add` method by passing /// [`Ordering::SeqCst`](../../std/sync/atomic/enum.Ordering.html) /// as the `order`. For example, /// [`AtomicIsize::fetch_add`](../../std/sync/atomic/struct.AtomicIsize.html#method.fetch_add). pub fn atomic_xadd<T>(dst: *mut T, src: T) -> T; - /// Add to the current value, returning the previous value. + /// Adds to the current value, returning the previous value. /// The stabilized version of this intrinsic is available on the /// `std::sync::atomic` types via the `fetch_add` method by passing /// [`Ordering::Acquire`](../../std/sync/atomic/enum.Ordering.html) /// as the `order`. For example, /// [`AtomicIsize::fetch_add`](../../std/sync/atomic/struct.AtomicIsize.html#method.fetch_add). pub fn atomic_xadd_acq<T>(dst: *mut T, src: T) -> T; - /// Add to the current value, returning the previous value. + /// Adds to the current value, returning the previous value. /// The stabilized version of this intrinsic is available on the /// `std::sync::atomic` types via the `fetch_add` method by passing /// [`Ordering::Release`](../../std/sync/atomic/enum.Ordering.html) /// as the `order`. For example, /// [`AtomicIsize::fetch_add`](../../std/sync/atomic/struct.AtomicIsize.html#method.fetch_add). pub fn atomic_xadd_rel<T>(dst: *mut T, src: T) -> T; - /// Add to the current value, returning the previous value. + /// Adds to the current value, returning the previous value. /// The stabilized version of this intrinsic is available on the /// `std::sync::atomic` types via the `fetch_add` method by passing /// [`Ordering::AcqRel`](../../std/sync/atomic/enum.Ordering.html) /// as the `order`. For example, /// [`AtomicIsize::fetch_add`](../../std/sync/atomic/struct.AtomicIsize.html#method.fetch_add). pub fn atomic_xadd_acqrel<T>(dst: *mut T, src: T) -> T; - /// Add to the current value, returning the previous value. + /// Adds to the current value, returning the previous value. /// The stabilized version of this intrinsic is available on the /// `std::sync::atomic` types via the `fetch_add` method by passing /// [`Ordering::Relaxed`](../../std/sync/atomic/enum.Ordering.html) @@ -556,7 +556,7 @@ extern "rust-intrinsic" { pub fn atomic_umax_relaxed<T>(dst: *mut T, src: T) -> T; /// The `prefetch` intrinsic is a hint to the code generator to insert a prefetch instruction - /// if supported; otherwise, it is a noop. + /// if supported; otherwise, it is a no-op. /// Prefetches have no effect on the behavior of the program but can change its performance /// characteristics. /// @@ -564,7 +564,7 @@ extern "rust-intrinsic" { /// ranging from (0) - no locality, to (3) - extremely local keep in cache pub fn prefetch_read_data<T>(data: *const T, locality: i32); /// The `prefetch` intrinsic is a hint to the code generator to insert a prefetch instruction - /// if supported; otherwise, it is a noop. + /// if supported; otherwise, it is a no-op. /// Prefetches have no effect on the behavior of the program but can change its performance /// characteristics. /// @@ -572,7 +572,7 @@ extern "rust-intrinsic" { /// ranging from (0) - no locality, to (3) - extremely local keep in cache pub fn prefetch_write_data<T>(data: *const T, locality: i32); /// The `prefetch` intrinsic is a hint to the code generator to insert a prefetch instruction - /// if supported; otherwise, it is a noop. + /// if supported; otherwise, it is a no-op. /// Prefetches have no effect on the behavior of the program but can change its performance /// characteristics. /// @@ -580,7 +580,7 @@ extern "rust-intrinsic" { /// ranging from (0) - no locality, to (3) - extremely local keep in cache pub fn prefetch_read_instruction<T>(data: *const T, locality: i32); /// The `prefetch` intrinsic is a hint to the code generator to insert a prefetch instruction - /// if supported; otherwise, it is a noop. + /// if supported; otherwise, it is a no-op. /// Prefetches have no effect on the behavior of the program but can change its performance /// characteristics. /// @@ -857,7 +857,7 @@ extern "rust-intrinsic" { /// /// // The no-copy, unsafe way, still using transmute, but not UB. /// // This is equivalent to the original, but safer, and reuses the - /// // same Vec internals. Therefore the new inner type must have the + /// // same `Vec` internals. Therefore, the new inner type must have the /// // exact same size, and the same alignment, as the old type. /// // The same caveats exist for this method as transmute, for /// // the original inner type (`&i32`) to the converted inner type @@ -875,8 +875,8 @@ extern "rust-intrinsic" { /// ``` /// use std::{slice, mem}; /// - /// // There are multiple ways to do this; and there are multiple problems - /// // with the following, transmute, way. + /// // There are multiple ways to do this, and there are multiple problems + /// // with the following (transmute) way. /// fn split_at_mut_transmute<T>(slice: &mut [T], mid: usize) /// -> (&mut [T], &mut [T]) { /// let len = slice.len(); @@ -1200,19 +1200,19 @@ extern "rust-intrinsic" { /// unless size is equal to zero. pub fn volatile_set_memory<T>(dst: *mut T, val: u8, count: usize); - /// Perform a volatile load from the `src` pointer. + /// Performs a volatile load from the `src` pointer. /// The stabilized version of this intrinsic is /// [`std::ptr::read_volatile`](../../std/ptr/fn.read_volatile.html). pub fn volatile_load<T>(src: *const T) -> T; - /// Perform a volatile store to the `dst` pointer. + /// Performs a volatile store to the `dst` pointer. /// The stabilized version of this intrinsic is /// [`std::ptr::write_volatile`](../../std/ptr/fn.write_volatile.html). pub fn volatile_store<T>(dst: *mut T, val: T); - /// Perform a volatile load from the `src` pointer + /// Performs a volatile load from the `src` pointer /// The pointer is not required to be aligned. pub fn unaligned_volatile_load<T>(src: *const T) -> T; - /// Perform a volatile store to the `dst` pointer. + /// Performs a volatile store to the `dst` pointer. /// The pointer is not required to be aligned. pub fn unaligned_volatile_store<T>(dst: *mut T, val: T); diff --git a/src/libcore/iter/range.rs b/src/libcore/iter/range.rs index 66c09a0ddd0..a3e9cfa9493 100644 --- a/src/libcore/iter/range.rs +++ b/src/libcore/iter/range.rs @@ -20,19 +20,19 @@ pub trait Step: Clone + PartialOrd + Sized { /// without overflow. fn steps_between(start: &Self, end: &Self) -> Option<usize>; - /// Replaces this step with `1`, returning itself + /// Replaces this step with `1`, returning itself. fn replace_one(&mut self) -> Self; - /// Replaces this step with `0`, returning itself + /// Replaces this step with `0`, returning itself. fn replace_zero(&mut self) -> Self; - /// Adds one to this step, returning the result + /// Adds one to this step, returning the result. fn add_one(&self) -> Self; - /// Subtracts one to this step, returning the result + /// Subtracts one to this step, returning the result. fn sub_one(&self) -> Self; - /// Add an usize, returning None on overflow + /// Adds a `usize`, returning `None` on overflow. fn add_usize(&self, n: usize) -> Option<Self>; } diff --git a/src/libcore/iter/traits/exact_size.rs b/src/libcore/iter/traits/exact_size.rs index 3bfba29e219..d6eab40213e 100644 --- a/src/libcore/iter/traits/exact_size.rs +++ b/src/libcore/iter/traits/exact_size.rs @@ -104,7 +104,7 @@ pub trait ExactSizeIterator: Iterator { lower } - /// Returns whether the iterator is empty. + /// Returns `true` if the iterator is empty. /// /// This method has a default implementation using `self.len()`, so you /// don't need to implement it yourself. diff --git a/src/libcore/iter/traits/iterator.rs b/src/libcore/iter/traits/iterator.rs index 1c86745d9ba..861e9c3157a 100644 --- a/src/libcore/iter/traits/iterator.rs +++ b/src/libcore/iter/traits/iterator.rs @@ -120,7 +120,7 @@ pub trait Iterator { /// // ... and then None once it's over. /// assert_eq!(None, iter.next()); /// - /// // More calls may or may not return None. Here, they always will. + /// // More calls may or may not return `None`. Here, they always will. /// assert_eq!(None, iter.next()); /// assert_eq!(None, iter.next()); /// ``` @@ -1215,7 +1215,7 @@ pub trait Iterator { /// assert_eq!(iter.next(), Some(4)); /// assert_eq!(iter.next(), None); /// - /// // it will always return None after the first time. + /// // it will always return `None` after the first time. /// assert_eq!(iter.next(), None); /// assert_eq!(iter.next(), None); /// assert_eq!(iter.next(), None); diff --git a/src/libcore/macros.rs b/src/libcore/macros.rs index d81d309a81a..2a9cb75df2c 100644 --- a/src/libcore/macros.rs +++ b/src/libcore/macros.rs @@ -1,4 +1,4 @@ -/// Entry point of thread panic, for details, see std::macros +/// Entry point of thread panic. For details, see `std::macros`. #[macro_export] #[allow_internal_unstable] #[stable(feature = "core", since = "1.6.0")] @@ -493,7 +493,7 @@ macro_rules! unreachable { /// A standardized placeholder for marking unfinished code. /// /// This can be useful if you are prototyping and are just looking to have your -/// code typecheck, or if you're implementing a trait that requires multiple +/// code type-check, or if you're implementing a trait that requires multiple /// methods, and you're only planning on using one of them. /// /// # Panics diff --git a/src/libcore/mem.rs b/src/libcore/mem.rs index 855b8ba7f96..2a493e88fe8 100644 --- a/src/libcore/mem.rs +++ b/src/libcore/mem.rs @@ -295,7 +295,7 @@ pub const fn size_of<T>() -> usize { /// Returns the size of the pointed-to value in bytes. /// /// This is usually the same as `size_of::<T>()`. However, when `T` *has* no -/// statically known size, e.g., a slice [`[T]`][slice] or a [trait object], +/// statically-known size, e.g., a slice [`[T]`][slice] or a [trait object], /// then `size_of_val` can be used to get the dynamically-known size. /// /// [slice]: ../../std/primitive.slice.html @@ -403,7 +403,7 @@ pub fn align_of_val<T: ?Sized>(val: &T) -> usize { unsafe { intrinsics::min_align_of_val(val) } } -/// Returns whether dropping values of type `T` matters. +/// Returns `true` if dropping values of type `T` matters. /// /// This is purely an optimization hint, and may be implemented conservatively: /// it may return `true` for types that don't actually need to be dropped. @@ -958,7 +958,7 @@ impl<T> ManuallyDrop<T> { ManuallyDrop { value } } - /// Extract the value from the `ManuallyDrop` container. + /// Extracts the value from the `ManuallyDrop` container. /// /// This allows the value to be dropped again. /// @@ -1038,26 +1038,29 @@ impl<T: ?Sized> DerefMut for ManuallyDrop<T> { /// A newtype to construct uninitialized instances of `T`. /// /// The compiler, in general, assumes that variables are properly initialized -/// at their respective type. For example, a variable of reference type must -/// be aligned and non-NULL. This is an invariant that must *always* be upheld, -/// even in unsafe code. As a consequence, 0-initializing a variable of reference +/// at their respective type. For example, a variable of reference type must +/// be aligned and non-NULL. This is an invariant that must *always* be upheld, +/// even in unsafe code. As a consequence, zero-initializing a variable of reference /// type causes instantaneous undefined behavior, no matter whether that reference /// ever gets used to access memory: +/// /// ```rust,no_run /// use std::mem; /// /// let x: &i32 = unsafe { mem::zeroed() }; // undefined behavior! /// ``` +/// /// This is exploited by the compiler for various optimizations, such as eliding /// run-time checks and optimizing `enum` layout. /// -/// Not initializing memory at all (instead of 0-initializing it) causes the same +/// Not initializing memory at all (instead of zero--initializing it) causes the same /// issue: after all, the initial value of the variable might just happen to be /// one that violates the invariant. /// /// `MaybeUninit` serves to enable unsafe code to deal with uninitialized data: /// it is a signal to the compiler indicating that the data here might *not* /// be initialized: +/// /// ```rust /// #![feature(maybe_uninit)] /// use std::mem::MaybeUninit; @@ -1070,6 +1073,7 @@ impl<T: ?Sized> DerefMut for ManuallyDrop<T> { /// // initializing `x`! /// let x = unsafe { x.into_initialized() }; /// ``` +/// /// The compiler then knows to not optimize this code. #[allow(missing_debug_implementations)] #[unstable(feature = "maybe_uninit", issue = "53491")] @@ -1090,7 +1094,7 @@ impl<T> MaybeUninit<T> { MaybeUninit { value: ManuallyDrop::new(val) } } - /// Create a new `MaybeUninit` in an uninitialized state. + /// Creates a new `MaybeUninit` in an uninitialized state. /// /// Note that dropping a `MaybeUninit` will never call `T`'s drop code. /// It is your responsibility to make sure `T` gets dropped if it got initialized. @@ -1100,7 +1104,7 @@ impl<T> MaybeUninit<T> { MaybeUninit { uninit: () } } - /// Create a new `MaybeUninit` in an uninitialized state, with the memory being + /// Creates a new `MaybeUninit` in an uninitialized state, with the memory being /// filled with `0` bytes. It depends on `T` whether that already makes for /// proper initialization. For example, `MaybeUninit<usize>::zeroed()` is initialized, /// but `MaybeUninit<&'static i32>::zeroed()` is not because references must not @@ -1118,9 +1122,9 @@ impl<T> MaybeUninit<T> { u } - /// Set the value of the `MaybeUninit`. This overwrites any previous value without dropping it. - /// For your convenience, this also returns a mutable reference to the (now - /// safely initialized) content of `self`. + /// Sets the value of the `MaybeUninit`. This overwrites any previous value without dropping it. + /// For your convenience, this also returns a mutable reference to the (now safely initialized) + /// contents of `self`. #[unstable(feature = "maybe_uninit", issue = "53491")] #[inline(always)] pub fn set(&mut self, val: T) -> &mut T { @@ -1130,7 +1134,7 @@ impl<T> MaybeUninit<T> { } } - /// Extract the value from the `MaybeUninit` container. This is a great way + /// Extracts the value from the `MaybeUninit` container. This is a great way /// to ensure that the data will get dropped, because the resulting `T` is /// subject to the usual drop handling. /// @@ -1145,7 +1149,7 @@ impl<T> MaybeUninit<T> { ManuallyDrop::into_inner(self.value) } - /// Deprecated alternative to `into_initialized`. Will never get stabilized. + /// Deprecated alternative to `into_initialized`. Will never get stabilized. /// Exists only to transition stdsimd to `into_initialized`. #[inline(always)] #[allow(unused)] @@ -1153,7 +1157,7 @@ impl<T> MaybeUninit<T> { self.into_initialized() } - /// Get a reference to the contained value. + /// Gets a reference to the contained value. /// /// # Unsafety /// @@ -1165,7 +1169,7 @@ impl<T> MaybeUninit<T> { &*self.value } - /// Get a mutable reference to the contained value. + /// Gets a mutable reference to the contained value. /// /// # Unsafety /// @@ -1180,7 +1184,7 @@ impl<T> MaybeUninit<T> { &mut *self.value } - /// Get a pointer to the contained value. Reading from this pointer or turning it + /// Gets a pointer to the contained value. Reading from this pointer or turning it /// into a reference will be undefined behavior unless the `MaybeUninit` is initialized. #[unstable(feature = "maybe_uninit", issue = "53491")] #[inline(always)] @@ -1188,7 +1192,7 @@ impl<T> MaybeUninit<T> { unsafe { &*self.value as *const T } } - /// Get a mutable pointer to the contained value. Reading from this pointer or turning it + /// Get sa mutable pointer to the contained value. Reading from this pointer or turning it /// into a reference will be undefined behavior unless the `MaybeUninit` is initialized. #[unstable(feature = "maybe_uninit", issue = "53491")] #[inline(always)] @@ -1196,14 +1200,14 @@ impl<T> MaybeUninit<T> { unsafe { &mut *self.value as *mut T } } - /// Get a pointer to the first element of the array. + /// Gets a pointer to the first element of the array. #[unstable(feature = "maybe_uninit", issue = "53491")] #[inline(always)] pub fn first_ptr(this: &[MaybeUninit<T>]) -> *const T { this as *const [MaybeUninit<T>] as *const T } - /// Get a mutable pointer to the first element of the array. + /// Gets a mutable pointer to the first element of the array. #[unstable(feature = "maybe_uninit", issue = "53491")] #[inline(always)] pub fn first_ptr_mut(this: &mut [MaybeUninit<T>]) -> *mut T { diff --git a/src/libcore/num/dec2flt/algorithm.rs b/src/libcore/num/dec2flt/algorithm.rs index d56fa9662a9..3b57bb7544b 100644 --- a/src/libcore/num/dec2flt/algorithm.rs +++ b/src/libcore/num/dec2flt/algorithm.rs @@ -61,7 +61,7 @@ mod fpu_precision { unsafe { asm!("fldcw $0" :: "m" (cw) :: "volatile") } } - /// Set the precision field of the FPU to `T` and return a `FPUControlWord` + /// Sets the precision field of the FPU to `T` and returns a `FPUControlWord`. pub fn set_precision<T>() -> FPUControlWord { let cw = 0u16; diff --git a/src/libcore/num/dec2flt/mod.rs b/src/libcore/num/dec2flt/mod.rs index a1bf6f824f6..47ea5aa5ff0 100644 --- a/src/libcore/num/dec2flt/mod.rs +++ b/src/libcore/num/dec2flt/mod.rs @@ -54,7 +54,7 @@ //! operations as well, if you want 0.5 ULP accuracy you need to do *everything* in full precision //! and round *exactly once, at the end*, by considering all truncated bits at once. //! -//! FIXME Although some code duplication is necessary, perhaps parts of the code could be shuffled +//! FIXME: Although some code duplication is necessary, perhaps parts of the code could be shuffled //! around such that less code is duplicated. Large parts of the algorithms are independent of the //! float type to output, or only needs access to a few constants, which could be passed in as //! parameters. @@ -219,7 +219,7 @@ fn extract_sign(s: &str) -> (Sign, &str) { } } -/// Convert a decimal string into a floating point number. +/// Converts a decimal string into a floating point number. fn dec2flt<T: RawFloat>(s: &str) -> Result<T, ParseFloatError> { if s.is_empty() { return Err(pfe_empty()) diff --git a/src/libcore/num/dec2flt/num.rs b/src/libcore/num/dec2flt/num.rs index b76c58cc66e..12671318571 100644 --- a/src/libcore/num/dec2flt/num.rs +++ b/src/libcore/num/dec2flt/num.rs @@ -27,7 +27,7 @@ pub fn compare_with_half_ulp(f: &Big, ones_place: usize) -> Ordering { Equal } -/// Convert an ASCII string containing only decimal digits to a `u64`. +/// Converts an ASCII string containing only decimal digits to a `u64`. /// /// Does not perform checks for overflow or invalid characters, so if the caller is not careful, /// the result is bogus and can panic (though it won't be `unsafe`). Additionally, empty strings @@ -44,7 +44,7 @@ pub fn from_str_unchecked<'a, T>(bytes: T) -> u64 where T : IntoIterator<Item=&' result } -/// Convert a string of ASCII digits into a bignum. +/// Converts a string of ASCII digits into a bignum. /// /// Like `from_str_unchecked`, this function relies on the parser to weed out non-digits. pub fn digits_to_big(integral: &[u8], fractional: &[u8]) -> Big { @@ -69,7 +69,7 @@ pub fn to_u64(x: &Big) -> u64 { } -/// Extract a range of bits. +/// Extracts a range of bits. /// Index 0 is the least significant bit and the range is half-open as usual. /// Panics if asked to extract more bits than fit into the return type. diff --git a/src/libcore/num/dec2flt/parse.rs b/src/libcore/num/dec2flt/parse.rs index 9e075e43303..933f8c1d3f7 100644 --- a/src/libcore/num/dec2flt/parse.rs +++ b/src/libcore/num/dec2flt/parse.rs @@ -42,7 +42,7 @@ pub enum ParseResult<'a> { Invalid, } -/// Check if the input string is a valid floating point number and if so, locate the integral +/// Checks if the input string is a valid floating point number and if so, locate the integral /// part, the fractional part, and the exponent in it. Does not handle signs. pub fn parse_decimal(s: &str) -> ParseResult { if s.is_empty() { diff --git a/src/libcore/num/dec2flt/rawfp.rs b/src/libcore/num/dec2flt/rawfp.rs index 06d7fb8d103..b65f539b29c 100644 --- a/src/libcore/num/dec2flt/rawfp.rs +++ b/src/libcore/num/dec2flt/rawfp.rs @@ -240,7 +240,7 @@ impl RawFloat for f64 { fn from_bits(v: Self::Bits) -> Self { Self::from_bits(v) } } -/// Convert an Fp to the closest machine float type. +/// Converts an `Fp` to the closest machine float type. /// Does not handle subnormal results. pub fn fp_to_float<T: RawFloat>(x: Fp) -> T { let x = x.normalize(); @@ -319,7 +319,7 @@ pub fn big_to_fp(f: &Big) -> Fp { } } -/// Find the largest floating point number strictly smaller than the argument. +/// Finds the largest floating point number strictly smaller than the argument. /// Does not handle subnormals, zero, or exponent underflow. pub fn prev_float<T: RawFloat>(x: T) -> T { match x.classify() { diff --git a/src/libcore/num/f32.rs b/src/libcore/num/f32.rs index 68da79135d3..dc0580764ac 100644 --- a/src/libcore/num/f32.rs +++ b/src/libcore/num/f32.rs @@ -144,7 +144,7 @@ pub mod consts { #[lang = "f32"] #[cfg(not(test))] impl f32 { - /// Returns `true` if this value is `NaN` and false otherwise. + /// Returns `true` if this value is `NaN`. /// /// ``` /// use std::f32; @@ -169,8 +169,8 @@ impl f32 { f32::from_bits(self.to_bits() & 0x7fff_ffff) } - /// Returns `true` if this value is positive infinity or negative infinity and - /// false otherwise. + /// Returns `true` if this value is positive infinity or negative infinity, and + /// `false` otherwise. /// /// ``` /// use std::f32; @@ -272,7 +272,7 @@ impl f32 { } } - /// Returns `true` if and only if `self` has a positive sign, including `+0.0`, `NaN`s with + /// Returns `true` if `self` has a positive sign, including `+0.0`, `NaN`s with /// positive sign bit and positive infinity. /// /// ``` @@ -288,7 +288,7 @@ impl f32 { !self.is_sign_negative() } - /// Returns `true` if and only if `self` has a negative sign, including `-0.0`, `NaN`s with + /// Returns `true` if `self` has a negative sign, including `-0.0`, `NaN`s with /// negative sign bit and negative infinity. /// /// ``` diff --git a/src/libcore/num/f64.rs b/src/libcore/num/f64.rs index b6773915481..c3677f8c8fa 100644 --- a/src/libcore/num/f64.rs +++ b/src/libcore/num/f64.rs @@ -144,7 +144,7 @@ pub mod consts { #[lang = "f64"] #[cfg(not(test))] impl f64 { - /// Returns `true` if this value is `NaN` and false otherwise. + /// Returns `true` if this value is `NaN`. /// /// ``` /// use std::f64; @@ -169,8 +169,8 @@ impl f64 { f64::from_bits(self.to_bits() & 0x7fff_ffff_ffff_ffff) } - /// Returns `true` if this value is positive infinity or negative infinity and - /// false otherwise. + /// Returns `true` if this value is positive infinity or negative infinity, and + /// `false` otherwise. /// /// ``` /// use std::f64; @@ -272,7 +272,7 @@ impl f64 { } } - /// Returns `true` if and only if `self` has a positive sign, including `+0.0`, `NaN`s with + /// Returns `true` if `self` has a positive sign, including `+0.0`, `NaN`s with /// positive sign bit and positive infinity. /// /// ``` @@ -296,7 +296,7 @@ impl f64 { self.is_sign_positive() } - /// Returns `true` if and only if `self` has a negative sign, including `-0.0`, `NaN`s with + /// Returns `true` if `self` has a negative sign, including `-0.0`, `NaN`s with /// negative sign bit and negative infinity. /// /// ``` diff --git a/src/libcore/num/mod.rs b/src/libcore/num/mod.rs index f80f8392827..6b3ec2c21be 100644 --- a/src/libcore/num/mod.rs +++ b/src/libcore/num/mod.rs @@ -52,7 +52,7 @@ assert_eq!(size_of::<Option<core::num::", stringify!($Ty), ">>(), size_of::<", s } impl $Ty { - /// Create a non-zero without checking the value. + /// Creates a non-zero without checking the value. /// /// # Safety /// @@ -63,7 +63,7 @@ assert_eq!(size_of::<Option<core::num::", stringify!($Ty), ">>(), size_of::<", s $Ty(n) } - /// Create a non-zero if the given value is not zero. + /// Creates a non-zero if the given value is not zero. #[$stability] #[inline] pub fn new(n: $Int) -> Option<Self> { diff --git a/src/libcore/ops/arith.rs b/src/libcore/ops/arith.rs index 202beddfcb0..0252edee231 100644 --- a/src/libcore/ops/arith.rs +++ b/src/libcore/ops/arith.rs @@ -49,7 +49,7 @@ /// } /// /// // Notice that the implementation uses the associated type `Output`. -/// impl<T: Add<Output=T>> Add for Point<T> { +/// impl<T: Add<Output = T>> Add for Point<T> { /// type Output = Point<T>; /// /// fn add(self, other: Point<T>) -> Point<T> { @@ -157,7 +157,7 @@ add_impl! { usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 f32 f64 } /// } /// /// // Notice that the implementation uses the associated type `Output`. -/// impl<T: Sub<Output=T>> Sub for Point<T> { +/// impl<T: Sub<Output = T>> Sub for Point<T> { /// type Output = Point<T>; /// /// fn sub(self, other: Point<T>) -> Point<T> { diff --git a/src/libcore/ops/range.rs b/src/libcore/ops/range.rs index 815a4cfeed8..b3dd5d20299 100644 --- a/src/libcore/ops/range.rs +++ b/src/libcore/ops/range.rs @@ -52,7 +52,7 @@ impl fmt::Debug for RangeFull { /// (`start..end`). /// /// The `Range` `start..end` contains all values with `x >= start` and -/// `x < end`. It is empty unless `start < end`. +/// `x < end`. It is empty unless `start < end`. /// /// # Examples /// @@ -297,7 +297,7 @@ impl<Idx: PartialOrd<Idx>> RangeTo<Idx> { /// A range bounded inclusively below and above (`start..=end`). /// /// The `RangeInclusive` `start..=end` contains all values with `x >= start` -/// and `x <= end`. It is empty unless `start <= end`. +/// and `x <= end`. It is empty unless `start <= end`. /// /// This iterator is [fused], but the specific values of `start` and `end` after /// iteration has finished are **unspecified** other than that [`.is_empty()`] diff --git a/src/libcore/option.rs b/src/libcore/option.rs index 0e54397db02..76ef36ac309 100644 --- a/src/libcore/option.rs +++ b/src/libcore/option.rs @@ -214,7 +214,7 @@ impl<T> Option<T> { /// /// # Examples /// - /// Convert an `Option<`[`String`]`>` into an `Option<`[`usize`]`>`, preserving the original. + /// Converts an `Option<`[`String`]`>` into an `Option<`[`usize`]`>`, preserving the original. /// The [`map`] method takes the `self` argument by value, consuming the original, /// so this technique uses `as_ref` to first take an `Option` to a reference /// to the value inside the original. @@ -395,7 +395,7 @@ impl<T> Option<T> { /// /// # Examples /// - /// Convert an `Option<`[`String`]`>` into an `Option<`[`usize`]`>`, consuming the original: + /// Converts an `Option<`[`String`]`>` into an `Option<`[`usize`]`>`, consuming the original: /// /// [`String`]: ../../std/string/struct.String.html /// [`usize`]: ../../std/primitive.usize.html @@ -963,7 +963,7 @@ impl<T: Default> Option<T> { /// /// # Examples /// - /// Convert a string to an integer, turning poorly-formed strings + /// Converts a string to an integer, turning poorly-formed strings /// into 0 (the default value for integers). [`parse`] converts /// a string to any other type that implements [`FromStr`], returning /// [`None`] on error. diff --git a/src/libcore/pin.rs b/src/libcore/pin.rs index 56a32c928fb..ee9098d73ee 100644 --- a/src/libcore/pin.rs +++ b/src/libcore/pin.rs @@ -199,7 +199,7 @@ impl<P: Deref> Pin<P> { Pin { pointer } } - /// Get a pinned shared reference from this pinned pointer. + /// Gets a pinned shared reference from this pinned pointer. #[stable(feature = "pin", since = "1.33.0")] #[inline(always)] pub fn as_ref(self: &Pin<P>) -> Pin<&P::Target> { @@ -208,7 +208,7 @@ impl<P: Deref> Pin<P> { } impl<P: DerefMut> Pin<P> { - /// Get a pinned mutable reference from this pinned pointer. + /// Gets a pinned mutable reference from this pinned pointer. #[stable(feature = "pin", since = "1.33.0")] #[inline(always)] pub fn as_mut(self: &mut Pin<P>) -> Pin<&mut P::Target> { @@ -247,7 +247,7 @@ impl<'a, T: ?Sized> Pin<&'a T> { Pin::new_unchecked(new_pointer) } - /// Get a shared reference out of a pin. + /// Gets a shared reference out of a pin. /// /// Note: `Pin` also implements `Deref` to the target, which can be used /// to access the inner value. However, `Deref` only provides a reference @@ -262,14 +262,14 @@ impl<'a, T: ?Sized> Pin<&'a T> { } impl<'a, T: ?Sized> Pin<&'a mut T> { - /// Convert this `Pin<&mut T>` into a `Pin<&T>` with the same lifetime. + /// Converts this `Pin<&mut T>` into a `Pin<&T>` with the same lifetime. #[stable(feature = "pin", since = "1.33.0")] #[inline(always)] pub fn into_ref(self: Pin<&'a mut T>) -> Pin<&'a T> { Pin { pointer: self.pointer } } - /// Get a mutable reference to the data inside of this `Pin`. + /// Gets a mutable reference to the data inside of this `Pin`. /// /// This requires that the data inside this `Pin` is `Unpin`. /// @@ -286,7 +286,7 @@ impl<'a, T: ?Sized> Pin<&'a mut T> { self.pointer } - /// Get a mutable reference to the data inside of this `Pin`. + /// Gets a mutable reference to the data inside of this `Pin`. /// /// # Safety /// diff --git a/src/libcore/ptr.rs b/src/libcore/ptr.rs index 20960845718..866c8d0896b 100644 --- a/src/libcore/ptr.rs +++ b/src/libcore/ptr.rs @@ -825,7 +825,7 @@ pub unsafe fn write_unaligned<T>(dst: *mut T, src: T) { /// /// The compiler shouldn't change the relative order or number of volatile /// memory operations. However, volatile memory operations on zero-sized types -/// (e.g., if a zero-sized type is passed to `read_volatile`) are no-ops +/// (e.g., if a zero-sized type is passed to `read_volatile`) are noops /// and may be ignored. /// /// [c11]: http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1570.pdf @@ -903,7 +903,7 @@ pub unsafe fn read_volatile<T>(src: *const T) -> T { /// /// The compiler shouldn't change the relative order or number of volatile /// memory operations. However, volatile memory operations on zero-sized types -/// (e.g., if a zero-sized type is passed to `write_volatile`) are no-ops +/// (e.g., if a zero-sized type is passed to `write_volatile`) are noops /// and may be ignored. /// /// [c11]: http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1570.pdf @@ -2473,7 +2473,7 @@ impl<T: ?Sized> PartialEq for *mut T { #[stable(feature = "rust1", since = "1.0.0")] impl<T: ?Sized> Eq for *mut T {} -/// Compare raw pointers for equality. +/// Compares raw pointers for equality. /// /// This is the same as using the `==` operator, but less generic: /// the arguments have to be `*const T` raw pointers, diff --git a/src/libcore/result.rs b/src/libcore/result.rs index 1ebf0714e23..92d29f6ee8a 100644 --- a/src/libcore/result.rs +++ b/src/libcore/result.rs @@ -896,7 +896,7 @@ impl<T: Default, E> Result<T, E> { /// /// # Examples /// - /// Convert a string to an integer, turning poorly-formed strings + /// Converts a string to an integer, turning poorly-formed strings /// into 0 (the default value for integers). [`parse`] converts /// a string to any other type that implements [`FromStr`], returning an /// [`Err`] on error. diff --git a/src/libcore/slice/memchr.rs b/src/libcore/slice/memchr.rs index 312838a170c..cbba546b8da 100644 --- a/src/libcore/slice/memchr.rs +++ b/src/libcore/slice/memchr.rs @@ -11,7 +11,7 @@ const HI_U64: u64 = 0x8080808080808080; const LO_USIZE: usize = LO_U64 as usize; const HI_USIZE: usize = HI_U64 as usize; -/// Returns whether `x` contains any zero byte. +/// Returns `true` if `x` contains any zero byte. /// /// From *Matters Computational*, J. Arndt: /// diff --git a/src/libcore/slice/mod.rs b/src/libcore/slice/mod.rs index e2129c68e7f..acca9748372 100644 --- a/src/libcore/slice/mod.rs +++ b/src/libcore/slice/mod.rs @@ -4123,7 +4123,7 @@ pub struct ChunksExact<'a, T:'a> { } impl<'a, T> ChunksExact<'a, T> { - /// Return the remainder of the original slice that is not going to be + /// Returns the remainder of the original slice that is not going to be /// returned by the iterator. The returned slice has at most `chunk_size-1` /// elements. #[stable(feature = "chunks_exact", since = "1.31.0")] @@ -4247,7 +4247,7 @@ pub struct ChunksExactMut<'a, T:'a> { } impl<'a, T> ChunksExactMut<'a, T> { - /// Return the remainder of the original slice that is not going to be + /// Returns the remainder of the original slice that is not going to be /// returned by the iterator. The returned slice has at most `chunk_size-1` /// elements. #[stable(feature = "chunks_exact", since = "1.31.0")] @@ -4619,7 +4619,7 @@ pub struct RChunksExact<'a, T:'a> { } impl<'a, T> RChunksExact<'a, T> { - /// Return the remainder of the original slice that is not going to be + /// Returns the remainder of the original slice that is not going to be /// returned by the iterator. The returned slice has at most `chunk_size-1` /// elements. #[stable(feature = "rchunks", since = "1.31.0")] @@ -4744,7 +4744,7 @@ pub struct RChunksExactMut<'a, T:'a> { } impl<'a, T> RChunksExactMut<'a, T> { - /// Return the remainder of the original slice that is not going to be + /// Returns the remainder of the original slice that is not going to be /// returned by the iterator. The returned slice has at most `chunk_size-1` /// elements. #[stable(feature = "rchunks", since = "1.31.0")] diff --git a/src/libcore/str/mod.rs b/src/libcore/str/mod.rs index c43db916888..6c08e545c5c 100644 --- a/src/libcore/str/mod.rs +++ b/src/libcore/str/mod.rs @@ -226,7 +226,7 @@ impl Utf8Error { #[stable(feature = "utf8_error", since = "1.5.0")] pub fn valid_up_to(&self) -> usize { self.valid_up_to } - /// Provide more information about the failure: + /// Provides more information about the failure: /// /// * `None`: the end of the input was reached unexpectedly. /// `self.valid_up_to()` is 1 to 3 bytes from the end of the input. @@ -3504,7 +3504,7 @@ impl str { /// /// A string is a sequence of bytes. `start` in this context means the first /// position of that byte string; for a left-to-right language like English or - /// Russian, this will be left side; and for right-to-left languages like + /// Russian, this will be left side, and for right-to-left languages like /// like Arabic or Hebrew, this will be the right side. /// /// # Examples @@ -3541,7 +3541,7 @@ impl str { /// /// A string is a sequence of bytes. `end` in this context means the last /// position of that byte string; for a left-to-right language like English or - /// Russian, this will be right side; and for right-to-left languages like + /// Russian, this will be right side, and for right-to-left languages like /// like Arabic or Hebrew, this will be the left side. /// /// # Examples @@ -3787,7 +3787,7 @@ impl str { /// /// A string is a sequence of bytes. `start` in this context means the first /// position of that byte string; for a left-to-right language like English or - /// Russian, this will be left side; and for right-to-left languages like + /// Russian, this will be left side, and for right-to-left languages like /// like Arabic or Hebrew, this will be the right side. /// /// # Examples @@ -3819,7 +3819,7 @@ impl str { /// /// A string is a sequence of bytes. `end` in this context means the last /// position of that byte string; for a left-to-right language like English or - /// Russian, this will be right side; and for right-to-left languages like + /// Russian, this will be right side, and for right-to-left languages like /// like Arabic or Hebrew, this will be the left side. /// /// # Examples diff --git a/src/libcore/str/pattern.rs b/src/libcore/str/pattern.rs index e5a75cdbbcc..2571780ad0b 100644 --- a/src/libcore/str/pattern.rs +++ b/src/libcore/str/pattern.rs @@ -117,7 +117,7 @@ pub unsafe trait Searcher<'a> { /// `[Reject(0, 1), Reject(1, 2), Match(2, 5), Reject(5, 8)]` fn next(&mut self) -> SearchStep; - /// Find the next `Match` result. See `next()` + /// Finds the next `Match` result. See `next()` /// /// Unlike next(), there is no guarantee that the returned ranges /// of this and next_reject will overlap. This will return (start_match, end_match), @@ -134,7 +134,7 @@ pub unsafe trait Searcher<'a> { } } - /// Find the next `Reject` result. See `next()` and `next_match()` + /// Finds the next `Reject` result. See `next()` and `next_match()` /// /// Unlike next(), there is no guarantee that the returned ranges /// of this and next_match will overlap. @@ -185,7 +185,7 @@ pub unsafe trait ReverseSearcher<'a>: Searcher<'a> { /// `[Reject(7, 8), Match(4, 7), Reject(1, 4), Reject(0, 1)]` fn next_back(&mut self) -> SearchStep; - /// Find the next `Match` result. See `next_back()` + /// Finds the next `Match` result. See `next_back()` #[inline] fn next_match_back(&mut self) -> Option<(usize, usize)>{ loop { @@ -197,7 +197,7 @@ pub unsafe trait ReverseSearcher<'a>: Searcher<'a> { } } - /// Find the next `Reject` result. See `next_back()` + /// Finds the next `Reject` result. See `next_back()` #[inline] fn next_reject_back(&mut self) -> Option<(usize, usize)>{ loop { diff --git a/src/libcore/task/poll.rs b/src/libcore/task/poll.rs index ac656153519..c811f96ace3 100644 --- a/src/libcore/task/poll.rs +++ b/src/libcore/task/poll.rs @@ -22,7 +22,7 @@ pub enum Poll<T> { } impl<T> Poll<T> { - /// Change the ready value of this `Poll` with the closure provided + /// Changes the ready value of this `Poll` with the closure provided. pub fn map<U, F>(self, f: F) -> Poll<U> where F: FnOnce(T) -> U { @@ -32,7 +32,7 @@ impl<T> Poll<T> { } } - /// Returns whether this is `Poll::Ready` + /// Returns `true` if this is `Poll::Ready` #[inline] pub fn is_ready(&self) -> bool { match *self { @@ -41,7 +41,7 @@ impl<T> Poll<T> { } } - /// Returns whether this is `Poll::Pending` + /// Returns `true` if this is `Poll::Pending` #[inline] pub fn is_pending(&self) -> bool { !self.is_ready() @@ -49,7 +49,7 @@ impl<T> Poll<T> { } impl<T, E> Poll<Result<T, E>> { - /// Change the success value of this `Poll` with the closure provided + /// Changes the success value of this `Poll` with the closure provided. pub fn map_ok<U, F>(self, f: F) -> Poll<Result<U, E>> where F: FnOnce(T) -> U { @@ -60,7 +60,7 @@ impl<T, E> Poll<Result<T, E>> { } } - /// Change the error value of this `Poll` with the closure provided + /// Changes the error value of this `Poll` with the closure provided. pub fn map_err<U, F>(self, f: F) -> Poll<Result<T, U>> where F: FnOnce(E) -> U { diff --git a/src/libcore/task/wake.rs b/src/libcore/task/wake.rs index 3f7098f1ef9..6d54989706c 100644 --- a/src/libcore/task/wake.rs +++ b/src/libcore/task/wake.rs @@ -41,11 +41,11 @@ impl Waker { unsafe { self.inner.as_ref().wake() } } - /// Returns whether or not this `Waker` and `other` awaken the same task. + /// Returns `true` if or not this `Waker` and `other` awaken the same task. /// /// This function works on a best-effort basis, and may return false even /// when the `Waker`s would awaken the same task. However, if this function - /// returns true, it is guaranteed that the `Waker`s will awaken the same + /// returns `true`, it is guaranteed that the `Waker`s will awaken the same /// task. /// /// This function is primarily used for optimization purposes. @@ -54,7 +54,7 @@ impl Waker { self.inner == other.inner } - /// Returns whether or not this `Waker` and `other` `LocalWaker` awaken + /// Returns `true` if or not this `Waker` and `other` `LocalWaker` awaken /// the same task. /// /// This function works on a best-effort basis, and may return false even @@ -150,7 +150,7 @@ impl LocalWaker { unsafe { self.0.inner.as_ref().wake_local() } } - /// Returns whether or not this `LocalWaker` and `other` `LocalWaker` awaken the same task. + /// Returns `true` if or not this `LocalWaker` and `other` `LocalWaker` awaken the same task. /// /// This function works on a best-effort basis, and may return false even /// when the `LocalWaker`s would awaken the same task. However, if this function @@ -163,7 +163,7 @@ impl LocalWaker { self.0.will_wake(&other.0) } - /// Returns whether or not this `LocalWaker` and `other` `Waker` awaken the same task. + /// Returns `true` if or not this `LocalWaker` and `other` `Waker` awaken the same task. /// /// This function works on a best-effort basis, and may return false even /// when the `Waker`s would awaken the same task. However, if this function @@ -223,14 +223,14 @@ pub unsafe trait UnsafeWake: Send + Sync { /// Drops this instance of `UnsafeWake`, deallocating resources /// associated with it. /// - /// FIXME(cramertj) + // FIXME(cramertj): /// This method is intended to have a signature such as: /// /// ```ignore (not-a-doctest) /// fn drop_raw(self: *mut Self); /// ``` /// - /// Unfortunately in Rust today that signature is not object safe. + /// Unfortunately, in Rust today that signature is not object safe. /// Nevertheless it's recommended to implement this function *as if* that /// were its signature. As such it is not safe to call on an invalid /// pointer, nor is the validity of the pointer guaranteed after this diff --git a/src/libcore/tests/iter.rs b/src/libcore/tests/iter.rs index 9b4c78f8d3b..51a6017de1b 100644 --- a/src/libcore/tests/iter.rs +++ b/src/libcore/tests/iter.rs @@ -881,7 +881,7 @@ fn test_iterator_flat_map() { assert_eq!(i, ys.len()); } -/// Test `FlatMap::fold` with items already picked off the front and back, +/// Tests `FlatMap::fold` with items already picked off the front and back, /// to make sure all parts of the `FlatMap` are folded correctly. #[test] fn test_iterator_flat_map_fold() { @@ -919,7 +919,7 @@ fn test_iterator_flatten() { assert_eq!(i, ys.len()); } -/// Test `Flatten::fold` with items already picked off the front and back, +/// Tests `Flatten::fold` with items already picked off the front and back, /// to make sure all parts of the `Flatten` are folded correctly. #[test] fn test_iterator_flatten_fold() { diff --git a/src/libcore/time.rs b/src/libcore/time.rs index ee583c829dd..ac7e11754aa 100644 --- a/src/libcore/time.rs +++ b/src/libcore/time.rs @@ -515,7 +515,7 @@ impl Duration { } } - /// Multiply `Duration` by `f64`. + /// Multiplies `Duration` by `f64`. /// /// # Panics /// This method will panic if result is not finite, negative or overflows `Duration`. |
