"Basic usage" is redundant for there is just one example

This commit is contained in:
Tshepang Mbambo 2023-02-16 19:49:31 +02:00
parent af3c8b2726
commit 6da64379ab

View File

@ -525,8 +525,6 @@ impl<T, E> Result<T, E> {
/// ///
/// # Examples /// # Examples
/// ///
/// Basic usage:
///
/// ``` /// ```
/// let x: Result<i32, &str> = Ok(-3); /// let x: Result<i32, &str> = Ok(-3);
/// assert_eq!(x.is_ok(), true); /// assert_eq!(x.is_ok(), true);
@ -572,8 +570,6 @@ pub fn is_ok_and(self, f: impl FnOnce(T) -> bool) -> bool {
/// ///
/// # Examples /// # Examples
/// ///
/// Basic usage:
///
/// ``` /// ```
/// let x: Result<i32, &str> = Ok(-3); /// let x: Result<i32, &str> = Ok(-3);
/// assert_eq!(x.is_err(), false); /// assert_eq!(x.is_err(), false);
@ -627,8 +623,6 @@ pub fn is_err_and(self, f: impl FnOnce(E) -> bool) -> bool {
/// ///
/// # Examples /// # Examples
/// ///
/// Basic usage:
///
/// ``` /// ```
/// let x: Result<u32, &str> = Ok(2); /// let x: Result<u32, &str> = Ok(2);
/// assert_eq!(x.ok(), Some(2)); /// assert_eq!(x.ok(), Some(2));
@ -658,8 +652,6 @@ pub const fn ok(self) -> Option<T>
/// ///
/// # Examples /// # Examples
/// ///
/// Basic usage:
///
/// ``` /// ```
/// let x: Result<u32, &str> = Ok(2); /// let x: Result<u32, &str> = Ok(2);
/// assert_eq!(x.err(), None); /// assert_eq!(x.err(), None);
@ -693,8 +685,6 @@ pub const fn err(self) -> Option<E>
/// ///
/// # Examples /// # Examples
/// ///
/// Basic usage:
///
/// ``` /// ```
/// let x: Result<u32, &str> = Ok(2); /// let x: Result<u32, &str> = Ok(2);
/// assert_eq!(x.as_ref(), Ok(&2)); /// assert_eq!(x.as_ref(), Ok(&2));
@ -716,8 +706,6 @@ pub const fn as_ref(&self) -> Result<&T, &E> {
/// ///
/// # Examples /// # Examples
/// ///
/// Basic usage:
///
/// ``` /// ```
/// fn mutate(r: &mut Result<i32, i32>) { /// fn mutate(r: &mut Result<i32, i32>) {
/// match r.as_mut() { /// match r.as_mut() {
@ -812,8 +800,6 @@ pub fn map_or<U, F: FnOnce(T) -> U>(self, default: U, f: F) -> U {
/// ///
/// # Examples /// # Examples
/// ///
/// Basic usage:
///
/// ``` /// ```
/// let k = 21; /// let k = 21;
/// ///
@ -841,8 +827,6 @@ pub fn map_or_else<U, D: FnOnce(E) -> U, F: FnOnce(T) -> U>(self, default: D, f:
/// ///
/// # Examples /// # Examples
/// ///
/// Basic usage:
///
/// ``` /// ```
/// fn stringify(x: u32) -> String { format!("error code: {x}") } /// fn stringify(x: u32) -> String { format!("error code: {x}") }
/// ///
@ -968,8 +952,6 @@ pub fn as_deref_mut(&mut self) -> Result<&mut T::Target, &mut E>
/// ///
/// # Examples /// # Examples
/// ///
/// Basic usage:
///
/// ``` /// ```
/// let x: Result<u32, &str> = Ok(7); /// let x: Result<u32, &str> = Ok(7);
/// assert_eq!(x.iter().next(), Some(&7)); /// assert_eq!(x.iter().next(), Some(&7));
@ -989,8 +971,6 @@ pub fn iter(&self) -> Iter<'_, T> {
/// ///
/// # Examples /// # Examples
/// ///
/// Basic usage:
///
/// ``` /// ```
/// let mut x: Result<u32, &str> = Ok(7); /// let mut x: Result<u32, &str> = Ok(7);
/// match x.iter_mut().next() { /// match x.iter_mut().next() {
@ -1031,8 +1011,6 @@ pub fn iter_mut(&mut self) -> IterMut<'_, T> {
/// ///
/// # Examples /// # Examples
/// ///
/// Basic usage:
///
/// ```should_panic /// ```should_panic
/// let x: Result<u32, &str> = Err("emergency failure"); /// let x: Result<u32, &str> = Err("emergency failure");
/// x.expect("Testing expect"); // panics with `Testing expect: emergency failure` /// x.expect("Testing expect"); // panics with `Testing expect: emergency failure`
@ -1160,8 +1138,6 @@ pub fn unwrap_or_default(self) -> T
/// ///
/// # Examples /// # Examples
/// ///
/// Basic usage:
///
/// ```should_panic /// ```should_panic
/// let x: Result<u32, &str> = Ok(10); /// let x: Result<u32, &str> = Ok(10);
/// x.expect_err("Testing expect_err"); // panics with `Testing expect_err: 10` /// x.expect_err("Testing expect_err"); // panics with `Testing expect_err: 10`
@ -1222,8 +1198,6 @@ pub fn unwrap_err(self) -> E
/// ///
/// # Examples /// # Examples
/// ///
/// Basic usage:
///
/// ``` /// ```
/// # #![feature(never_type)] /// # #![feature(never_type)]
/// # #![feature(unwrap_infallible)] /// # #![feature(unwrap_infallible)]
@ -1259,8 +1233,6 @@ pub fn into_ok(self) -> T
/// ///
/// # Examples /// # Examples
/// ///
/// Basic usage:
///
/// ``` /// ```
/// # #![feature(never_type)] /// # #![feature(never_type)]
/// # #![feature(unwrap_infallible)] /// # #![feature(unwrap_infallible)]
@ -1298,8 +1270,6 @@ pub fn into_err(self) -> E
/// ///
/// # Examples /// # Examples
/// ///
/// Basic usage:
///
/// ``` /// ```
/// let x: Result<u32, &str> = Ok(2); /// let x: Result<u32, &str> = Ok(2);
/// let y: Result<&str, &str> = Err("late error"); /// let y: Result<&str, &str> = Err("late error");
@ -1383,8 +1353,6 @@ pub fn and_then<U, F: FnOnce(T) -> Result<U, E>>(self, op: F) -> Result<U, E> {
/// ///
/// # Examples /// # Examples
/// ///
/// Basic usage:
///
/// ``` /// ```
/// let x: Result<u32, &str> = Ok(2); /// let x: Result<u32, &str> = Ok(2);
/// let y: Result<u32, &str> = Err("late error"); /// let y: Result<u32, &str> = Err("late error");
@ -1426,8 +1394,6 @@ pub const fn or<F>(self, res: Result<T, F>) -> Result<T, F>
/// ///
/// # Examples /// # Examples
/// ///
/// Basic usage:
///
/// ``` /// ```
/// fn sq(x: u32) -> Result<u32, u32> { Ok(x * x) } /// fn sq(x: u32) -> Result<u32, u32> { Ok(x * x) }
/// fn err(x: u32) -> Result<u32, u32> { Err(x) } /// fn err(x: u32) -> Result<u32, u32> { Err(x) }
@ -1456,8 +1422,6 @@ pub fn or_else<F, O: FnOnce(E) -> Result<T, F>>(self, op: O) -> Result<T, F> {
/// ///
/// # Examples /// # Examples
/// ///
/// Basic usage:
///
/// ``` /// ```
/// let default = 2; /// let default = 2;
/// let x: Result<u32, &str> = Ok(9); /// let x: Result<u32, &str> = Ok(9);
@ -1487,8 +1451,6 @@ pub const fn unwrap_or(self, default: T) -> T
/// ///
/// # Examples /// # Examples
/// ///
/// Basic usage:
///
/// ``` /// ```
/// fn count(x: &str) -> usize { x.len() } /// fn count(x: &str) -> usize { x.len() }
/// ///
@ -1752,8 +1714,6 @@ impl<T, E> Result<Result<T, E>, E> {
/// ///
/// # Examples /// # Examples
/// ///
/// Basic usage:
///
/// ``` /// ```
/// #![feature(result_flattening)] /// #![feature(result_flattening)]
/// let x: Result<Result<&'static str, u32>, u32> = Ok(Ok("hello")); /// let x: Result<Result<&'static str, u32>, u32> = Ok(Ok("hello"));
@ -1842,8 +1802,6 @@ impl<T, E> IntoIterator for Result<T, E> {
/// ///
/// # Examples /// # Examples
/// ///
/// Basic usage:
///
/// ``` /// ```
/// let x: Result<u32, &str> = Ok(5); /// let x: Result<u32, &str> = Ok(5);
/// let v: Vec<u32> = x.into_iter().collect(); /// let v: Vec<u32> = x.into_iter().collect();