libterm: use #[deriving(Copy)]

This commit is contained in:
Jorge Aparicio 2014-12-14 23:33:35 -05:00
parent 86f8c127dd
commit 64234b3541
2 changed files with 5 additions and 14 deletions

View file

@ -165,13 +165,13 @@ pub mod color {
/// Terminal attributes /// Terminal attributes
pub mod attr { pub mod attr {
pub use self::Attr::*; pub use self::Attr::*;
use std::kinds::Copy;
/// Terminal attributes for use with term.attr(). /// Terminal attributes for use with term.attr().
/// ///
/// Most attributes can only be turned on and must be turned off with term.reset(). /// Most attributes can only be turned on and must be turned off with term.reset().
/// The ones that can be turned off explicitly take a boolean value. /// The ones that can be turned off explicitly take a boolean value.
/// Color is also represented as an attribute for convenience. /// Color is also represented as an attribute for convenience.
#[deriving(Copy)]
pub enum Attr { pub enum Attr {
/// Bold (or possibly bright) mode /// Bold (or possibly bright) mode
Bold, Bold,
@ -194,8 +194,6 @@ pub mod attr {
/// Convenience attribute to set the background color /// Convenience attribute to set the background color
BackgroundColor(super::color::Color) BackgroundColor(super::color::Color)
} }
impl Copy for Attr {}
} }
/// A terminal with similar capabilities to an ANSI Terminal /// A terminal with similar capabilities to an ANSI Terminal

View file

@ -16,7 +16,7 @@ use self::FormatState::*;
use self::FormatOp::*; use self::FormatOp::*;
use std::mem::replace; use std::mem::replace;
#[deriving(PartialEq)] #[deriving(Copy, PartialEq)]
enum States { enum States {
Nothing, Nothing,
Percent, Percent,
@ -33,17 +33,13 @@ enum States {
SeekIfEndPercent(int) SeekIfEndPercent(int)
} }
impl Copy for States {} #[deriving(Copy, PartialEq)]
#[deriving(PartialEq)]
enum FormatState { enum FormatState {
FormatStateFlags, FormatStateFlags,
FormatStateWidth, FormatStateWidth,
FormatStatePrecision FormatStatePrecision
} }
impl Copy for FormatState {}
/// Types of parameters a capability can use /// Types of parameters a capability can use
#[allow(missing_docs)] #[allow(missing_docs)]
#[deriving(Clone)] #[deriving(Clone)]
@ -446,7 +442,7 @@ pub fn expand(cap: &[u8], params: &[Param], vars: &mut Variables)
Ok(output) Ok(output)
} }
#[deriving(PartialEq)] #[deriving(Copy, PartialEq)]
struct Flags { struct Flags {
width: uint, width: uint,
precision: uint, precision: uint,
@ -456,8 +452,6 @@ struct Flags {
space: bool space: bool
} }
impl Copy for Flags {}
impl Flags { impl Flags {
fn new() -> Flags { fn new() -> Flags {
Flags{ width: 0, precision: 0, alternate: false, Flags{ width: 0, precision: 0, alternate: false,
@ -465,6 +459,7 @@ impl Flags {
} }
} }
#[deriving(Copy)]
enum FormatOp { enum FormatOp {
FormatDigit, FormatDigit,
FormatOctal, FormatOctal,
@ -473,8 +468,6 @@ enum FormatOp {
FormatString FormatString
} }
impl Copy for FormatOp {}
impl FormatOp { impl FormatOp {
fn from_char(c: char) -> FormatOp { fn from_char(c: char) -> FormatOp {
match c { match c {