Add some missing commas and missing titles/formatting

This commit is contained in:
Guillaume Gomez 2016-04-09 02:00:12 +02:00
parent b12b4e4e32
commit ca966b68e6

View File

@ -19,7 +19,7 @@
//! # #[allow(dead_code)]
//! enum Result<T, E> {
//! Ok(T),
//! Err(E)
//! Err(E),
//! }
//! ```
//!
@ -39,7 +39,7 @@
//! None => Err("invalid header length"),
//! Some(&1) => Ok(Version::Version1),
//! Some(&2) => Ok(Version::Version2),
//! Some(_) => Err("invalid version")
//! Some(_) => Err("invalid version"),
//! }
//! }
//!
@ -254,7 +254,7 @@ pub enum Result<T, E> {
/// Contains the error value
#[stable(feature = "rust1", since = "1.0.0")]
Err(#[stable(feature = "rust1", since = "1.0.0")] E)
Err(#[stable(feature = "rust1", since = "1.0.0")] E),
}
/////////////////////////////////////////////////////////////////////////////
@ -270,6 +270,8 @@ impl<T, E> Result<T, E> {
///
/// # Examples
///
/// Basic usage:
///
/// ```
/// let x: Result<i32, &str> = Ok(-3);
/// assert_eq!(x.is_ok(), true);
@ -290,6 +292,8 @@ impl<T, E> Result<T, E> {
///
/// # Examples
///
/// Basic usage:
///
/// ```
/// let x: Result<i32, &str> = Ok(-3);
/// assert_eq!(x.is_err(), false);
@ -314,6 +318,8 @@ impl<T, E> Result<T, E> {
///
/// # Examples
///
/// Basic usage:
///
/// ```
/// let x: Result<u32, &str> = Ok(2);
/// assert_eq!(x.ok(), Some(2));
@ -337,6 +343,8 @@ impl<T, E> Result<T, E> {
///
/// # Examples
///
/// Basic usage:
///
/// ```
/// let x: Result<u32, &str> = Ok(2);
/// assert_eq!(x.err(), None);
@ -362,6 +370,10 @@ impl<T, E> Result<T, E> {
/// Produces a new `Result`, containing a reference
/// into the original, leaving the original in place.
///
/// # Examples
///
/// Basic usage:
///
/// ```
/// let x: Result<u32, &str> = Ok(2);
/// assert_eq!(x.as_ref(), Ok(&2));
@ -380,6 +392,10 @@ impl<T, E> Result<T, E> {
/// Converts from `Result<T, E>` to `Result<&mut T, &mut E>`
///
/// # Examples
///
/// Basic usage:
///
/// ```
/// fn mutate(r: &mut Result<i32, i32>) {
/// match r.as_mut() {
@ -445,6 +461,8 @@ impl<T, E> Result<T, E> {
///
/// # Examples
///
/// Basic usage:
///
/// ```
/// fn stringify(x: u32) -> String { format!("error code: {}", x) }
///
@ -471,6 +489,8 @@ impl<T, E> Result<T, E> {
///
/// # Examples
///
/// Basic usage:
///
/// ```
/// let x: Result<u32, &str> = Ok(7);
/// assert_eq!(x.iter().next(), Some(&7));
@ -488,6 +508,8 @@ impl<T, E> Result<T, E> {
///
/// # Examples
///
/// Basic usage:
///
/// ```
/// let mut x: Result<u32, &str> = Ok(7);
/// match x.iter_mut().next() {
@ -513,6 +535,8 @@ impl<T, E> Result<T, E> {
///
/// # Examples
///
/// Basic usage:
///
/// ```
/// let x: Result<u32, &str> = Ok(2);
/// let y: Result<&str, &str> = Err("late error");
@ -545,6 +569,8 @@ impl<T, E> Result<T, E> {
///
/// # Examples
///
/// Basic usage:
///
/// ```
/// fn sq(x: u32) -> Result<u32, u32> { Ok(x * x) }
/// fn err(x: u32) -> Result<u32, u32> { Err(x) }
@ -567,6 +593,8 @@ impl<T, E> Result<T, E> {
///
/// # Examples
///
/// Basic usage:
///
/// ```
/// let x: Result<u32, &str> = Ok(2);
/// let y: Result<u32, &str> = Err("late error");
@ -599,6 +627,8 @@ impl<T, E> Result<T, E> {
///
/// # Examples
///
/// Basic usage:
///
/// ```
/// fn sq(x: u32) -> Result<u32, u32> { Ok(x * x) }
/// fn err(x: u32) -> Result<u32, u32> { Err(x) }
@ -622,6 +652,8 @@ impl<T, E> Result<T, E> {
///
/// # Examples
///
/// Basic usage:
///
/// ```
/// let optb = 2;
/// let x: Result<u32, &str> = Ok(9);
@ -644,6 +676,8 @@ impl<T, E> Result<T, E> {
///
/// # Examples
///
/// Basic usage:
///
/// ```
/// fn count(x: &str) -> usize { x.len() }
///
@ -670,6 +704,8 @@ impl<T, E: fmt::Debug> Result<T, E> {
///
/// # Examples
///
/// Basic usage:
///
/// ```
/// let x: Result<u32, &str> = Ok(2);
/// assert_eq!(x.unwrap(), 2);
@ -696,6 +732,9 @@ impl<T, E: fmt::Debug> Result<T, E> {
/// passed message, and the content of the `Err`.
///
/// # Examples
///
/// Basic usage:
///
/// ```{.should_panic}
/// let x: Result<u32, &str> = Err("emergency failure");
/// x.expect("Testing expect"); // panics with `Testing expect: emergency failure`
@ -759,6 +798,8 @@ impl<T, E> IntoIterator for Result<T, E> {
///
/// # Examples
///
/// Basic usage:
///
/// ```
/// let x: Result<u32, &str> = Ok(5);
/// let v: Vec<u32> = x.into_iter().collect();