Skip to content

Commit 63b6be8

Browse files
committed
cargo fmt
1 parent e389675 commit 63b6be8

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
[package]
2+
name = "lazy-init"
23
authors = ["Kyle Huey <[email protected]>"]
34
description = "Lazy initialization."
45
keywords = ["lazy", "initialization"]
56
license = "Apache-2.0/MIT"
6-
name = "lazy-init"
77
repository = "https://github.com/khuey/lazy-init"
88
version = "0.1.0"
99

src/lib.rs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ impl<T, U> LazyTransform<T, U> {
103103
}
104104
}
105105

106-
unsafe impl<T, U> Sync for LazyTransform<T, U> { }
106+
unsafe impl<T, U> Sync for LazyTransform<T, U> {}
107107

108108
/// `Lazy<T>` is a lazily initialized synchronized holder type. You can think
109109
/// of it as a LazyTransform where the initial type doesn't exist.
@@ -114,9 +114,7 @@ pub struct Lazy<T> {
114114
impl<T> Lazy<T> {
115115
/// Construct a new, uninitialized `Lazy<T>`.
116116
pub fn new() -> Lazy<T> {
117-
Lazy {
118-
inner: LazyTransform::new(()),
119-
}
117+
Lazy { inner: LazyTransform::new(()) }
120118
}
121119

122120
/// Get a reference to the contained value, invoking `f` to create it
@@ -129,9 +127,7 @@ impl<T> Lazy<T> {
129127
pub fn get_or_create<'a, F>(&'a self, f: F) -> &'a T
130128
where F: FnOnce() -> T
131129
{
132-
self.inner.get_or_create(|_| {
133-
f()
134-
})
130+
self.inner.get_or_create(|_| f())
135131
}
136132

137133
/// Get a reference to the contained value, returning `Some(ref)` if the

0 commit comments

Comments
 (0)