Skip to content

Commit 53aa953

Browse files
authored
Merge pull request #130 from brunoczim/master
using the stable spin's once implementation
2 parents daf05aa + d2a2e8e commit 53aa953

File tree

5 files changed

+9
-11
lines changed

5 files changed

+9
-11
lines changed

.travis.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ matrix:
33
include:
44
- rust: 1.24.1
55
- rust: stable
6+
script:
7+
- cargo test
8+
- cargo test --features spin_no_std
69
- os: osx
710
- rust: beta
811
- rust: nightly

Cargo.toml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,17 @@ exclude = ["/.travis.yml", "/appveyor.yml"]
1717
build = "build.rs"
1818

1919
[dependencies.spin]
20-
version = "0.4.6"
20+
version = "0.4.10"
2121
optional = true
22+
default-features = false
23+
features = ["once"]
2224

2325
[build-dependencies]
2426
version_check = "0.1.4"
2527

2628
[features]
2729
nightly = []
28-
spin_no_std = ["nightly", "spin"]
30+
spin_no_std = ["spin"]
2931

3032
[badges]
3133
appveyor = { repository = "rust-lang-nursery/lazy-static.rs" }

src/core_lazy.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,7 @@ use self::spin::Once;
1212
pub struct Lazy<T: Sync>(Once<T>);
1313

1414
impl<T: Sync> Lazy<T> {
15-
#[inline(always)]
16-
pub const fn new() -> Self {
17-
Lazy(Once::new())
18-
}
15+
pub const INIT: Self = Lazy(Once::INIT);
1916

2017
#[inline(always)]
2118
pub fn get<F>(&'static self, builder: F) -> &T
@@ -29,6 +26,6 @@ impl<T: Sync> Lazy<T> {
2926
#[doc(hidden)]
3027
macro_rules! __lazy_static_create {
3128
($NAME:ident, $T:ty) => {
32-
static $NAME: $crate::lazy::Lazy<$T> = $crate::lazy::Lazy::new();
29+
static $NAME: $crate::lazy::Lazy<$T> = $crate::lazy::Lazy::INIT;
3330
}
3431
}

src/lib.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,6 @@ no guarantees can be made about them in regard to SemVer stability.
100100
101101
*/
102102

103-
// NOTE: see build.rs for where these cfg values are set.
104-
#![cfg_attr(lazy_static_spin_impl, feature(const_fn))]
105-
106103
#![doc(html_root_url = "https://docs.rs/lazy_static/1.1.0")]
107104
#![no_std]
108105

tests/no_std.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#![cfg(feature="spin_no_std")]
2-
#![feature(const_fn)]
32

43
#![no_std]
54

0 commit comments

Comments
 (0)