Skip to content

Commit 73ff351

Browse files
committed
static -> const, derive Clone
1 parent 624f1e2 commit 73ff351

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

datetime.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,12 @@ trait DateStr {
3333
fn from_str(ds: &str) -> Result<Self, ~str>;
3434
}
3535
*/
36-
static SECS_FROM_UNIX_EPOCH: i64 = 62135596800;
36+
const SECS_FROM_UNIX_EPOCH: i64 = 62135596800;
3737

3838
#[inline(always)]
3939
pub fn leapyear(y: i32) -> bool { y % 4 == 0 && (y % 100 != 0 || y % 400 == 0) }
4040

41-
static MONTH_LOOKUP_VEC: [i32; 365] = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
41+
const MONTH_LOOKUP_VEC: [i32; 365] = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
4242
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
4343
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
4444
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
@@ -57,23 +57,23 @@ pub fn month_lookup(doy: i32, ly: bool) -> i32 {
5757
MONTH_LOOKUP_VEC[(doy - xtra) as usize]
5858
}
5959

60-
static ACCUME_DAYS_VEC: [i32; 13] = [0, 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334];
60+
const ACCUME_DAYS_VEC: [i32; 13] = [0, 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334];
6161

6262
#[inline(always)]
6363
fn accume_days(m: i32, ly: bool) -> i32 {
6464
let xtra = (ly && m > 2) as i32;
6565
ACCUME_DAYS_VEC[m as usize] + xtra
6666
}
6767

68-
static MONTH_LENGTH_VEC: [i32; 13] = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
68+
const MONTH_LENGTH_VEC: [i32; 13] = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
6969

7070
#[inline(always)]
7171
pub fn month_length(m: i32, ly: bool) -> i32 {
7272
let xtra = (ly && m == 2) as i32;
7373
MONTH_LENGTH_VEC[m as usize] + xtra
7474
}
7575

76-
#[derive(Copy, Debug)]
76+
#[derive(Clone, Copy, Debug)]
7777
pub struct DateSpec { year: i32, mon: i32, mday: i32, yday: i32}
7878

7979
#[inline(always)]

0 commit comments

Comments
 (0)