Skip to content

Commit

Permalink
libterm: use #[deriving(Copy)]
Browse files Browse the repository at this point in the history
  • Loading branch information
Jorge Aparicio committed Dec 19, 2014
1 parent 86f8c12 commit 64234b3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 14 deletions.
4 changes: 1 addition & 3 deletions src/libterm/lib.rs
Expand Up @@ -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,
Expand All @@ -194,8 +194,6 @@ pub mod 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
Expand Down
15 changes: 4 additions & 11 deletions src/libterm/terminfo/parm.rs
Expand Up @@ -16,7 +16,7 @@ use self::FormatState::*;
use self::FormatOp::*;
use std::mem::replace;

#[deriving(PartialEq)]
#[deriving(Copy, PartialEq)]
enum States {
Nothing,
Percent,
Expand All @@ -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)]
Expand Down Expand Up @@ -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,
Expand All @@ -456,15 +452,14 @@ struct Flags {
space: bool
}

impl Copy for Flags {}

impl Flags {
fn new() -> Flags {
Flags{ width: 0, precision: 0, alternate: false,
left: false, sign: false, space: false }
}
}

#[deriving(Copy)]
enum FormatOp {
FormatDigit,
FormatOctal,
Expand All @@ -473,8 +468,6 @@ enum FormatOp {
FormatString
}

impl Copy for FormatOp {}

impl FormatOp {
fn from_char(c: char) -> FormatOp {
match c {
Expand Down

0 comments on commit 64234b3

Please sign in to comment.