Skip to content

Commit 4c6e76b

Browse files
author
Jorge Aparicio
committed
libtime: use #[deriving(Copy)]
1 parent ce92437 commit 4c6e76b

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

src/libtime/lib.rs

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -76,14 +76,12 @@ mod imp {
7676
}
7777

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

85-
impl Copy for Timespec {}
86-
8785
/*
8886
* Timespec assumes that pre-epoch Timespecs have negative sec and positive
8987
* nsec fields. Darwin's and Linux's struct timespec functions handle pre-
@@ -268,7 +266,7 @@ pub fn tzset() {
268266
/// also called a broken-down time value.
269267
// FIXME: use c_int instead of i32?
270268
#[repr(C)]
271-
#[deriving(Clone, PartialEq, Eq, Show)]
269+
#[deriving(Clone, Copy, PartialEq, Eq, Show)]
272270
pub struct Tm {
273271
/// Seconds after the minute - [0, 60]
274272
pub tm_sec: i32,
@@ -309,8 +307,6 @@ pub struct Tm {
309307
pub tm_nsec: i32,
310308
}
311309

312-
impl Copy for Tm {}
313-
314310
pub fn empty_tm() -> Tm {
315311
Tm {
316312
tm_sec: 0_i32,
@@ -452,7 +448,7 @@ impl Tm {
452448
}
453449
}
454450

455-
#[deriving(PartialEq)]
451+
#[deriving(Copy, PartialEq)]
456452
pub enum ParseError {
457453
InvalidSecond,
458454
InvalidMinute,
@@ -470,8 +466,6 @@ pub enum ParseError {
470466
UnexpectedCharacter(char, char),
471467
}
472468

473-
impl Copy for ParseError {}
474-
475469
impl Show for ParseError {
476470
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
477471
match *self {

0 commit comments

Comments
 (0)