diff options
| author | bors <bors@rust-lang.org> | 2015-01-04 04:50:56 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2015-01-04 04:50:56 +0000 |
| commit | 470118f3e915cdc8f936aca0640b28a7a3d8dc6c (patch) | |
| tree | 47f99908d999aa612a4cd44932dcdc3b3a1a966a /src/libserialize | |
| parent | c6c786671d692d7b13c2e5c68a53001327b4b125 (diff) | |
| parent | 351409a62287c7993bc680d9dfcfa13cba9c9c0c (diff) | |
| download | rust-470118f3e915cdc8f936aca0640b28a7a3d8dc6c.tar.gz rust-470118f3e915cdc8f936aca0640b28a7a3d8dc6c.zip | |
auto merge of #20504 : japaric/rust/derive-self, r=alexcrichton
I put the sed scripts in the commits, in case this needs a "rebase".
Diffstat (limited to 'src/libserialize')
| -rw-r--r-- | src/libserialize/base64.rs | 8 | ||||
| -rw-r--r-- | src/libserialize/hex.rs | 2 | ||||
| -rw-r--r-- | src/libserialize/json.rs | 42 |
3 files changed, 26 insertions, 26 deletions
diff --git a/src/libserialize/base64.rs b/src/libserialize/base64.rs index 54b390e0c3f..52d5a1a3af5 100644 --- a/src/libserialize/base64.rs +++ b/src/libserialize/base64.rs @@ -19,7 +19,7 @@ use std::fmt; use std::error; /// Available encoding character sets -#[deriving(Copy)] +#[derive(Copy)] pub enum CharacterSet { /// The standard character set (uses `+` and `/`) Standard, @@ -28,7 +28,7 @@ pub enum CharacterSet { } /// Available newline types -#[deriving(Copy)] +#[derive(Copy)] pub enum Newline { /// A linefeed (i.e. Unix-style newline) LF, @@ -37,7 +37,7 @@ pub enum Newline { } /// Contains configuration parameters for `to_base64`. -#[deriving(Copy)] +#[derive(Copy)] pub struct Config { /// Character set to use pub char_set: CharacterSet, @@ -177,7 +177,7 @@ pub trait FromBase64 for Sized? { } /// Errors that can occur when decoding a base64 encoded string -#[deriving(Copy)] +#[derive(Copy)] pub enum FromBase64Error { /// The input contained a character not part of the base64 format InvalidBase64Byte(u8, uint), diff --git a/src/libserialize/hex.rs b/src/libserialize/hex.rs index 977a31c240b..c915ddaaa9c 100644 --- a/src/libserialize/hex.rs +++ b/src/libserialize/hex.rs @@ -61,7 +61,7 @@ pub trait FromHex for Sized? { } /// Errors that can occur when decoding a hex encoded string -#[deriving(Copy)] +#[derive(Copy)] pub enum FromHexError { /// The input contained a character not part of the hex format InvalidHexCharacter(char, uint), diff --git a/src/libserialize/json.rs b/src/libserialize/json.rs index 71117c7fe12..73f986a97ef 100644 --- a/src/libserialize/json.rs +++ b/src/libserialize/json.rs @@ -60,7 +60,7 @@ //! To be able to encode a piece of data, it must implement the `serialize::RustcEncodable` trait. //! To be able to decode a piece of data, it must implement the `serialize::RustcDecodable` trait. //! The Rust compiler provides an annotation to automatically generate the code for these traits: -//! `#[deriving(RustcDecodable, RustcEncodable)]` +//! `#[derive(RustcDecodable, RustcEncodable)]` //! //! The JSON API provides an enum `json::Json` and a trait `ToJson` to encode objects. //! The `ToJson` trait provides a `to_json` method to convert an object into a `json::Json` value. @@ -82,7 +82,7 @@ //! use serialize::json; //! //! // Automatically generate `Decodable` and `Encodable` trait implementations -//! #[deriving(RustcDecodable, RustcEncodable)] +//! #[derive(RustcDecodable, RustcEncodable)] //! pub struct TestStruct { //! data_int: u8, //! data_str: String, @@ -114,7 +114,7 @@ //! ```notrust //! // FIXME(#19470): this cannot be ```rust``` because it fails orphan checking at the moment //! extern crate serialize; -//! use serialize::json::{mod, ToJson, Json}; +//! use serialize::json::{self, ToJson, Json}; //! //! // A custom data structure //! struct ComplexNum { @@ -130,7 +130,7 @@ //! } //! //! // Only generate `RustcEncodable` trait implementation -//! #[deriving(Encodable)] +//! #[derive(Encodable)] //! pub struct ComplexNumRecord { //! uid: u8, //! dsc: String, @@ -155,10 +155,10 @@ //! // FIXME(#19470): this cannot be ```rust``` because it fails orphan checking at the moment //! extern crate serialize; //! use std::collections::BTreeMap; -//! use serialize::json::{mod, Json, ToJson}; +//! use serialize::json::{self, Json, ToJson}; //! //! // Only generate `Decodable` trait implementation -//! #[deriving(Decodable)] +//! #[derive(Decodable)] //! pub struct TestStruct { //! data_int: u8, //! data_str: String, @@ -215,7 +215,7 @@ use unicode::str::Utf16Item; use Encodable; /// Represents a json value -#[deriving(Clone, PartialEq, PartialOrd)] +#[derive(Clone, PartialEq, PartialOrd)] pub enum Json { I64(i64), U64(u64), @@ -236,7 +236,7 @@ pub struct AsJson<'a, T: 'a> { inner: &'a T } pub struct AsPrettyJson<'a, T: 'a> { inner: &'a T, indent: Option<uint> } /// The errors that can arise while parsing a JSON stream. -#[deriving(Clone, Copy, PartialEq)] +#[derive(Clone, Copy, PartialEq)] pub enum ErrorCode { InvalidSyntax, InvalidNumber, @@ -257,7 +257,7 @@ pub enum ErrorCode { NotUtf8, } -#[deriving(Clone, Copy, PartialEq, Show)] +#[derive(Clone, Copy, PartialEq, Show)] pub enum ParserError { /// msg, line, col SyntaxError(ErrorCode, uint, uint), @@ -267,7 +267,7 @@ pub enum ParserError { // Builder and Parser have the same errors. pub type BuilderError = ParserError; -#[deriving(Clone, PartialEq, Show)] +#[derive(Clone, PartialEq, Show)] pub enum DecoderError { ParseError(ParserError), ExpectedError(string::String, string::String), @@ -1164,7 +1164,7 @@ impl ops::Index<uint> for Json { } /// The output of the streaming parser. -#[deriving(PartialEq, Clone, Show)] +#[derive(PartialEq, Clone, Show)] pub enum JsonEvent { ObjectStart, ObjectEnd, @@ -1179,7 +1179,7 @@ pub enum JsonEvent { Error(ParserError), } -#[deriving(PartialEq, Show)] +#[derive(PartialEq, Show)] enum ParserState { // Parse a value in an array, true means first element. ParseArray(bool), @@ -1208,7 +1208,7 @@ pub struct Stack { /// StackElements compose a Stack. /// For example, Key("foo"), Key("bar"), Index(3) and Key("x") are the /// StackElements compositing the stack that represents foo.bar[3].x -#[deriving(PartialEq, Clone, Show)] +#[derive(PartialEq, Clone, Show)] pub enum StackElement<'l> { Index(u32), Key(&'l str), @@ -1216,7 +1216,7 @@ pub enum StackElement<'l> { // Internally, Key elements are stored as indices in a buffer to avoid // allocating a string for every member of an object. -#[deriving(PartialEq, Clone, Show)] +#[derive(PartialEq, Clone, Show)] enum InternalStackElement { InternalIndex(u32), InternalKey(u16, u16), // start, size @@ -2534,7 +2534,7 @@ mod tests { use std::num::Float; use std::string; - #[deriving(RustcDecodable, Eq, PartialEq, Show)] + #[derive(RustcDecodable, Eq, PartialEq, Show)] struct OptionData { opt: Option<uint>, } @@ -2561,20 +2561,20 @@ mod tests { ExpectedError("Number".to_string(), "false".to_string())); } - #[deriving(PartialEq, RustcEncodable, RustcDecodable, Show)] + #[derive(PartialEq, RustcEncodable, RustcDecodable, Show)] enum Animal { Dog, Frog(string::String, int) } - #[deriving(PartialEq, RustcEncodable, RustcDecodable, Show)] + #[derive(PartialEq, RustcEncodable, RustcDecodable, Show)] struct Inner { a: (), b: uint, c: Vec<string::String>, } - #[deriving(PartialEq, RustcEncodable, RustcDecodable, Show)] + #[derive(PartialEq, RustcEncodable, RustcDecodable, Show)] struct Outer { inner: Vec<Inner>, } @@ -3093,7 +3093,7 @@ mod tests { ); } - #[deriving(RustcDecodable)] + #[derive(RustcDecodable)] struct FloatStruct { f: f64, a: Vec<f64> @@ -3142,7 +3142,7 @@ mod tests { Err(SyntaxError(EOFWhileParsingObject, 3u, 8u))); } - #[deriving(RustcDecodable)] + #[derive(RustcDecodable)] #[allow(dead_code)] struct DecodeStruct { x: f64, @@ -3150,7 +3150,7 @@ mod tests { z: string::String, w: Vec<DecodeStruct> } - #[deriving(RustcDecodable)] + #[derive(RustcDecodable)] enum DecodeEnum { A(f64), B(string::String) |
