From ba5fcb726fb88cc8393f48c9f46ba03fcadf0511 Mon Sep 17 00:00:00 2001 From: Steve Klabnik Date: Mon, 27 Jul 2015 10:50:19 -0400 Subject: Show appropriate feature flags in docs --- src/libcore/cell.rs | 6 ++++-- src/libcore/cmp.rs | 12 ++++++++---- src/libcore/fmt/num.rs | 3 ++- src/libcore/hash/mod.rs | 6 ++++-- src/libcore/iter.rs | 21 ++++++++++++++------- src/libcore/option.rs | 3 ++- src/libcore/raw.rs | 6 ++++-- src/libcore/result.rs | 3 ++- src/libcore/simd.rs | 3 ++- 9 files changed, 42 insertions(+), 21 deletions(-) (limited to 'src/libcore') diff --git a/src/libcore/cell.rs b/src/libcore/cell.rs index 2c4ebeafc0b..c443270d5f4 100644 --- a/src/libcore/cell.rs +++ b/src/libcore/cell.rs @@ -221,7 +221,8 @@ impl Cell { /// # Examples /// /// ``` - /// # #![feature(as_unsafe_cell)] + /// #![feature(as_unsafe_cell)] + /// /// use std::cell::Cell; /// /// let c = Cell::new(5); @@ -589,7 +590,8 @@ impl<'b, T: ?Sized> Ref<'b, T> { /// # Example /// /// ``` - /// # #![feature(cell_extras)] + /// #![feature(cell_extras)] + /// /// use std::cell::{RefCell, Ref}; /// /// let c = RefCell::new((5, 'b')); diff --git a/src/libcore/cmp.rs b/src/libcore/cmp.rs index 52ed29c1b61..6651ee69d1d 100644 --- a/src/libcore/cmp.rs +++ b/src/libcore/cmp.rs @@ -383,7 +383,8 @@ pub fn max(v1: T, v2: T) -> T { /// # Examples /// /// ``` -/// # #![feature(cmp_partial)] +/// #![feature(cmp_partial)] +/// /// use std::cmp; /// /// assert_eq!(Some(1), cmp::partial_min(1, 2)); @@ -393,7 +394,8 @@ pub fn max(v1: T, v2: T) -> T { /// When comparison is impossible: /// /// ``` -/// # #![feature(cmp_partial)] +/// #![feature(cmp_partial)] +/// /// use std::cmp; /// /// let result = cmp::partial_min(std::f64::NAN, 1.0); @@ -416,7 +418,8 @@ pub fn partial_min(v1: T, v2: T) -> Option { /// # Examples /// /// ``` -/// # #![feature(cmp_partial)] +/// #![feature(cmp_partial)] +/// /// use std::cmp; /// /// assert_eq!(Some(2), cmp::partial_max(1, 2)); @@ -426,7 +429,8 @@ pub fn partial_min(v1: T, v2: T) -> Option { /// When comparison is impossible: /// /// ``` -/// # #![feature(cmp_partial)] +/// #![feature(cmp_partial)] +/// /// use std::cmp; /// /// let result = cmp::partial_max(std::f64::NAN, 1.0); diff --git a/src/libcore/fmt/num.rs b/src/libcore/fmt/num.rs index 8141916dd60..7cacc6af575 100644 --- a/src/libcore/fmt/num.rs +++ b/src/libcore/fmt/num.rs @@ -167,7 +167,8 @@ pub struct RadixFmt(T, R); /// # Examples /// /// ``` -/// # #![feature(fmt_radix)] +/// #![feature(fmt_radix)] +/// /// use std::fmt::radix; /// assert_eq!(format!("{}", radix(55, 36)), "1j".to_string()); /// ``` diff --git a/src/libcore/hash/mod.rs b/src/libcore/hash/mod.rs index abf9e55a1f2..0ecbdc9eeb0 100644 --- a/src/libcore/hash/mod.rs +++ b/src/libcore/hash/mod.rs @@ -16,7 +16,8 @@ //! # Examples //! //! ```rust -//! # #![feature(hash_default)] +//! #![feature(hash_default)] +//! //! use std::hash::{hash, Hash, SipHasher}; //! //! #[derive(Hash)] @@ -36,7 +37,8 @@ //! the trait `Hash`: //! //! ```rust -//! # #![feature(hash_default)] +//! #![feature(hash_default)] +//! //! use std::hash::{hash, Hash, Hasher, SipHasher}; //! //! struct Person { diff --git a/src/libcore/iter.rs b/src/libcore/iter.rs index 415326a8a61..28104989a8e 100644 --- a/src/libcore/iter.rs +++ b/src/libcore/iter.rs @@ -822,7 +822,8 @@ pub trait Iterator { /// # Examples /// /// ``` - /// # #![feature(iter_min_max)] + /// #![feature(iter_min_max)] + /// /// use std::iter::MinMaxResult::{NoElements, OneElement, MinMax}; /// /// let a: [i32; 0] = []; @@ -894,7 +895,8 @@ pub trait Iterator { /// # Examples /// /// ``` - /// # #![feature(iter_cmp)] + /// #![feature(iter_cmp)] + /// /// let a = [-3_i32, 0, 1, 5, -10]; /// assert_eq!(*a.iter().max_by(|x| x.abs()).unwrap(), -10); /// ``` @@ -922,7 +924,8 @@ pub trait Iterator { /// # Examples /// /// ``` - /// # #![feature(iter_cmp)] + /// #![feature(iter_cmp)] + /// /// let a = [-3_i32, 0, 1, 5, -10]; /// assert_eq!(*a.iter().min_by(|x| x.abs()).unwrap(), 0); /// ``` @@ -1061,7 +1064,8 @@ pub trait Iterator { /// # Examples /// /// ``` - /// # #![feature(iter_arith)] + /// #![feature(iter_arith)] + /// /// let a = [1, 2, 3, 4, 5]; /// let it = a.iter(); /// assert_eq!(it.sum::(), 15); @@ -1079,7 +1083,8 @@ pub trait Iterator { /// # Examples /// /// ``` - /// # #![feature(iter_arith)] + /// #![feature(iter_arith)] + /// /// fn factorial(n: u32) -> u32 { /// (1..).take_while(|&i| i <= n).product() /// } @@ -1359,7 +1364,8 @@ impl MinMaxResult { /// # Examples /// /// ``` - /// # #![feature(iter_min_max)] + /// #![feature(iter_min_max)] + /// /// use std::iter::MinMaxResult::{self, NoElements, OneElement, MinMax}; /// /// let r: MinMaxResult = NoElements; @@ -2751,7 +2757,8 @@ impl ops::Range { /// # Examples /// /// ``` - /// # #![feature(step_by)] + /// #![feature(step_by)] + /// /// for i in (0..10).step_by(2) { /// println!("{}", i); /// } diff --git a/src/libcore/option.rs b/src/libcore/option.rs index 9ccba7ad78d..2235dc4af11 100644 --- a/src/libcore/option.rs +++ b/src/libcore/option.rs @@ -274,7 +274,8 @@ impl Option { /// # Examples /// /// ``` - /// # #![feature(as_slice)] + /// #![feature(as_slice)] + /// /// let mut x = Some("Diamonds"); /// { /// let v = x.as_mut_slice(); diff --git a/src/libcore/raw.rs b/src/libcore/raw.rs index 43535ddd1d5..f0bac1bfef3 100644 --- a/src/libcore/raw.rs +++ b/src/libcore/raw.rs @@ -49,7 +49,8 @@ use mem; /// # Examples /// /// ``` -/// # #![feature(raw)] +/// #![feature(raw)] +/// /// use std::raw::{self, Repr}; /// /// let slice: &[u16] = &[1, 2, 3, 4]; @@ -98,7 +99,8 @@ impl Clone for Slice { /// # Examples /// /// ``` -/// # #![feature(raw)] +/// #![feature(raw)] +/// /// use std::mem; /// use std::raw; /// diff --git a/src/libcore/result.rs b/src/libcore/result.rs index d87c1020dcc..43853aceb69 100644 --- a/src/libcore/result.rs +++ b/src/libcore/result.rs @@ -420,7 +420,8 @@ impl Result { /// Converts from `Result` to `&mut [T]` (without copying) /// /// ``` - /// # #![feature(as_slice)] + /// #![feature(as_slice)] + /// /// let mut x: Result<&str, u32> = Ok("Gold"); /// { /// let v = x.as_mut_slice(); diff --git a/src/libcore/simd.rs b/src/libcore/simd.rs index 7ecd08bea35..d0205fc9b12 100644 --- a/src/libcore/simd.rs +++ b/src/libcore/simd.rs @@ -19,7 +19,8 @@ //! provided beyond this module. //! //! ```rust -//! # #![feature(core_simd)] +//! #![feature(core_simd)] +//! //! fn main() { //! use std::simd::f32x4; //! let a = f32x4(40.0, 41.0, 42.0, 43.0); -- cgit 1.4.1-3-g733a5