Set all doc tests to 2018 edition

This commit is contained in:
David Tolnay
2018-12-31 23:18:09 -05:00
parent 0b667c88fa
commit 11cc7014b3
9 changed files with 94 additions and 94 deletions
+46 -46
View File
@@ -137,7 +137,7 @@ macro_rules! declare_error_trait {
/// For example, a filesystem [`Path`] may refuse to serialize
/// itself if it contains invalid UTF-8 data.
///
/// ```rust
/// ```edition2018
/// # struct Path;
/// #
/// # impl Path {
@@ -210,7 +210,7 @@ pub trait Serialize {
/// See the [Implementing `Serialize`] section of the manual for more
/// information about how to implement this method.
///
/// ```rust
/// ```edition2018
/// use serde::ser::{Serialize, SerializeStruct, Serializer};
///
/// struct Person {
@@ -377,7 +377,7 @@ pub trait Serializer: Sized {
/// Serialize a `bool` value.
///
/// ```rust
/// ```edition2018
/// # use serde::Serializer;
/// #
/// # serde::__private_serialize!();
@@ -399,7 +399,7 @@ pub trait Serializer: Sized {
/// reasonable implementation would be to cast the value to `i64` and
/// forward to `serialize_i64`.
///
/// ```rust
/// ```edition2018
/// # use serde::Serializer;
/// #
/// # serde::__private_serialize!();
@@ -421,7 +421,7 @@ pub trait Serializer: Sized {
/// reasonable implementation would be to cast the value to `i64` and
/// forward to `serialize_i64`.
///
/// ```rust
/// ```edition2018
/// # use serde::Serializer;
/// #
/// # serde::__private_serialize!();
@@ -443,7 +443,7 @@ pub trait Serializer: Sized {
/// reasonable implementation would be to cast the value to `i64` and
/// forward to `serialize_i64`.
///
/// ```rust
/// ```edition2018
/// # use serde::Serializer;
/// #
/// # serde::__private_serialize!();
@@ -461,7 +461,7 @@ pub trait Serializer: Sized {
/// Serialize an `i64` value.
///
/// ```rust
/// ```edition2018
/// # use serde::Serializer;
/// #
/// # serde::__private_serialize!();
@@ -480,7 +480,7 @@ pub trait Serializer: Sized {
serde_if_integer128! {
/// Serialize an `i128` value.
///
/// ```rust
/// ```edition2018
/// # use serde::Serializer;
/// #
/// # serde::__private_serialize!();
@@ -509,7 +509,7 @@ pub trait Serializer: Sized {
/// reasonable implementation would be to cast the value to `u64` and
/// forward to `serialize_u64`.
///
/// ```rust
/// ```edition2018
/// # use serde::Serializer;
/// #
/// # serde::__private_serialize!();
@@ -531,7 +531,7 @@ pub trait Serializer: Sized {
/// reasonable implementation would be to cast the value to `u64` and
/// forward to `serialize_u64`.
///
/// ```rust
/// ```edition2018
/// # use serde::Serializer;
/// #
/// # serde::__private_serialize!();
@@ -553,7 +553,7 @@ pub trait Serializer: Sized {
/// reasonable implementation would be to cast the value to `u64` and
/// forward to `serialize_u64`.
///
/// ```rust
/// ```edition2018
/// # use serde::Serializer;
/// #
/// # serde::__private_serialize!();
@@ -571,7 +571,7 @@ pub trait Serializer: Sized {
/// Serialize a `u64` value.
///
/// ```rust
/// ```edition2018
/// # use serde::Serializer;
/// #
/// # serde::__private_serialize!();
@@ -590,7 +590,7 @@ pub trait Serializer: Sized {
serde_if_integer128! {
/// Serialize a `u128` value.
///
/// ```rust
/// ```edition2018
/// # use serde::Serializer;
/// #
/// # serde::__private_serialize!();
@@ -619,7 +619,7 @@ pub trait Serializer: Sized {
/// reasonable implementation would be to cast the value to `f64` and
/// forward to `serialize_f64`.
///
/// ```rust
/// ```edition2018
/// # use serde::Serializer;
/// #
/// # serde::__private_serialize!();
@@ -637,7 +637,7 @@ pub trait Serializer: Sized {
/// Serialize an `f64` value.
///
/// ```rust
/// ```edition2018
/// # use serde::Serializer;
/// #
/// # serde::__private_serialize!();
@@ -658,7 +658,7 @@ pub trait Serializer: Sized {
/// If the format does not support characters, it is reasonable to serialize
/// it as a single element `str` or a `u32`.
///
/// ```rust
/// ```edition2018
/// # use serde::Serializer;
/// #
/// # serde::__private_serialize!();
@@ -676,7 +676,7 @@ pub trait Serializer: Sized {
/// Serialize a `&str`.
///
/// ```rust
/// ```edition2018
/// # use serde::Serializer;
/// #
/// # serde::__private_serialize!();
@@ -700,7 +700,7 @@ pub trait Serializer: Sized {
/// `serialize_seq`. If forwarded, the implementation looks usually just
/// like this:
///
/// ```rust
/// ```edition2018
/// # use serde::ser::{Serializer, SerializeSeq};
/// # use serde::private::ser::Error;
/// #
@@ -729,7 +729,7 @@ pub trait Serializer: Sized {
/// Serialize a [`None`] value.
///
/// ```rust
/// ```edition2018
/// # use serde::{Serialize, Serializer};
/// #
/// # enum Option<T> {
@@ -762,7 +762,7 @@ pub trait Serializer: Sized {
/// Serialize a [`Some(T)`] value.
///
/// ```rust
/// ```edition2018
/// # use serde::{Serialize, Serializer};
/// #
/// # enum Option<T> {
@@ -797,7 +797,7 @@ pub trait Serializer: Sized {
/// Serialize a `()` value.
///
/// ```rust
/// ```edition2018
/// # use serde::Serializer;
/// #
/// # serde::__private_serialize!();
@@ -817,7 +817,7 @@ pub trait Serializer: Sized {
///
/// A reasonable implementation would be to forward to `serialize_unit`.
///
/// ```rust
/// ```edition2018
/// use serde::{Serialize, Serializer};
///
/// struct Nothing;
@@ -839,7 +839,7 @@ pub trait Serializer: Sized {
/// this variant within the enum, and the `variant` is the name of the
/// variant.
///
/// ```rust
/// ```edition2018
/// use serde::{Serialize, Serializer};
///
/// enum E {
@@ -872,7 +872,7 @@ pub trait Serializer: Sized {
/// wrappers around the data they contain. A reasonable implementation would
/// be to forward to `value.serialize(self)`.
///
/// ```rust
/// ```edition2018
/// use serde::{Serialize, Serializer};
///
/// struct Millimeters(u8);
@@ -900,7 +900,7 @@ pub trait Serializer: Sized {
/// this variant within the enum, and the `variant` is the name of the
/// variant. The `value` is the data contained within this newtype variant.
///
/// ```rust
/// ```edition2018
/// use serde::{Serialize, Serializer};
///
/// enum E {
@@ -938,7 +938,7 @@ pub trait Serializer: Sized {
/// not be computable before the sequence is iterated. Some serializers only
/// support sequences whose length is known up front.
///
/// ```rust
/// ```edition2018
/// # use std::marker::PhantomData;
/// #
/// # struct Vec<T>(PhantomData<T>);
@@ -983,7 +983,7 @@ pub trait Serializer: Sized {
/// This call must be followed by zero or more calls to `serialize_element`,
/// then a call to `end`.
///
/// ```rust
/// ```edition2018
/// use serde::ser::{Serialize, Serializer, SerializeTuple};
///
/// # mod fool {
@@ -1013,7 +1013,7 @@ pub trait Serializer: Sized {
/// }
/// ```
///
/// ```rust
/// ```edition2018
/// use serde::ser::{Serialize, SerializeTuple, Serializer};
///
/// const VRAM_SIZE: usize = 386;
@@ -1041,7 +1041,7 @@ pub trait Serializer: Sized {
/// The `name` is the name of the tuple struct and the `len` is the number
/// of data fields that will be serialized.
///
/// ```rust
/// ```edition2018
/// use serde::ser::{Serialize, SerializeTupleStruct, Serializer};
///
/// struct Rgb(u8, u8, u8);
@@ -1073,7 +1073,7 @@ pub trait Serializer: Sized {
/// this variant within the enum, the `variant` is the name of the variant,
/// and the `len` is the number of data fields that will be serialized.
///
/// ```rust
/// ```edition2018
/// use serde::ser::{Serialize, SerializeTupleVariant, Serializer};
///
/// enum E {
@@ -1119,7 +1119,7 @@ pub trait Serializer: Sized {
/// be computable before the map is iterated. Some serializers only support
/// maps whose length is known up front.
///
/// ```rust
/// ```edition2018
/// # use std::marker::PhantomData;
/// #
/// # struct HashMap<K, V>(PhantomData<K>, PhantomData<V>);
@@ -1167,7 +1167,7 @@ pub trait Serializer: Sized {
/// The `name` is the name of the struct and the `len` is the number of
/// data fields that will be serialized.
///
/// ```rust
/// ```edition2018
/// use serde::ser::{Serialize, SerializeStruct, Serializer};
///
/// struct Rgb {
@@ -1203,7 +1203,7 @@ pub trait Serializer: Sized {
/// this variant within the enum, the `variant` is the name of the variant,
/// and the `len` is the number of data fields that will be serialized.
///
/// ```rust
/// ```edition2018
/// use serde::ser::{Serialize, SerializeStructVariant, Serializer};
///
/// enum E {
@@ -1245,7 +1245,7 @@ pub trait Serializer: Sized {
/// using [`serialize_seq`]. Implementors should not need to override this
/// method.
///
/// ```rust
/// ```edition2018
/// use serde::{Serialize, Serializer};
///
/// struct SecretlyOneHigher {
@@ -1282,7 +1282,7 @@ pub trait Serializer: Sized {
/// using [`serialize_map`]. Implementors should not need to override this
/// method.
///
/// ```rust
/// ```edition2018
/// use serde::{Serialize, Serializer};
/// use std::collections::BTreeSet;
///
@@ -1322,7 +1322,7 @@ pub trait Serializer: Sized {
/// delegates to [`serialize_str`]. Serializers are encouraged to provide a
/// more efficient implementation if possible.
///
/// ```rust
/// ```edition2018
/// # struct DateTime;
/// #
/// # impl DateTime {
@@ -1363,7 +1363,7 @@ pub trait Serializer: Sized {
/// of this method. If no more sensible behavior is possible, the
/// implementation is expected to return an error.
///
/// ```rust
/// ```edition2018
/// # struct DateTime;
/// #
/// # impl DateTime {
@@ -1398,7 +1398,7 @@ pub trait Serializer: Sized {
/// human-readable one and binary formats like Bincode will prefer the
/// compact one.
///
/// ```
/// ```edition2018
/// # use std::fmt::{self, Display};
/// #
/// # struct Timestamp;
@@ -1447,7 +1447,7 @@ pub trait Serializer: Sized {
///
/// # Example use
///
/// ```rust
/// ```edition2018
/// # use std::marker::PhantomData;
/// #
/// # struct Vec<T>(PhantomData<T>);
@@ -1511,7 +1511,7 @@ pub trait SerializeSeq {
///
/// # Example use
///
/// ```rust
/// ```edition2018
/// use serde::ser::{Serialize, Serializer, SerializeTuple};
///
/// # mod fool {
@@ -1541,7 +1541,7 @@ pub trait SerializeSeq {
/// }
/// ```
///
/// ```rust
/// ```edition2018
/// # use std::marker::PhantomData;
/// #
/// # struct Array<T>(PhantomData<T>);
@@ -1611,7 +1611,7 @@ pub trait SerializeTuple {
///
/// # Example use
///
/// ```rust
/// ```edition2018
/// use serde::ser::{Serialize, SerializeTupleStruct, Serializer};
///
/// struct Rgb(u8, u8, u8);
@@ -1656,7 +1656,7 @@ pub trait SerializeTupleStruct {
///
/// # Example use
///
/// ```rust
/// ```edition2018
/// use serde::ser::{Serialize, SerializeTupleVariant, Serializer};
///
/// enum E {
@@ -1714,7 +1714,7 @@ pub trait SerializeTupleVariant {
///
/// # Example use
///
/// ```rust
/// ```edition2018
/// # use std::marker::PhantomData;
/// #
/// # struct HashMap<K, V>(PhantomData<K>, PhantomData<V>);
@@ -1825,7 +1825,7 @@ pub trait SerializeMap {
///
/// # Example use
///
/// ```rust
/// ```edition2018
/// use serde::ser::{Serialize, SerializeStruct, Serializer};
///
/// struct Rgb {
@@ -1885,7 +1885,7 @@ pub trait SerializeStruct {
///
/// # Example use
///
/// ```rust
/// ```edition2018
/// use serde::ser::{Serialize, SerializeStructVariant, Serializer};
///
/// enum E {