diff options
| author | Jorge Aparicio <japaricious@gmail.com> | 2014-12-14 22:35:22 -0500 |
|---|---|---|
| committer | Jorge Aparicio <japaricious@gmail.com> | 2014-12-19 10:43:23 -0500 |
| commit | 30cefcbdfde6ff12c550914fede8180344d54857 (patch) | |
| tree | a4f3d842e7003034b703dda751aceda67287e22b /src/libcore/fmt | |
| parent | c32a48293aab01133ed9e131fe452fd8c88ff9de (diff) | |
| download | rust-30cefcbdfde6ff12c550914fede8180344d54857.tar.gz rust-30cefcbdfde6ff12c550914fede8180344d54857.zip | |
libcore: use `#[deriving(Copy)]`
Diffstat (limited to 'src/libcore/fmt')
| -rw-r--r-- | src/libcore/fmt/mod.rs | 6 | ||||
| -rw-r--r-- | src/libcore/fmt/num.rs | 8 | ||||
| -rw-r--r-- | src/libcore/fmt/rt.rs | 20 |
3 files changed, 10 insertions, 24 deletions
diff --git a/src/libcore/fmt/mod.rs b/src/libcore/fmt/mod.rs index cc940cd9e20..79fb11f3854 100644 --- a/src/libcore/fmt/mod.rs +++ b/src/libcore/fmt/mod.rs @@ -44,10 +44,9 @@ pub type Result = result::Result<(), Error>; /// occurred. Any extra information must be arranged to be transmitted through /// some other means. #[experimental = "core and I/O reconciliation may alter this definition"] +#[deriving(Copy)] pub struct Error; -impl Copy for Error {} - /// A collection of methods that are required to format a message into a stream. /// /// This trait is the type which this modules requires when formatting @@ -104,6 +103,7 @@ enum Void {} /// compile time it is ensured that the function and the value have the correct /// types, and then this struct is used to canonicalize arguments to one type. #[experimental = "implementation detail of the `format_args!` macro"] +#[deriving(Copy)] pub struct Argument<'a> { value: &'a Void, formatter: fn(&Void, &mut Formatter) -> Result, @@ -137,8 +137,6 @@ impl<'a> Argument<'a> { } } -impl<'a> Copy for Argument<'a> {} - impl<'a> Arguments<'a> { /// When using the format_args!() macro, this function is used to generate the /// Arguments structure. diff --git a/src/libcore/fmt/num.rs b/src/libcore/fmt/num.rs index 13cfcacf8da..cd8f226172a 100644 --- a/src/libcore/fmt/num.rs +++ b/src/libcore/fmt/num.rs @@ -16,7 +16,6 @@ use fmt; use iter::DoubleEndedIteratorExt; -use kinds::Copy; use num::{Int, cast}; use slice::SliceExt; @@ -109,14 +108,12 @@ radix! { UpperHex, 16, "0x", x @ 0 ... 9 => b'0' + x, x @ 10 ... 15 => b'A' + (x - 10) } /// A radix with in the range of `2..36`. -#[deriving(Clone, PartialEq)] +#[deriving(Clone, Copy, PartialEq)] #[unstable = "may be renamed or move to a different module"] pub struct Radix { base: u8, } -impl Copy for Radix {} - impl Radix { fn new(base: u8) -> Radix { assert!(2 <= base && base <= 36, "the base must be in the range of 2..36: {}", base); @@ -137,10 +134,9 @@ impl GenericRadix for Radix { /// A helper type for formatting radixes. #[unstable = "may be renamed or move to a different module"] +#[deriving(Copy)] pub struct RadixFmt<T, R>(T, R); -impl<T,R> Copy for RadixFmt<T,R> where T: Copy, R: Copy {} - /// Constructs a radix formatter in the range of `2..36`. /// /// # Example diff --git a/src/libcore/fmt/rt.rs b/src/libcore/fmt/rt.rs index 748bd0bc4bd..35dd0390f30 100644 --- a/src/libcore/fmt/rt.rs +++ b/src/libcore/fmt/rt.rs @@ -20,17 +20,16 @@ pub use self::Alignment::*; pub use self::Count::*; pub use self::Position::*; pub use self::Flag::*; -use kinds::Copy; #[doc(hidden)] +#[deriving(Copy)] pub struct Argument<'a> { pub position: Position, pub format: FormatSpec, } -impl<'a> Copy for Argument<'a> {} - #[doc(hidden)] +#[deriving(Copy)] pub struct FormatSpec { pub fill: char, pub align: Alignment, @@ -39,10 +38,8 @@ pub struct FormatSpec { pub width: Count, } -impl Copy for FormatSpec {} - /// Possible alignments that can be requested as part of a formatting directive. -#[deriving(PartialEq)] +#[deriving(Copy, PartialEq)] pub enum Alignment { /// Indication that contents should be left-aligned. AlignLeft, @@ -54,27 +51,24 @@ pub enum Alignment { AlignUnknown, } -impl Copy for Alignment {} - #[doc(hidden)] +#[deriving(Copy)] pub enum Count { CountIs(uint), CountIsParam(uint), CountIsNextParam, CountImplied, } -impl Copy for Count {} - #[doc(hidden)] +#[deriving(Copy)] pub enum Position { ArgumentNext, ArgumentIs(uint) } -impl Copy for Position {} - /// Flags which can be passed to formatting via a directive. /// /// These flags are discovered through the `flags` field of the `Formatter` /// structure. The flag in that structure is a union of these flags into a /// `uint` where each flag's discriminant is the corresponding bit. +#[deriving(Copy)] pub enum Flag { /// A flag which enables number formatting to always print the sign of a /// number. @@ -89,5 +83,3 @@ pub enum Flag { /// being aware of the sign to be printed. FlagSignAwareZeroPad, } - -impl Copy for Flag {} |
