Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
2d6ab12
Liballoc extend use intra doc link
pickfire Aug 28, 2020
7be129e
Add missing hyphen
camelid Aug 28, 2020
c7e428e
Liballoc vec doc use associated function
pickfire Aug 29, 2020
7ee5155
GH-66816: Removes disable before return
aszenz Aug 29, 2020
eb2bb99
GH-66816: Process before enabling search
aszenz Aug 29, 2020
d504d55
Keep doc standard for Vec DrainFilter
pickfire Aug 29, 2020
d727442
Remove brackets in drain filter docs
pickfire Aug 29, 2020
12b4cf8
Use assertions on Vec doc
pickfire Aug 29, 2020
237c500
Use explicit intra-doc link in path for Vec resize
pickfire Aug 29, 2020
be8b5eb
Reuse description from drain_filter
pickfire Aug 29, 2020
2d1ab83
Remove empty vec assertion flow distrupt
pickfire Aug 29, 2020
8a92718
Switch to intra-doc links in core/src/{convert,iter}/mod.rs
nixphix Aug 27, 2020
01d95f2
resolve comments
nixphix Aug 27, 2020
7ea4c28
add i32::MAX link
nixphix Aug 30, 2020
523fea4
revert Some(Item) link
nixphix Aug 30, 2020
0175c43
Update README.md
mark-i-m Aug 30, 2020
00d459a
Update MinGW instructions to include ninja
CDirkx Aug 30, 2020
c8bc4f2
Rollup merge of #75969 - nixphix:docs/mod, r=jyn514
matklad Aug 31, 2020
df594e2
Rollup merge of #76023 - pickfire:patch-4, r=jyn514
matklad Aug 31, 2020
275d0c5
Rollup merge of #76033 - camelid:patch-7, r=Dylan-DPC
matklad Aug 31, 2020
1403170
Rollup merge of #76052 - aszenz:GH-66816_removes_disable_attribute_be…
matklad Aug 31, 2020
9d3208a
Rollup merge of #76055 - pickfire:patch-9, r=jyn514
matklad Aug 31, 2020
c4e4e29
Rollup merge of #76058 - pickfire:patch-11, r=jyn514
matklad Aug 31, 2020
7e13583
Rollup merge of #76069 - pickfire:patch-16, r=jyn514
matklad Aug 31, 2020
3600965
Rollup merge of #76117 - mark-i-m:patch-1, r=petrochenkov
matklad Aug 31, 2020
a7b086e
Rollup merge of #76134 - CDirkx:patch-1, r=nagisa
matklad Aug 31, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Switch to intra-doc links in core/src/{convert,iter}/mod.rs
  • Loading branch information
nixphix committed Aug 30, 2020
commit 8a92718b64307236514a16c5f69cd5c02d40dd6b
58 changes: 17 additions & 41 deletions library/core/src/convert/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,6 @@
//! `into` themselves and `from` themselves
//!
//! See each trait for usage examples.
//!
//! [`Into`]: trait.Into.html
//! [`From`]: trait.From.html
//! [`TryFrom`]: trait.TryFrom.html
//! [`TryInto`]: trait.TryInto.html
//! [`AsRef`]: trait.AsRef.html
//! [`AsMut`]: trait.AsMut.html

#![stable(feature = "rust1", since = "1.0.0")]

Expand Down Expand Up @@ -141,13 +134,11 @@ pub const fn identity<T>(x: T) -> T {
/// want to accept all references that can be converted to [`&str`] as an argument.
/// Since both [`String`] and [`&str`] implement `AsRef<str>` we can accept both as input argument.
///
/// [`Option<T>`]: ../../std/option/enum.Option.html
/// [`Result<T, E>`]: ../../std/result/enum.Result.html
/// [`Borrow`]: ../../std/borrow/trait.Borrow.html
/// [`Hash`]: ../../std/hash/trait.Hash.html
/// [`Eq`]: ../../std/cmp/trait.Eq.html
/// [`Ord`]: ../../std/cmp/trait.Ord.html
/// [`&str`]: ../../std/primitive.str.html
/// [`Option<T>`]: crate::option::Option
/// [`Result<T, E>`]: crate::result::Result
/// [`Borrow`]: crate::borrow::Borrow
/// [`Eq`]: crate::cmp::Eq
/// [`Ord`]: crate::cmp::Ord
/// [`String`]: ../../std/string/struct.String.html
///
/// ```
Expand Down Expand Up @@ -177,8 +168,8 @@ pub trait AsRef<T: ?Sized> {
/// **Note: This trait must not fail**. If the conversion can fail, use a
/// dedicated method which returns an [`Option<T>`] or a [`Result<T, E>`].
///
/// [`Option<T>`]: ../../std/option/enum.Option.html
/// [`Result<T, E>`]: ../../std/result/enum.Result.html
/// [`Option<T>`]: crate::option::Option
/// [`Result<T, E>`]: crate::result::Result
///
/// # Generic Implementations
///
Expand All @@ -204,7 +195,7 @@ pub trait AsRef<T: ?Sized> {
/// assert_eq!(*boxed_num, 1);
/// ```
///
/// [`Box<T>`]: ../../std/boxed/struct.Box.html
/// [`Box<T>`]: crate::boxed::Box<T>
#[stable(feature = "rust1", since = "1.0.0")]
pub trait AsMut<T: ?Sized> {
/// Performs the conversion.
Expand Down Expand Up @@ -278,13 +269,10 @@ pub trait AsMut<T: ?Sized> {
/// is_hello(s);
/// ```
///
/// [`TryInto`]: trait.TryInto.html
/// [`Option<T>`]: ../../std/option/enum.Option.html
/// [`Result<T, E>`]: ../../std/result/enum.Result.html
/// [`Option<T>`]: crate::option::Option
/// [`Result<T, E>`]: crate::result::Result
/// [`String`]: ../../std/string/struct.String.html
/// [`From`]: trait.From.html
/// [`Into`]: trait.Into.html
/// [`Vec`]: ../../std/vec/struct.Vec.html
/// [`Vec`]: crate::vec::Vec<T>
#[stable(feature = "rust1", since = "1.0.0")]
pub trait Into<T>: Sized {
/// Performs the conversion.
Expand Down Expand Up @@ -370,12 +358,9 @@ pub trait Into<T>: Sized {
/// }
/// ```
///
/// [`TryFrom`]: trait.TryFrom.html
/// [`Option<T>`]: ../../std/option/enum.Option.html
/// [`Result<T, E>`]: ../../std/result/enum.Result.html
/// [`Option<T>`]: crate::option::Option
/// [`Result<T, E>`]: crate::result::Result
/// [`String`]: ../../std/string/struct.String.html
/// [`Into`]: trait.Into.html
/// [`from`]: trait.From.html#tymethod.from
/// [book]: ../../book/ch09-00-error-handling.html
#[rustc_diagnostic_item = "from_trait"]
#[stable(feature = "rust1", since = "1.0.0")]
Expand Down Expand Up @@ -404,9 +389,6 @@ pub trait From<T>: Sized {
///
/// This suffers the same restrictions and reasoning as implementing
/// [`Into`], see there for details.
///
/// [`TryFrom`]: trait.TryFrom.html
/// [`Into`]: trait.Into.html
#[stable(feature = "try_from", since = "1.34.0")]
pub trait TryInto<T>: Sized {
/// The type returned in the event of a conversion error.
Expand Down Expand Up @@ -436,7 +418,7 @@ pub trait TryInto<T>: Sized {
/// # Generic Implementations
///
/// - `TryFrom<T> for U` implies [`TryInto`]`<U> for T`
/// - [`try_from`] is reflexive, which means that `TryFrom<T> for T`
/// - [`TryFrom::try_from`] is reflexive, which means that `TryFrom<T> for T`
/// is implemented and cannot fail -- the associated `Error` type for
/// calling `T::try_from()` on a value of type `T` is [`Infallible`].
/// When the [`!`] type is stabilized [`Infallible`] and [`!`] will be
Expand Down Expand Up @@ -485,11 +467,8 @@ pub trait TryInto<T>: Sized {
/// assert!(try_successful_smaller_number.is_ok());
/// ```
///
/// [`try_from`]: trait.TryFrom.html#tymethod.try_from
/// [`TryInto`]: trait.TryInto.html
/// [`i32::MAX`]: ../../std/i32/constant.MAX.html
/// [`i32::MAX`]: crate::i32::MAX
/// [`!`]: ../../std/primitive.never.html
/// [`Infallible`]: enum.Infallible.html
#[stable(feature = "try_from", since = "1.34.0")]
pub trait TryFrom<T>: Sized {
/// The type returned in the event of a conversion error.
Expand Down Expand Up @@ -676,7 +655,6 @@ impl AsRef<str> for str {
///
/// … and eventually deprecate `Infallible`.
///
///
/// However there is one case where `!` syntax can be used
/// before `!` is stabilized as a full-fledged type: in the position of a function’s return type.
/// Specifically, it is possible implementations for two different function pointer types:
Expand All @@ -692,10 +670,8 @@ impl AsRef<str> for str {
/// the two `impl`s will start to overlap
/// and therefore will be disallowed by the language’s trait coherence rules.
///
/// [`Ok`]: ../result/enum.Result.html#variant.Ok
/// [`Result`]: ../result/enum.Result.html
/// [`TryFrom`]: trait.TryFrom.html
/// [`Into`]: trait.Into.html
/// [`Ok`]: super::result::Result::Ok
/// [`Result`]: super::result::Result
/// [never]: ../../std/primitive.never.html
#[stable(feature = "convert_infallible", since = "1.34.0")]
#[derive(Copy)]
Expand Down
35 changes: 9 additions & 26 deletions library/core/src/iter/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,7 @@
//! more complex forms of processing. See the [Adapters](#adapters) section
//! below for more details.
//!
//! [`Some(Item)`]: Some
//! [`Iterator`]: trait.Iterator.html
//! [`next`]: trait.Iterator.html#tymethod.next
//! [`next`]: Iterator::next
//! [`TryIter`]: ../../std/sync/mpsc/struct.TryIter.html
//!
//! # The three forms of iteration
Expand Down Expand Up @@ -154,14 +152,11 @@
//! produce an iterator. What gives?
//!
//! There's a trait in the standard library for converting something into an
//! iterator: [`IntoIterator`]. This trait has one method, [`into_iter`],
//! iterator: [`IntoIterator`]. This trait has one method, [`IntoIterator::into_iter`],
//! which converts the thing implementing [`IntoIterator`] into an iterator.
//! Let's take a look at that `for` loop again, and what the compiler converts
//! it into:
//!
//! [`IntoIterator`]: trait.IntoIterator.html
//! [`into_iter`]: trait.IntoIterator.html#tymethod.into_iter
//!
//! ```
//! let values = vec![1, 2, 3, 4, 5];
//!
Expand Down Expand Up @@ -214,24 +209,20 @@
//! often called 'iterator adapters', as they're a form of the 'adapter
//! pattern'.
//!
//! Common iterator adapters include [`map`], [`take`], and [`filter`].
//! Common iterator adapters include [`Iterator::map`], [`Iterator::take`], and [`Iterator::filter`].
//! For more, see their documentation.
//!
//! If an iterator adapter panics, the iterator will be in an unspecified (but
//! memory safe) state. This state is also not guaranteed to stay the same
//! across versions of Rust, so you should avoid relying on the exact values
//! returned by an iterator which panicked.
//!
//! [`map`]: trait.Iterator.html#method.map
//! [`take`]: trait.Iterator.html#method.take
//! [`filter`]: trait.Iterator.html#method.filter
//!
//! # Laziness
//!
//! Iterators (and iterator [adapters](#adapters)) are *lazy*. This means that
//! just creating an iterator doesn't _do_ a whole lot. Nothing really happens
//! until you call [`next`]. This is sometimes a source of confusion when
//! creating an iterator solely for its side effects. For example, the [`map`]
//! creating an iterator solely for its side effects. For example, the [`Iterator::map`]
//! method calls a closure on each element it iterates over:
//!
//! ```
Expand All @@ -248,8 +239,8 @@
//! do nothing unless consumed
//! ```
//!
//! The idiomatic way to write a [`map`] for its side effects is to use a
//! `for` loop or call the [`for_each`] method:
//! The idiomatic way to write a [`Iterator::map`] for its side effects is to use a
//! `for` loop or call the [`Iterator::for_each`] method:
//!
//! ```
//! let v = vec![1, 2, 3, 4, 5];
Expand All @@ -261,14 +252,9 @@
//! }
//! ```
//!
//! [`map`]: trait.Iterator.html#method.map
//! [`for_each`]: trait.Iterator.html#method.for_each
//!
//! Another common way to evaluate an iterator is to use the [`collect`]
//! Another common way to evaluate an iterator is to use the [`Iterator::collect`]
//! method to produce a new collection.
//!
//! [`collect`]: trait.Iterator.html#method.collect
//!
//! # Infinity
//!
//! Iterators do not have to be finite. As an example, an open-ended range is
Expand All @@ -278,7 +264,7 @@
//! let numbers = 0..;
//! ```
//!
//! It is common to use the [`take`] iterator adapter to turn an infinite
//! It is common to use the [`Iterator::take`] iterator adapter to turn an infinite
//! iterator into a finite one:
//!
//! ```
Expand All @@ -294,7 +280,7 @@
//!
//! Bear in mind that methods on infinite iterators, even those for which a
//! result can be determined mathematically in finite time, may not terminate.
//! Specifically, methods such as [`min`], which in the general case require
//! Specifically, methods such as [`Iterator::min`], which in the general case require
//! traversing every element in the iterator, are likely not to return
//! successfully for any infinite iterators.
//!
Expand All @@ -304,9 +290,6 @@
//! // `ones.min()` causes an infinite loop, so we won't reach this point!
//! println!("The smallest number one is {}.", least);
//! ```
//!
//! [`take`]: trait.Iterator.html#method.take
//! [`min`]: trait.Iterator.html#method.min

#![stable(feature = "rust1", since = "1.0.0")]

Expand Down