Skip to content

Commit 1584ea6

Browse files
committed
Fix alpha breakage
1 parent bf7a4cb commit 1584ea6

File tree

3 files changed

+24
-22
lines changed

3 files changed

+24
-22
lines changed

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -60,18 +60,18 @@ extern crate lazy_static;
6060
use std::collections::HashMap;
6161

6262
lazy_static! {
63-
static ref HASHMAP: HashMap<uint, &'static str> = {
63+
static ref HASHMAP: HashMap<u32, &'static str> = {
6464
let mut m = HashMap::new();
65-
m.insert(0u, "foo");
66-
m.insert(1u, "bar");
67-
m.insert(2u, "baz");
65+
m.insert(0, "foo");
66+
m.insert(1, "bar");
67+
m.insert(2, "baz");
6868
m
6969
};
70-
static ref COUNT: uint = HASHMAP.len();
71-
static ref NUMBER: uint = times_two(21);
70+
static ref COUNT: usize = HASHMAP.len();
71+
static ref NUMBER: u32 = times_two(21);
7272
}
7373

74-
fn times_two(n: uint) -> uint { n * 2 }
74+
fn times_two(n: u32) -> u32 { n * 2 }
7575

7676
fn main() {
7777
println!("The map has {} entries.", *COUNT);

src/lazy_static.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,18 +39,18 @@ extern crate lazy_static;
3939
use std::collections::HashMap;
4040
4141
lazy_static! {
42-
static ref HASHMAP: HashMap<uint, &'static str> = {
42+
static ref HASHMAP: HashMap<u32, &'static str> = {
4343
let mut m = HashMap::new();
44-
m.insert(0u, "foo");
45-
m.insert(1u, "bar");
46-
m.insert(2u, "baz");
44+
m.insert(0, "foo");
45+
m.insert(1, "bar");
46+
m.insert(2, "baz");
4747
m
4848
};
49-
static ref COUNT: uint = HASHMAP.len();
50-
static ref NUMBER: uint = times_two(21);
49+
static ref COUNT: usize = HASHMAP.len();
50+
static ref NUMBER: u32 = times_two(21);
5151
}
5252
53-
fn times_two(n: uint) -> uint { n * 2 }
53+
fn times_two(n: u32) -> u32 { n * 2 }
5454
5555
fn main() {
5656
println!("The map has {} entries.", *COUNT);

tests/test.rs

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
1+
#![allow(unstable)]
2+
13
#[macro_use]
24
extern crate lazy_static;
35
use std::collections::HashMap;
46

57
lazy_static! {
6-
static ref NUMBER: uint = times_two(3);
7-
static ref ARRAY_BOXES: [Box<uint>; 3] = [box 1, box 2, box 3];
8+
static ref NUMBER: u32 = times_two(3);
9+
static ref ARRAY_BOXES: [Box<u32>; 3] = [Box::new(1), Box::new(2), Box::new(3)];
810
static ref STRING: String = "hello".to_string();
9-
static ref HASHMAP: HashMap<uint, &'static str> = {
11+
static ref HASHMAP: HashMap<u32, &'static str> = {
1012
let mut m = HashMap::new();
11-
m.insert(0u, "abc");
13+
m.insert(0, "abc");
1214
m.insert(1, "def");
1315
m.insert(2, "ghi");
1416
m
@@ -17,7 +19,7 @@ lazy_static! {
1719
static ref UNUSED: () = ();
1820
}
1921

20-
fn times_two(n: uint) -> uint {
22+
fn times_two(n: u32) -> u32 {
2123
n * 2
2224
}
2325

@@ -27,7 +29,7 @@ fn test_basic() {
2729
assert_eq!(*NUMBER, 6);
2830
assert!(HASHMAP.get(&1).is_some());
2931
assert!(HASHMAP.get(&3).is_none());
30-
assert_eq!(ARRAY_BOXES.as_slice(), [box 1, box 2, box 3].as_slice());
32+
assert_eq!(ARRAY_BOXES.as_slice(), [Box::new(1), Box::new(2), Box::new(3)].as_slice());
3133
}
3234

3335
#[test]
@@ -39,11 +41,11 @@ fn test_repeat() {
3941

4042
mod visibility {
4143
lazy_static! {
42-
pub static ref FOO: Box<uint> = box 0u;
44+
pub static ref FOO: Box<u32> = Box::new(0);
4345
}
4446
}
4547

4648
#[test]
4749
fn test_visibility() {
48-
assert_eq!(*visibility::FOO, box 0u);
50+
assert_eq!(*visibility::FOO, Box::new(0));
4951
}

0 commit comments

Comments
 (0)