4242
4343use crate :: fmt;
4444
45- /// An identity function.
45+ /// The identity function.
4646///
4747/// Two things are important to note about this function:
4848///
49- /// - It is not always equivalent to a closure like `|x| x` since the
49+ /// - It is not always equivalent to a closure like `|x| x`, since the
5050/// closure may coerce `x` into a different type.
5151///
5252/// - It moves the input `x` passed to the function.
@@ -56,31 +56,32 @@ use crate::fmt;
5656///
5757/// # Examples
5858///
59- /// Using `identity` to do nothing among other interesting functions:
59+ /// Using `identity` to do nothing in a sequence of other, interesting,
60+ /// functions:
6061///
6162/// ```rust
6263/// use std::convert::identity;
6364///
6465/// fn manipulation(x: u32) -> u32 {
65- /// // Let's assume that this function does something interesting.
66+ /// // Let's pretend that adding one is an interesting function .
6667/// x + 1
6768/// }
6869///
6970/// let _arr = &[identity, manipulation];
7071/// ```
7172///
72- /// Using `identity` to get a function that changes nothing in a conditional:
73+ /// Using `identity` as a "do nothing" base case in a conditional:
7374///
7475/// ```rust
7576/// use std::convert::identity;
7677///
7778/// # let condition = true;
78- ///
79+ /// #
7980/// # fn manipulation(x: u32) -> u32 { x + 1 }
80- ///
81+ /// #
8182/// let do_stuff = if condition { manipulation } else { identity };
8283///
83- /// // do more interesting stuff..
84+ /// // Do more interesting stuff. ..
8485///
8586/// let _results = do_stuff(42);
8687/// ```
0 commit comments