Skip to content

Commit

Permalink
libtime: 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 ce92437 commit 4c6e76b
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions src/libtime/lib.rs
Expand Up @@ -76,14 +76,12 @@ mod imp {
}

/// A record specifying a time value in seconds and nanoseconds.
#[deriving(Clone, PartialEq, Eq, PartialOrd, Ord, Encodable, Decodable, Show)]
#[deriving(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Encodable, Decodable, Show)]
pub struct Timespec {
pub sec: i64,
pub nsec: i32,
}

impl Copy for Timespec {}

/*
* Timespec assumes that pre-epoch Timespecs have negative sec and positive
* nsec fields. Darwin's and Linux's struct timespec functions handle pre-
Expand Down Expand Up @@ -268,7 +266,7 @@ pub fn tzset() {
/// also called a broken-down time value.
// FIXME: use c_int instead of i32?
#[repr(C)]
#[deriving(Clone, PartialEq, Eq, Show)]
#[deriving(Clone, Copy, PartialEq, Eq, Show)]
pub struct Tm {
/// Seconds after the minute - [0, 60]
pub tm_sec: i32,
Expand Down Expand Up @@ -309,8 +307,6 @@ pub struct Tm {
pub tm_nsec: i32,
}

impl Copy for Tm {}

pub fn empty_tm() -> Tm {
Tm {
tm_sec: 0_i32,
Expand Down Expand Up @@ -452,7 +448,7 @@ impl Tm {
}
}

#[deriving(PartialEq)]
#[deriving(Copy, PartialEq)]
pub enum ParseError {
InvalidSecond,
InvalidMinute,
Expand All @@ -470,8 +466,6 @@ pub enum ParseError {
UnexpectedCharacter(char, char),
}

impl Copy for ParseError {}

impl Show for ParseError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match *self {
Expand Down

0 comments on commit 4c6e76b

Please sign in to comment.