Rollup merge of #23329 - jbcrail:rm-syntax-highlight, r=sanxiyn

As suggested by @steveklabnik in #23254, I removed the redundant Rust syntax highlighting from the documentation.
This commit is contained in:
Manish Goregaokar 2015-03-17 15:20:27 +05:30
commit 0b463b075e
51 changed files with 172 additions and 167 deletions

View file

@ -94,7 +94,7 @@ use heap::deallocate;
/// With simple pipes, without `Arc`, a copy would have to be made for each
/// task.
///
/// ```rust
/// ```
/// use std::sync::Arc;
/// use std::thread;
///

View file

@ -64,7 +64,7 @@ use core::raw::TraitObject;
///
/// The following two examples are equivalent:
///
/// ```rust
/// ```
/// #![feature(box_syntax)]
/// use std::boxed::HEAP;
///

View file

@ -133,7 +133,7 @@ static FALSE: bool = false;
///
/// # Examples
///
/// ```rust
/// ```
/// use std::collections::BitVec;
///
/// let mut bv = BitVec::from_elem(10, false);

View file

@ -129,7 +129,7 @@ impl<T> ToOwned for T where T: Clone {
///
/// # Examples
///
/// ```rust
/// ```
/// use std::borrow::Cow;
///
/// fn abs_all(input: &mut Cow<[i32]>) {

View file

@ -422,7 +422,7 @@ use string;
///
/// # Examples
///
/// ```rust
/// ```
/// use std::fmt;
///
/// let s = fmt::format(format_args!("Hello, {}!", "world"));

View file

@ -136,7 +136,7 @@ pub trait SliceExt {
///
/// # Examples
///
/// ```rust
/// ```
/// let mut v = [5, 4, 1, 3, 2];
/// v.sort_by(|a, b| a.cmp(b));
/// assert!(v == [1, 2, 3, 4, 5]);
@ -162,7 +162,7 @@ pub trait SliceExt {
///
/// # Examples
///
/// ```rust
/// ```
/// let mut a = [1, 2, 3, 4, 5];
/// let b = vec![6, 7, 8];
/// let num_moved = a.move_from(b, 0, 3);
@ -284,7 +284,7 @@ pub trait SliceExt {
/// Print the adjacent pairs of a slice (i.e. `[1,2]`, `[2,3]`,
/// `[3,4]`):
///
/// ```rust
/// ```
/// let v = &[1, 2, 3, 4];
/// for win in v.windows(2) {
/// println!("{:?}", win);
@ -307,7 +307,7 @@ pub trait SliceExt {
/// Print the slice two elements at a time (i.e. `[1,2]`,
/// `[3,4]`, `[5]`):
///
/// ```rust
/// ```
/// let v = &[1, 2, 3, 4, 5];
/// for win in v.chunks(2) {
/// println!("{:?}", win);
@ -398,7 +398,7 @@ pub trait SliceExt {
/// uniquely determined position; the second and third are not
/// found; the fourth could match any position in `[1,4]`.
///
/// ```rust
/// ```
/// let s = [0, 1, 1, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55];
/// let s = s.as_slice();
///
@ -533,7 +533,7 @@ pub trait SliceExt {
///
/// # Examples
///
/// ```rust
/// ```
/// let mut v = ["a", "b", "c", "d"];
/// v.swap(1, 3);
/// assert!(v == ["a", "d", "c", "b"]);
@ -553,7 +553,7 @@ pub trait SliceExt {
///
/// # Examples
///
/// ```rust
/// ```
/// let mut v = [1, 2, 3, 4, 5, 6];
///
/// // scoped to restrict the lifetime of the borrows
@ -582,7 +582,7 @@ pub trait SliceExt {
///
/// # Examples
///
/// ```rust
/// ```
/// let mut v = [1, 2, 3];
/// v.reverse();
/// assert!(v == [3, 2, 1]);
@ -614,7 +614,7 @@ pub trait SliceExt {
///
/// # Examples
///
/// ```rust
/// ```
/// let v = [1, 2, 3];
/// let mut perms = v.permutations();
///
@ -625,7 +625,7 @@ pub trait SliceExt {
///
/// Iterating through permutations one by one.
///
/// ```rust
/// ```
/// let v = [1, 2, 3];
/// let mut perms = v.permutations();
///
@ -642,7 +642,7 @@ pub trait SliceExt {
///
/// # Examples
///
/// ```rust
/// ```
/// let mut dst = [0, 0, 0];
/// let src = [1, 2];
///
@ -662,7 +662,7 @@ pub trait SliceExt {
///
/// # Examples
///
/// ```rust
/// ```
/// let mut v = [-5, 4, 1, -3, 2];
///
/// v.sort();
@ -684,7 +684,7 @@ pub trait SliceExt {
/// uniquely determined position; the second and third are not
/// found; the fourth could match any position in `[1,4]`.
///
/// ```rust
/// ```
/// let s = [0, 1, 1, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55];
/// let s = s.as_slice();
///
@ -711,7 +711,7 @@ pub trait SliceExt {
///
/// # Examples
///
/// ```rust
/// ```
/// let v: &mut [_] = &mut [0, 1, 2];
/// v.next_permutation();
/// let b: &mut [_] = &mut [0, 2, 1];
@ -731,7 +731,7 @@ pub trait SliceExt {
///
/// # Examples
///
/// ```rust
/// ```
/// let v: &mut [_] = &mut [1, 0, 2];
/// v.prev_permutation();
/// let b: &mut [_] = &mut [0, 2, 1];

View file

@ -911,7 +911,7 @@ pub trait StrExt: Index<RangeFull, Output = str> {
///
/// # Examples
///
/// ```rust
/// ```
/// assert!("banana".ends_with("nana"));
/// ```
#[stable(feature = "rust1", since = "1.0.0")]

View file

@ -138,7 +138,7 @@ impl String {
///
/// # Examples
///
/// ```rust
/// ```
/// use std::str::Utf8Error;
///
/// let hello_vec = vec![104, 101, 108, 108, 111];
@ -164,7 +164,7 @@ impl String {
///
/// # Examples
///
/// ```rust
/// ```
/// let input = b"Hello \xF0\x90\x80World";
/// let output = String::from_utf8_lossy(input);
/// assert_eq!(output, "Hello \u{FFFD}World");
@ -296,7 +296,7 @@ impl String {
///
/// # Examples
///
/// ```rust
/// ```
/// // 𝄞music
/// let mut v = &mut [0xD834, 0xDD1E, 0x006d, 0x0075,
/// 0x0073, 0x0069, 0x0063];
@ -324,7 +324,7 @@ impl String {
///
/// # Examples
///
/// ```rust
/// ```
/// // 𝄞mus<invalid>ic<invalid>
/// let v = &[0xD834, 0xDD1E, 0x006d, 0x0075,
/// 0x0073, 0xDD1E, 0x0069, 0x0063,

View file

@ -633,7 +633,7 @@ impl<T> Vec<T> {
///
/// # Examples
///
/// ```rust
/// ```
/// let mut vec = vec!(1, 2);
/// vec.push(3);
/// assert_eq!(vec, [1, 2, 3]);
@ -671,7 +671,7 @@ impl<T> Vec<T> {
///
/// # Examples
///
/// ```rust
/// ```
/// let mut vec = vec![1, 2, 3];
/// assert_eq!(vec.pop(), Some(3));
/// assert_eq!(vec, [1, 2]);

View file

@ -201,7 +201,7 @@ impl<T> VecDeque<T> {
///
/// # Examples
///
/// ```rust
/// ```
/// use std::collections::VecDeque;
///
/// let mut buf = VecDeque::new();
@ -224,7 +224,7 @@ impl<T> VecDeque<T> {
///
/// # Examples
///
/// ```rust
/// ```
/// use std::collections::VecDeque;
///
/// let mut buf = VecDeque::new();
@ -258,7 +258,7 @@ impl<T> VecDeque<T> {
///
/// # Examples
///
/// ```rust
/// ```
/// use std::collections::VecDeque;
///
/// let mut buf = VecDeque::new();
@ -513,7 +513,7 @@ impl<T> VecDeque<T> {
///
/// # Examples
///
/// ```rust
/// ```
/// use std::collections::VecDeque;
///
/// let mut buf = VecDeque::new();
@ -536,7 +536,7 @@ impl<T> VecDeque<T> {
///
/// # Examples
///
/// ```rust
/// ```
/// use std::collections::VecDeque;
///
/// let mut buf = VecDeque::new();
@ -824,7 +824,7 @@ impl<T> VecDeque<T> {
///
/// # Examples
///
/// ```rust
/// ```
/// use std::collections::VecDeque;
///
/// let mut buf = VecDeque::new();
@ -849,7 +849,7 @@ impl<T> VecDeque<T> {
///
/// # Examples
///
/// ```rust
/// ```
/// use std::collections::VecDeque;
///
/// let mut buf = VecDeque::new();
@ -949,7 +949,7 @@ impl<T> VecDeque<T> {
/// Panics if `i` is greater than ringbuf's length
///
/// # Examples
/// ```rust
/// ```
/// use std::collections::VecDeque;
///
/// let mut buf = VecDeque::new();
@ -1151,7 +1151,7 @@ impl<T> VecDeque<T> {
/// Returns `None` if `i` is out of bounds.
///
/// # Examples
/// ```rust
/// ```
/// use std::collections::VecDeque;
///
/// let mut buf = VecDeque::new();

View file

@ -216,7 +216,7 @@ macro_rules! writeln {
///
/// Match arms:
///
/// ```rust
/// ```
/// fn foo(x: Option<int>) {
/// match x {
/// Some(n) if n >= 0 => println!("Some(Non-negative)"),
@ -229,7 +229,7 @@ macro_rules! writeln {
///
/// Iterators:
///
/// ```rust
/// ```
/// fn divide_by_three(x: u32) -> u32 { // one of the poorest implementations of x/3
/// for i in std::iter::count(0, 1) {
/// if 3*i < i { panic!("u32 overflow"); }

View file

@ -310,7 +310,7 @@ impl<T:?Sized> MarkerTrait for T { }
///
/// Therefore, we can model a method like this as follows:
///
/// ```rust
/// ```
/// use std::marker::PhantomFn;
/// trait Even : PhantomFn<Self> { }
/// ```
@ -318,7 +318,7 @@ impl<T:?Sized> MarkerTrait for T { }
/// Another equivalent, but clearer, option would be to use
/// `MarkerTrait`:
///
/// ```rust
/// ```
/// use std::marker::MarkerTrait;
/// trait Even : MarkerTrait { }
/// ```

View file

@ -251,7 +251,7 @@ pub fn swap<T>(x: &mut T, y: &mut T) {
/// `self.buf`. But `replace` can be used to disassociate the original value of `self.buf` from
/// `self`, allowing it to be returned:
///
/// ```rust
/// ```
/// use std::mem;
/// # struct Buffer<T> { buf: Vec<T> }
/// impl<T> Buffer<T> {

View file

@ -281,7 +281,7 @@ impl Float for f32 {
/// The fractional part of the number, satisfying:
///
/// ```rust
/// ```
/// use core::num::Float;
///
/// let x = 1.65f32;

View file

@ -288,7 +288,7 @@ impl Float for f64 {
/// The fractional part of the number, satisfying:
///
/// ```rust
/// ```
/// use core::num::Float;
///
/// let x = 1.65f64;

View file

@ -84,7 +84,7 @@ pub trait Int
///
/// # Examples
///
/// ```rust
/// ```
/// use std::num::Int;
///
/// let n = 0b01001100u8;
@ -99,7 +99,7 @@ pub trait Int
///
/// # Examples
///
/// ```rust
/// ```
/// use std::num::Int;
///
/// let n = 0b01001100u8;
@ -118,7 +118,7 @@ pub trait Int
///
/// # Examples
///
/// ```rust
/// ```
/// use std::num::Int;
///
/// let n = 0b0101000u16;
@ -134,7 +134,7 @@ pub trait Int
///
/// # Examples
///
/// ```rust
/// ```
/// use std::num::Int;
///
/// let n = 0b0101000u16;
@ -150,7 +150,7 @@ pub trait Int
///
/// # Examples
///
/// ```rust
/// ```
/// use std::num::Int;
///
/// let n = 0x0123456789ABCDEFu64;
@ -167,7 +167,7 @@ pub trait Int
///
/// # Examples
///
/// ```rust
/// ```
/// use std::num::Int;
///
/// let n = 0x0123456789ABCDEFu64;
@ -183,7 +183,7 @@ pub trait Int
///
/// # Examples
///
/// ```rust
/// ```
/// use std::num::Int;
///
/// let n = 0x0123456789ABCDEFu64;
@ -200,7 +200,7 @@ pub trait Int
///
/// # Examples
///
/// ```rust
/// ```
/// use std::num::Int;
///
/// let n = 0x0123456789ABCDEFu64;
@ -223,7 +223,7 @@ pub trait Int
///
/// # Examples
///
/// ```rust
/// ```
/// use std::num::Int;
///
/// let n = 0x0123456789ABCDEFu64;
@ -246,7 +246,7 @@ pub trait Int
///
/// # Examples
///
/// ```rust
/// ```
/// use std::num::Int;
///
/// let n = 0x0123456789ABCDEFu64;
@ -269,7 +269,7 @@ pub trait Int
///
/// # Examples
///
/// ```rust
/// ```
/// use std::num::Int;
///
/// let n = 0x0123456789ABCDEFu64;
@ -291,7 +291,7 @@ pub trait Int
///
/// # Examples
///
/// ```rust
/// ```
/// use std::num::Int;
///
/// assert_eq!(5u16.checked_add(65530), Some(65535));
@ -305,7 +305,7 @@ pub trait Int
///
/// # Examples
///
/// ```rust
/// ```
/// use std::num::Int;
///
/// assert_eq!((-127i8).checked_sub(1), Some(-128));
@ -319,7 +319,7 @@ pub trait Int
///
/// # Examples
///
/// ```rust
/// ```
/// use std::num::Int;
///
/// assert_eq!(5u8.checked_mul(51), Some(255));
@ -333,7 +333,7 @@ pub trait Int
///
/// # Examples
///
/// ```rust
/// ```
/// use std::num::Int;
///
/// assert_eq!((-127i8).checked_div(-1), Some(127));
@ -371,7 +371,7 @@ pub trait Int
///
/// # Examples
///
/// ```rust
/// ```
/// use std::num::Int;
///
/// assert_eq!(2.pow(4), 16);

View file

@ -78,7 +78,7 @@ use fmt;
/// A trivial implementation of `Drop`. The `drop` method is called when `_x` goes
/// out of scope, and therefore `main` prints `Dropping!`.
///
/// ```rust
/// ```
/// struct HasDrop;
///
/// impl Drop for HasDrop {
@ -162,7 +162,7 @@ macro_rules! forward_ref_binop {
/// A trivial implementation of `Add`. When `Foo + Foo` happens, it ends up
/// calling `add`, and therefore, `main` prints `Adding!`.
///
/// ```rust
/// ```
/// use std::ops::Add;
///
/// #[derive(Copy)]
@ -216,7 +216,7 @@ add_impl! { usize u8 u16 u32 u64 isize i8 i16 i32 i64 f32 f64 }
/// A trivial implementation of `Sub`. When `Foo - Foo` happens, it ends up
/// calling `sub`, and therefore, `main` prints `Subtracting!`.
///
/// ```rust
/// ```
/// use std::ops::Sub;
///
/// #[derive(Copy)]
@ -270,7 +270,7 @@ sub_impl! { usize u8 u16 u32 u64 isize i8 i16 i32 i64 f32 f64 }
/// A trivial implementation of `Mul`. When `Foo * Foo` happens, it ends up
/// calling `mul`, and therefore, `main` prints `Multiplying!`.
///
/// ```rust
/// ```
/// use std::ops::Mul;
///
/// #[derive(Copy)]

View file

@ -897,7 +897,7 @@ impl<A, V: FromIterator<A>> FromIterator<Option<A>> for Option<V> {
/// Here is an example which increments every integer in a vector,
/// checking for overflow:
///
/// ```rust
/// ```
/// use std::u16;
///
/// let v = vec!(1, 2);

View file

@ -896,7 +896,7 @@ impl<A, E, V: FromIterator<A>> FromIterator<Result<A, E>> for Result<V, E> {
/// Here is an example which increments every integer in a vector,
/// checking for overflow:
///
/// ```rust
/// ```
/// use std::u32;
///
/// let v = vec!(1, 2);

View file

@ -1449,7 +1449,7 @@ pub fn mut_ref_slice<'a, A>(s: &'a mut A) -> &'a mut [A] {
///
/// # Examples
///
/// ```rust
/// ```
/// use std::slice;
///
/// // manifest a slice out of thin air!
@ -1492,7 +1492,7 @@ pub unsafe fn from_raw_parts_mut<'a, T>(p: *mut T, len: usize) -> &'a mut [T] {
///
/// # Examples
///
/// ```rust
/// ```
/// use std::slice;
///
/// // manifest a slice out of thin air!

View file

@ -140,7 +140,7 @@ impl FromStr for bool {
///
/// # Examples
///
/// ```rust
/// ```
/// use std::str::FromStr;
///
/// assert_eq!(FromStr::from_str("true"), Ok(true));
@ -151,7 +151,7 @@ impl FromStr for bool {
/// Note, in many cases, the StrExt::parse() which is based on
/// this FromStr::from_str() is more proper.
///
/// ```rust
/// ```
/// assert_eq!("true".parse(), Ok(true));
/// assert_eq!("false".parse(), Ok(false));
/// assert!("not even a boolean".parse::<bool>().is_err());
@ -1186,7 +1186,7 @@ mod traits {
///
/// # Examples
///
/// ```rust
/// ```
/// let s = "Löwe 老虎 Léopard";
/// assert_eq!(&s[0 .. 1], "L");
///

View file

@ -59,7 +59,7 @@ impl Rand for Exp1 {
///
/// # Examples
///
/// ```rust
/// ```
/// use std::rand;
/// use std::rand::distributions::{Exp, IndependentSample};
///

View file

@ -39,7 +39,7 @@ use super::{IndependentSample, Sample, Exp};
///
/// # Examples
///
/// ```rust
/// ```
/// use std::rand;
/// use std::rand::distributions::{IndependentSample, Gamma};
///
@ -186,7 +186,7 @@ impl IndependentSample<f64> for GammaLargeShape {
///
/// # Examples
///
/// ```rust
/// ```
/// use std::rand;
/// use std::rand::distributions::{ChiSquared, IndependentSample};
///
@ -243,7 +243,7 @@ impl IndependentSample<f64> for ChiSquared {
///
/// # Examples
///
/// ```rust
/// ```
/// use std::rand;
/// use std::rand::distributions::{FisherF, IndependentSample};
///
@ -287,7 +287,7 @@ impl IndependentSample<f64> for FisherF {
///
/// # Examples
///
/// ```rust
/// ```
/// use std::rand;
/// use std::rand::distributions::{StudentT, IndependentSample};
///

View file

@ -93,7 +93,7 @@ pub struct Weighted<T> {
///
/// # Examples
///
/// ```rust
/// ```
/// use std::rand;
/// use std::rand::distributions::{Weighted, WeightedChoice, IndependentSample};
///

View file

@ -75,7 +75,7 @@ impl Rand for StandardNormal {
///
/// # Examples
///
/// ```rust
/// ```
/// use std::rand;
/// use std::rand::distributions::{Normal, IndependentSample};
///
@ -123,7 +123,7 @@ impl IndependentSample<f64> for Normal {
///
/// # Examples
///
/// ```rust
/// ```
/// use std::rand;
/// use std::rand::distributions::{LogNormal, IndependentSample};
///

View file

@ -35,7 +35,7 @@ use distributions::{Sample, IndependentSample};
///
/// # Examples
///
/// ```rust
/// ```
/// use std::rand::distributions::{IndependentSample, Range};
///
/// fn main() {

View file

@ -148,7 +148,7 @@ pub trait Rng : Sized {
///
/// # Examples
///
/// ```rust
/// ```
/// use std::rand::{thread_rng, Rng};
///
/// let mut v = [0; 13579];
@ -183,7 +183,7 @@ pub trait Rng : Sized {
///
/// # Examples
///
/// ```rust
/// ```
/// use std::rand::{thread_rng, Rng};
///
/// let mut rng = thread_rng();
@ -228,7 +228,7 @@ pub trait Rng : Sized {
///
/// # Examples
///
/// ```rust
/// ```
/// use std::rand::{thread_rng, Rng};
///
/// let mut rng = thread_rng();
@ -246,7 +246,7 @@ pub trait Rng : Sized {
///
/// # Examples
///
/// ```rust
/// ```
/// use std::rand::{thread_rng, Rng};
///
/// let mut rng = thread_rng();
@ -260,7 +260,7 @@ pub trait Rng : Sized {
///
/// # Examples
///
/// ```rust
/// ```
/// use std::rand::{thread_rng, Rng};
///
/// let s: String = thread_rng().gen_ascii_chars().take(10).collect();
@ -296,7 +296,7 @@ pub trait Rng : Sized {
///
/// # Examples
///
/// ```rust
/// ```
/// use std::rand::{thread_rng, Rng};
///
/// let mut rng = thread_rng();
@ -359,7 +359,7 @@ pub trait SeedableRng<Seed>: Rng {
///
/// # Examples
///
/// ```rust
/// ```
/// use std::rand::{Rng, SeedableRng, StdRng};
///
/// let seed: &[_] = &[1, 2, 3, 4];
@ -374,7 +374,7 @@ pub trait SeedableRng<Seed>: Rng {
///
/// # Examples
///
/// ```rust
/// ```
/// use std::rand::{Rng, SeedableRng, StdRng};
///
/// let seed: &[_] = &[1, 2, 3, 4];
@ -478,7 +478,8 @@ impl Rand for XorShiftRng {
/// `[0,1)`.
///
/// # Examples
/// ```rust
///
/// ```
/// use std::rand::{random, Open01};
///
/// let Open01(val) = random::<Open01<f32>>();
@ -495,7 +496,7 @@ pub struct Open01<F>(pub F);
///
/// # Examples
///
/// ```rust
/// ```
/// use std::rand::{random, Closed01};
///
/// let Closed01(val) = random::<Closed01<f32>>();

View file

@ -102,7 +102,7 @@ impl<S, R: SeedableRng<S>, Rsdr: Reseeder<R> + Default>
///
/// # Examples
///
/// ```rust
/// ```
/// use std::rand::{Rng, SeedableRng, StdRng};
/// use std::rand::reseeding::{Reseeder, ReseedingRng};
///

View file

@ -535,7 +535,7 @@ fn assemble_candidates_from_param_env<'cx,'tcx>(
/// In the case of a nested projection like <<A as Foo>::FooT as Bar>::BarT, we may find
/// that the definition of `Foo` has some clues:
///
/// ```rust
/// ```
/// trait Foo {
/// type FooT : Bar<BarT=i32>
/// }

View file

@ -82,7 +82,7 @@ impl<'tcx> TypeWalker<'tcx> {
///
/// Example: Imagine you are walking `Foo<Bar<int>, uint>`.
///
/// ```rust
/// ```
/// let mut iter: TypeWalker = ...;
/// iter.next(); // yields Foo
/// iter.next(); // yields Bar<int>

View file

@ -253,7 +253,7 @@ fn trans_fn_ref_with_substs_to_callee<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
/// Translates an adapter that implements the `Fn` trait for a fn
/// pointer. This is basically the equivalent of something like:
///
/// ```rust
/// ```
/// impl<'a> Fn(&'a int) -> &'a int for fn(&int) -> &int {
/// extern "rust-abi" fn call(&self, args: (&'a int,)) -> &'a int {
/// (*self)(args.0)

View file

@ -31,7 +31,7 @@ impl ToHex for [u8] {
///
/// # Examples
///
/// ```rust
/// ```
/// extern crate serialize;
/// use serialize::hex::ToHex;
///
@ -100,7 +100,7 @@ impl FromHex for str {
///
/// This converts a string literal to hexadecimal and back.
///
/// ```rust
/// ```
/// extern crate serialize;
/// use serialize::hex::{FromHex, ToHex};
///

View file

@ -41,7 +41,7 @@ use sys::os as os_imp;
///
/// # Examples
///
/// ```rust
/// ```
/// use std::env;
///
/// // We assume that we are in a valid directory.
@ -58,7 +58,7 @@ pub fn current_dir() -> io::Result<PathBuf> {
///
/// # Examples
///
/// ```rust
/// ```
/// use std::env;
/// use std::path::Path;
///
@ -102,7 +102,7 @@ pub struct VarsOs { inner: os_imp::Env }
///
/// # Examples
///
/// ```rust
/// ```
/// use std::env;
///
/// // We will iterate through the references to the element returned by
@ -125,7 +125,7 @@ pub fn vars() -> Vars {
///
/// # Examples
///
/// ```rust
/// ```
/// use std::env;
///
/// // We will iterate through the references to the element returned by
@ -166,7 +166,7 @@ impl Iterator for VarsOs {
///
/// # Examples
///
/// ```rust
/// ```
/// use std::env;
///
/// let key = "HOME";
@ -188,7 +188,7 @@ pub fn var<K: ?Sized>(key: &K) -> Result<String, VarError> where K: AsOsStr {
///
/// # Examples
///
/// ```rust
/// ```
/// use std::env;
///
/// let key = "HOME";
@ -246,7 +246,7 @@ impl Error for VarError {
///
/// # Examples
///
/// ```rust
/// ```
/// use std::env;
///
/// let key = "KEY";
@ -282,7 +282,7 @@ pub struct SplitPaths<'a> { inner: os_imp::SplitPaths<'a> }
///
/// # Examples
///
/// ```rust
/// ```
/// use std::env;
///
/// let key = "PATH";
@ -326,7 +326,7 @@ pub struct JoinPathsError {
///
/// # Examples
///
/// ```rust
/// ```
/// use std::env;
/// use std::path::PathBuf;
///
@ -374,7 +374,7 @@ impl Error for JoinPathsError {
///
/// # Examples
///
/// ```rust
/// ```
/// use std::env;
///
/// match env::home_dir() {
@ -416,7 +416,7 @@ pub fn temp_dir() -> PathBuf {
///
/// # Examples
///
/// ```rust
/// ```
/// use std::env;
///
/// match env::current_exe() {
@ -481,7 +481,7 @@ pub struct ArgsOs { inner: os_imp::Args }
///
/// # Examples
///
/// ```rust
/// ```
/// use std::env;
///
/// // Prints each argument on a separate line
@ -503,7 +503,7 @@ pub fn args() -> Args {
///
/// # Examples
///
/// ```rust
/// ```
/// use std::env;
///
/// // Prints each argument on a separate line

View file

@ -473,7 +473,7 @@ pub fn rename<P: AsPath, Q: AsPath>(from: P, to: Q) -> io::Result<()> {
///
/// # Examples
///
/// ```rust
/// ```
/// use std::fs;
///
/// fs::copy("foo.txt", "bar.txt");
@ -540,7 +540,7 @@ pub fn read_link<P: AsPath>(path: P) -> io::Result<PathBuf> {
///
/// # Examples
///
/// ```rust
/// ```
/// use std::fs;
///
/// fs::create_dir("/some/dir");
@ -576,7 +576,7 @@ pub fn create_dir_all<P: AsPath>(path: P) -> io::Result<()> {
///
/// # Examples
///
/// ```rust
/// ```
/// use std::fs;
///
/// fs::remove_dir("/some/dir");
@ -627,7 +627,7 @@ pub fn remove_dir_all<P: AsPath>(path: P) -> io::Result<()> {
///
/// # Examples
///
/// ```rust
/// ```
/// use std::io;
/// use std::fs::{self, PathExt, DirEntry};
/// use std::path::Path;

View file

@ -182,7 +182,7 @@ pub mod builtin {
///
/// # Examples
///
/// ```rust
/// ```
/// use std::fmt;
///
/// let s = fmt::format(format_args!("hello {}", "world"));
@ -205,7 +205,7 @@ pub mod builtin {
///
/// # Examples
///
/// ```rust
/// ```
/// let path: &'static str = env!("PATH");
/// println!("the $PATH variable at the time of compiling was: {}", path);
/// ```
@ -224,7 +224,7 @@ pub mod builtin {
///
/// # Examples
///
/// ```rust
/// ```
/// let key: Option<&'static str> = option_env!("SECRET_KEY");
/// println!("the secret key might be: {:?}", key);
/// ```
@ -372,7 +372,7 @@ pub mod builtin {
///
/// # Examples
///
/// ```rust
/// ```
/// mod test {
/// pub fn foo() {
/// assert!(module_path!().ends_with("test"));
@ -395,7 +395,7 @@ pub mod builtin {
///
/// # Examples
///
/// ```rust
/// ```
/// let my_directory = if cfg!(windows) {
/// "windows-specific-directory"
/// } else {

View file

@ -34,7 +34,7 @@ use vec::Vec;
///
/// # Examples
///
/// ```rust
/// ```
/// use std::old_io::{BufferedReader, File};
///
/// let file = File::open(&Path::new("message.txt"));
@ -137,7 +137,7 @@ impl<R: Reader> Reader for BufferedReader<R> {
///
/// # Examples
///
/// ```rust
/// ```
/// use std::old_io::{BufferedWriter, File};
///
/// let file = File::create(&Path::new("message.txt")).unwrap();
@ -323,7 +323,7 @@ impl<W: Reader> Reader for InternalBufferedWriter<W> {
///
/// # Examples
///
/// ```rust
/// ```
/// # #![allow(unused_must_use)]
/// use std::old_io::{BufferedStream, File};
///

View file

@ -176,7 +176,7 @@ impl File {
///
/// # Examples
///
/// ```rust
/// ```
/// use std::old_io::File;
///
/// let contents = File::open(&Path::new("foo.txt")).read_to_end();
@ -195,7 +195,7 @@ impl File {
///
/// # Examples
///
/// ```rust
/// ```
/// # #![allow(unused_must_use)]
/// use std::old_io::File;
///
@ -286,7 +286,7 @@ impl File {
///
/// # Examples
///
/// ```rust
/// ```
/// # #![allow(unused_must_use)]
/// use std::old_io::fs;
///
@ -317,7 +317,7 @@ pub fn unlink(path: &Path) -> IoResult<()> {
///
/// # Examples
///
/// ```rust
/// ```
/// use std::old_io::fs;
///
/// let p = Path::new("/some/file/path.txt");
@ -359,7 +359,7 @@ pub fn lstat(path: &Path) -> IoResult<FileStat> {
///
/// # Examples
///
/// ```rust
/// ```
/// # #![allow(unused_must_use)]
/// use std::old_io::fs;
///
@ -387,7 +387,7 @@ pub fn rename(from: &Path, to: &Path) -> IoResult<()> {
///
/// # Examples
///
/// ```rust
/// ```
/// # #![allow(unused_must_use)]
/// use std::old_io::fs;
///
@ -437,7 +437,7 @@ pub fn copy(from: &Path, to: &Path) -> IoResult<()> {
///
/// # Examples
///
/// ```rust
/// ```
/// # #![allow(unused_must_use)]
/// use std::old_io;
/// use std::old_io::fs;
@ -508,7 +508,7 @@ pub fn readlink(path: &Path) -> IoResult<Path> {
///
/// # Examples
///
/// ```rust
/// ```
/// # #![allow(unused_must_use)]
/// use std::old_io;
/// use std::old_io::fs;
@ -532,7 +532,7 @@ pub fn mkdir(path: &Path, mode: FilePermission) -> IoResult<()> {
///
/// # Examples
///
/// ```rust
/// ```
/// # #![allow(unused_must_use)]
/// use std::old_io::fs;
///
@ -556,7 +556,7 @@ pub fn rmdir(path: &Path) -> IoResult<()> {
///
/// # Examples
///
/// ```rust
/// ```
/// use std::old_io::fs::PathExtensions;
/// use std::old_io::fs;
/// use std::old_io;

View file

@ -56,7 +56,7 @@ impl Writer for Vec<u8> {
///
/// # Examples
///
/// ```rust
/// ```
/// # #![allow(unused_must_use)]
/// use std::old_io::MemWriter;
///
@ -116,7 +116,7 @@ impl Writer for MemWriter {
///
/// # Examples
///
/// ```rust
/// ```
/// # #![allow(unused_must_use)]
/// use std::old_io::MemReader;
///
@ -246,7 +246,7 @@ impl<'a> Buffer for &'a [u8] {
///
/// # Examples
///
/// ```rust
/// ```
/// # #![allow(unused_must_use)]
/// use std::old_io::BufWriter;
///
@ -318,7 +318,7 @@ impl<'a> Seek for BufWriter<'a> {
///
/// # Examples
///
/// ```rust
/// ```
/// # #![allow(unused_must_use)]
/// use std::old_io::BufReader;
///

View file

@ -1410,7 +1410,7 @@ pub trait Buffer: Reader {
///
/// # Examples
///
/// ```rust
/// ```
/// use std::old_io::BufReader;
///
/// let mut reader = BufReader::new(b"hello\nworld");

View file

@ -52,7 +52,7 @@ impl UnixStream {
///
/// # Examples
///
/// ```rust
/// ```
/// # #![allow(unused_must_use)]
/// use std::old_io::net::pipe::UnixStream;
///

View file

@ -142,7 +142,7 @@ impl StdinReader {
///
/// # Examples
///
/// ```rust
/// ```
/// use std::old_io;
///
/// let mut stdin = old_io::stdin();

View file

@ -115,7 +115,7 @@ impl Timer {
///
/// # Examples
///
/// ```rust
/// ```
/// use std::old_io::Timer;
/// use std::time::Duration;
///
@ -128,7 +128,7 @@ impl Timer {
/// ten_milliseconds.recv().unwrap();
/// ```
///
/// ```rust
/// ```
/// use std::old_io::Timer;
/// use std::time::Duration;
///
@ -167,7 +167,7 @@ impl Timer {
///
/// # Examples
///
/// ```rust
/// ```
/// use std::old_io::Timer;
/// use std::time::Duration;
///
@ -186,7 +186,7 @@ impl Timer {
/// ten_milliseconds.recv().unwrap();
/// ```
///
/// ```rust
/// ```
/// use std::old_io::Timer;
/// use std::time::Duration;
///

View file

@ -132,7 +132,7 @@ pub const TMPBUF_SZ : uint = 1000;
///
/// # Examples
///
/// ```rust
/// ```
/// use std::os;
///
/// // We assume that we are in a valid directory.
@ -152,7 +152,7 @@ pub fn getcwd() -> IoResult<Path> {
///
/// # Examples
///
/// ```rust
/// ```
/// use std::os;
///
/// // We will iterate through the references to the element returned by os::env();
@ -188,7 +188,7 @@ pub fn env_as_bytes() -> Vec<(Vec<u8>, Vec<u8>)> {
///
/// # Examples
///
/// ```rust
/// ```
/// use std::os;
///
/// let key = "HOME";
@ -230,7 +230,7 @@ fn byteify(s: OsString) -> Vec<u8> {
///
/// # Examples
///
/// ```rust
/// ```
/// use std::os;
///
/// let key = "KEY";
@ -270,7 +270,8 @@ pub fn unsetenv(n: &str) {
/// environment variable.
///
/// # Examples
/// ```rust
///
/// ```
/// use std::os;
///
/// let key = "PATH";
@ -302,7 +303,7 @@ pub fn split_paths<T: BytesContainer>(unparsed: T) -> Vec<Path> {
///
/// # Examples
///
/// ```rust
/// ```
/// use std::os;
/// use std::old_path::Path;
///
@ -363,7 +364,7 @@ pub fn dll_filename(base: &str) -> String {
///
/// # Examples
///
/// ```rust
/// ```
/// use std::os;
///
/// match os::self_exe_name() {
@ -383,7 +384,7 @@ pub fn self_exe_name() -> Option<Path> {
///
/// # Examples
///
/// ```rust
/// ```
/// use std::os;
///
/// match os::self_exe_path() {
@ -412,7 +413,7 @@ pub fn self_exe_path() -> Option<Path> {
///
/// # Examples
///
/// ```rust
/// ```
/// use std::os;
///
/// match os::homedir() {
@ -501,7 +502,8 @@ pub fn tmpdir() -> Path {
/// as is.
///
/// # Examples
/// ```rust
///
/// ```
/// use std::os;
/// use std::old_path::Path;
///
@ -532,7 +534,8 @@ pub fn make_absolute(p: &Path) -> IoResult<Path> {
/// whether the change was completed successfully or not.
///
/// # Examples
/// ```rust
///
/// ```
/// use std::os;
/// use std::old_path::Path;
///
@ -553,7 +556,8 @@ pub fn errno() -> i32 {
/// Return the string corresponding to an `errno()` value of `errnum`.
///
/// # Examples
/// ```rust
///
/// ```
/// use std::os;
///
/// // Same as println!("{}", last_os_error());
@ -749,7 +753,7 @@ extern "system" {
/// See `String::from_utf8_lossy` for details.
/// # Examples
///
/// ```rust
/// ```
/// use std::os;
///
/// // Prints each argument on a separate line

View file

@ -856,7 +856,7 @@ impl<'a> cmp::Ord for Components<'a> {
///
/// # Examples
///
/// ```rust
/// ```
/// use std::path::PathBuf;
///
/// let mut path = PathBuf::new("c:\\");
@ -948,7 +948,7 @@ impl PathBuf {
///
/// # Examples
///
/// ```rust
/// ```
/// use std::path::PathBuf;
///
/// let mut buf = PathBuf::new("/");
@ -1105,7 +1105,7 @@ impl AsOsStr for PathBuf {
///
/// # Examples
///
/// ```rust
/// ```
/// use std::path::Path;
///
/// let path = Path::new("/tmp/foo/bar.txt");
@ -1210,7 +1210,7 @@ impl Path {
///
/// # Examples
///
/// ```rust
/// ```
/// use std::path::Path;
///
/// let path = Path::new("/foo/bar");

View file

@ -426,7 +426,7 @@ pub fn random<T: Rand>() -> T {
///
/// # Examples
///
/// ```rust
/// ```
/// use std::rand::{thread_rng, sample};
///
/// let mut rng = thread_rng();

View file

@ -25,7 +25,7 @@ use slice::SliceExt;
///
/// # Examples
///
/// ```rust
/// ```
/// use std::rand::{reader, Rng};
/// use std::old_io::MemReader;
///

View file

@ -13,7 +13,7 @@ use sync::{Mutex, Condvar};
/// A barrier enables multiple tasks to synchronize the beginning
/// of some computation.
///
/// ```rust
/// ```
/// use std::sync::{Arc, Barrier};
/// use std::thread;
///

View file

@ -46,7 +46,7 @@ use fmt;
///
/// # Examples
///
/// ```rust
/// ```
/// use std::sync::{Arc, Mutex};
/// use std::thread;
/// use std::sync::mpsc::channel;
@ -84,7 +84,7 @@ use fmt;
///
/// To recover from a poisoned mutex:
///
/// ```rust
/// ```
/// use std::sync::{Arc, Mutex};
/// use std::thread;
///
@ -135,7 +135,7 @@ unsafe impl<T: Send> Sync for Mutex<T> { }
///
/// # Examples
///
/// ```rust
/// ```
/// use std::sync::{StaticMutex, MUTEX_INIT};
///
/// static LOCK: StaticMutex = MUTEX_INIT;

View file

@ -26,7 +26,7 @@ use sync::{StaticMutex, MUTEX_INIT};
///
/// # Examples
///
/// ```rust
/// ```
/// use std::sync::{Once, ONCE_INIT};
///
/// static START: Once = ONCE_INIT;

View file

@ -60,7 +60,7 @@ impl<'a> Drop for Sentinel<'a> {
///
/// # Examples
///
/// ```rust
/// ```
/// use std::sync::TaskPool;
/// use std::iter::AdditiveIterator;
/// use std::sync::mpsc::channel;

View file

@ -482,7 +482,7 @@ impl<'a> Iterator for Utf16Items<'a> {
///
/// # Examples
///
/// ```rust
/// ```
/// use unicode::str::Utf16Item::{ScalarValue, LoneSurrogate};
///
/// // 𝄞mus<invalid>ic<invalid>