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:
@@ -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"); }
|
||||
|
||||
@@ -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 { }
|
||||
/// ```
|
||||
|
||||
@@ -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> {
|
||||
|
||||
@@ -281,7 +281,7 @@ impl Float for f32 {
|
||||
|
||||
/// The fractional part of the number, satisfying:
|
||||
///
|
||||
/// ```rust
|
||||
/// ```
|
||||
/// use core::num::Float;
|
||||
///
|
||||
/// let x = 1.65f32;
|
||||
|
||||
@@ -288,7 +288,7 @@ impl Float for f64 {
|
||||
|
||||
/// The fractional part of the number, satisfying:
|
||||
///
|
||||
/// ```rust
|
||||
/// ```
|
||||
/// use core::num::Float;
|
||||
///
|
||||
/// let x = 1.65f64;
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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)]
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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!
|
||||
|
||||
@@ -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");
|
||||
///
|
||||
|
||||
Reference in New Issue
Block a user