Skip to content

Commit ca966b6

Browse files
Add some missing commas and missing titles/formatting
1 parent b12b4e4 commit ca966b6

File tree

1 file changed

+44
-3
lines changed

1 file changed

+44
-3
lines changed

src/libcore/result.rs

+44-3
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
//! # #[allow(dead_code)]
2020
//! enum Result<T, E> {
2121
//! Ok(T),
22-
//! Err(E)
22+
//! Err(E),
2323
//! }
2424
//! ```
2525
//!
@@ -39,7 +39,7 @@
3939
//! None => Err("invalid header length"),
4040
//! Some(&1) => Ok(Version::Version1),
4141
//! Some(&2) => Ok(Version::Version2),
42-
//! Some(_) => Err("invalid version")
42+
//! Some(_) => Err("invalid version"),
4343
//! }
4444
//! }
4545
//!
@@ -254,7 +254,7 @@ pub enum Result<T, E> {
254254

255255
/// Contains the error value
256256
#[stable(feature = "rust1", since = "1.0.0")]
257-
Err(#[stable(feature = "rust1", since = "1.0.0")] E)
257+
Err(#[stable(feature = "rust1", since = "1.0.0")] E),
258258
}
259259

260260
/////////////////////////////////////////////////////////////////////////////
@@ -270,6 +270,8 @@ impl<T, E> Result<T, E> {
270270
///
271271
/// # Examples
272272
///
273+
/// Basic usage:
274+
///
273275
/// ```
274276
/// let x: Result<i32, &str> = Ok(-3);
275277
/// assert_eq!(x.is_ok(), true);
@@ -290,6 +292,8 @@ impl<T, E> Result<T, E> {
290292
///
291293
/// # Examples
292294
///
295+
/// Basic usage:
296+
///
293297
/// ```
294298
/// let x: Result<i32, &str> = Ok(-3);
295299
/// assert_eq!(x.is_err(), false);
@@ -314,6 +318,8 @@ impl<T, E> Result<T, E> {
314318
///
315319
/// # Examples
316320
///
321+
/// Basic usage:
322+
///
317323
/// ```
318324
/// let x: Result<u32, &str> = Ok(2);
319325
/// assert_eq!(x.ok(), Some(2));
@@ -337,6 +343,8 @@ impl<T, E> Result<T, E> {
337343
///
338344
/// # Examples
339345
///
346+
/// Basic usage:
347+
///
340348
/// ```
341349
/// let x: Result<u32, &str> = Ok(2);
342350
/// assert_eq!(x.err(), None);
@@ -362,6 +370,10 @@ impl<T, E> Result<T, E> {
362370
/// Produces a new `Result`, containing a reference
363371
/// into the original, leaving the original in place.
364372
///
373+
/// # Examples
374+
///
375+
/// Basic usage:
376+
///
365377
/// ```
366378
/// let x: Result<u32, &str> = Ok(2);
367379
/// assert_eq!(x.as_ref(), Ok(&2));
@@ -380,6 +392,10 @@ impl<T, E> Result<T, E> {
380392

381393
/// Converts from `Result<T, E>` to `Result<&mut T, &mut E>`
382394
///
395+
/// # Examples
396+
///
397+
/// Basic usage:
398+
///
383399
/// ```
384400
/// fn mutate(r: &mut Result<i32, i32>) {
385401
/// match r.as_mut() {
@@ -445,6 +461,8 @@ impl<T, E> Result<T, E> {
445461
///
446462
/// # Examples
447463
///
464+
/// Basic usage:
465+
///
448466
/// ```
449467
/// fn stringify(x: u32) -> String { format!("error code: {}", x) }
450468
///
@@ -471,6 +489,8 @@ impl<T, E> Result<T, E> {
471489
///
472490
/// # Examples
473491
///
492+
/// Basic usage:
493+
///
474494
/// ```
475495
/// let x: Result<u32, &str> = Ok(7);
476496
/// assert_eq!(x.iter().next(), Some(&7));
@@ -488,6 +508,8 @@ impl<T, E> Result<T, E> {
488508
///
489509
/// # Examples
490510
///
511+
/// Basic usage:
512+
///
491513
/// ```
492514
/// let mut x: Result<u32, &str> = Ok(7);
493515
/// match x.iter_mut().next() {
@@ -513,6 +535,8 @@ impl<T, E> Result<T, E> {
513535
///
514536
/// # Examples
515537
///
538+
/// Basic usage:
539+
///
516540
/// ```
517541
/// let x: Result<u32, &str> = Ok(2);
518542
/// let y: Result<&str, &str> = Err("late error");
@@ -545,6 +569,8 @@ impl<T, E> Result<T, E> {
545569
///
546570
/// # Examples
547571
///
572+
/// Basic usage:
573+
///
548574
/// ```
549575
/// fn sq(x: u32) -> Result<u32, u32> { Ok(x * x) }
550576
/// fn err(x: u32) -> Result<u32, u32> { Err(x) }
@@ -567,6 +593,8 @@ impl<T, E> Result<T, E> {
567593
///
568594
/// # Examples
569595
///
596+
/// Basic usage:
597+
///
570598
/// ```
571599
/// let x: Result<u32, &str> = Ok(2);
572600
/// let y: Result<u32, &str> = Err("late error");
@@ -599,6 +627,8 @@ impl<T, E> Result<T, E> {
599627
///
600628
/// # Examples
601629
///
630+
/// Basic usage:
631+
///
602632
/// ```
603633
/// fn sq(x: u32) -> Result<u32, u32> { Ok(x * x) }
604634
/// fn err(x: u32) -> Result<u32, u32> { Err(x) }
@@ -622,6 +652,8 @@ impl<T, E> Result<T, E> {
622652
///
623653
/// # Examples
624654
///
655+
/// Basic usage:
656+
///
625657
/// ```
626658
/// let optb = 2;
627659
/// let x: Result<u32, &str> = Ok(9);
@@ -644,6 +676,8 @@ impl<T, E> Result<T, E> {
644676
///
645677
/// # Examples
646678
///
679+
/// Basic usage:
680+
///
647681
/// ```
648682
/// fn count(x: &str) -> usize { x.len() }
649683
///
@@ -670,6 +704,8 @@ impl<T, E: fmt::Debug> Result<T, E> {
670704
///
671705
/// # Examples
672706
///
707+
/// Basic usage:
708+
///
673709
/// ```
674710
/// let x: Result<u32, &str> = Ok(2);
675711
/// assert_eq!(x.unwrap(), 2);
@@ -696,6 +732,9 @@ impl<T, E: fmt::Debug> Result<T, E> {
696732
/// passed message, and the content of the `Err`.
697733
///
698734
/// # Examples
735+
///
736+
/// Basic usage:
737+
///
699738
/// ```{.should_panic}
700739
/// let x: Result<u32, &str> = Err("emergency failure");
701740
/// x.expect("Testing expect"); // panics with `Testing expect: emergency failure`
@@ -759,6 +798,8 @@ impl<T, E> IntoIterator for Result<T, E> {
759798
///
760799
/// # Examples
761800
///
801+
/// Basic usage:
802+
///
762803
/// ```
763804
/// let x: Result<u32, &str> = Ok(5);
764805
/// let v: Vec<u32> = x.into_iter().collect();

0 commit comments

Comments
 (0)