Skip to content

Commit 8cf2e9a

Browse files
committed
Merge pull request #16 from drewcrawford/master
Fix build errors and some warnings
2 parents b48b0c5 + 8026a1a commit 8cf2e9a

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/lazy_static.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ macro_rules! lazy_static {
9393
static mut __static: *const $T = 0 as *const $T;
9494
static mut __ONCE: Once = ONCE_INIT;
9595
__ONCE.call_once(|| {
96-
__static = transmute::<Box<$T>, *const $T>(box() ($e));
96+
__static = transmute::<Box<$T>, *const $T>(Box::new(($e)));
9797
});
9898
let static_ref = &*__static;
9999
require_sync(static_ref);
@@ -108,13 +108,15 @@ macro_rules! lazy_static {
108108
#[allow(non_camel_case_types)]
109109
#[allow(dead_code)]
110110
pub struct $N {__private_field: ()}
111+
#[allow(dead_code)]
111112
pub static $N: $N = $N {__private_field: ()};
112113
};
113114
(MAKE TY PRIV $N:ident) => {
114115
#[allow(missing_copy_implementations)]
115116
#[allow(non_camel_case_types)]
116117
#[allow(dead_code)]
117118
struct $N {__private_field: ()}
119+
#[allow(dead_code)]
118120
static $N: $N = $N {__private_field: ()};
119121
};
120122
() => ()

tests/test.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#![allow(unstable)]
2-
31
#[macro_use]
42
extern crate lazy_static;
53
use std::collections::HashMap;
@@ -25,11 +23,11 @@ fn times_two(n: u32) -> u32 {
2523

2624
#[test]
2725
fn test_basic() {
28-
assert_eq!(STRING.as_slice(), "hello");
26+
assert_eq!(&STRING[..], "hello");
2927
assert_eq!(*NUMBER, 6);
3028
assert!(HASHMAP.get(&1).is_some());
3129
assert!(HASHMAP.get(&3).is_none());
32-
assert_eq!(ARRAY_BOXES.as_slice(), [Box::new(1), Box::new(2), Box::new(3)].as_slice());
30+
assert_eq!(&ARRAY_BOXES[..], &[Box::new(1), Box::new(2), Box::new(3)][..]);
3331
}
3432

3533
#[test]

0 commit comments

Comments
 (0)