From 64234b3541e032302206056e075d500eacec5f35 Mon Sep 17 00:00:00 2001 From: Jorge Aparicio Date: Sun, 14 Dec 2014 23:33:35 -0500 Subject: [PATCH] libterm: use `#[deriving(Copy)]` --- src/libterm/lib.rs | 4 +--- src/libterm/terminfo/parm.rs | 15 ++++----------- 2 files changed, 5 insertions(+), 14 deletions(-) diff --git a/src/libterm/lib.rs b/src/libterm/lib.rs index e8824b1ad2c..a4ebcfe8a56 100644 --- a/src/libterm/lib.rs +++ b/src/libterm/lib.rs @@ -165,13 +165,13 @@ pub mod color { /// Terminal attributes pub mod attr { pub use self::Attr::*; - use std::kinds::Copy; /// Terminal attributes for use with term.attr(). /// /// 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. /// Color is also represented as an attribute for convenience. + #[deriving(Copy)] pub enum Attr { /// Bold (or possibly bright) mode Bold, @@ -194,8 +194,6 @@ pub enum Attr { /// Convenience attribute to set the background color BackgroundColor(super::color::Color) } - - impl Copy for Attr {} } /// A terminal with similar capabilities to an ANSI Terminal diff --git a/src/libterm/terminfo/parm.rs b/src/libterm/terminfo/parm.rs index c81bff6a1ae..4ecbc54c590 100644 --- a/src/libterm/terminfo/parm.rs +++ b/src/libterm/terminfo/parm.rs @@ -16,7 +16,7 @@ use self::FormatOp::*; use std::mem::replace; -#[deriving(PartialEq)] +#[deriving(Copy, PartialEq)] enum States { Nothing, Percent, @@ -33,17 +33,13 @@ enum States { SeekIfEndPercent(int) } -impl Copy for States {} - -#[deriving(PartialEq)] +#[deriving(Copy, PartialEq)] enum FormatState { FormatStateFlags, FormatStateWidth, FormatStatePrecision } -impl Copy for FormatState {} - /// Types of parameters a capability can use #[allow(missing_docs)] #[deriving(Clone)] @@ -446,7 +442,7 @@ pub fn expand(cap: &[u8], params: &[Param], vars: &mut Variables) Ok(output) } -#[deriving(PartialEq)] +#[deriving(Copy, PartialEq)] struct Flags { width: uint, precision: uint, @@ -456,8 +452,6 @@ struct Flags { space: bool } -impl Copy for Flags {} - impl Flags { fn new() -> Flags { Flags{ width: 0, precision: 0, alternate: false, @@ -465,6 +459,7 @@ fn new() -> Flags { } } +#[deriving(Copy)] enum FormatOp { FormatDigit, FormatOctal, @@ -473,8 +468,6 @@ enum FormatOp { FormatString } -impl Copy for FormatOp {} - impl FormatOp { fn from_char(c: char) -> FormatOp { match c { -- GitLab