Skip to content

Commit 0b6a2ed

Browse files
committed
Run cargo fmt and add getrandom as dev dependency
1 parent 1f39c26 commit 0b6a2ed

File tree

3 files changed

+8
-10
lines changed

3 files changed

+8
-10
lines changed

Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ serde_json = "1"
4141

4242
[target.'cfg(target_arch = "wasm32")'.dev-dependencies]
4343
criterion = { version = "0.5", default-features = false }
44+
getrandom = { version = "0.2", features = ["js"] }
4445
wasm-bindgen-test = "0.3"
4546

4647
[features]

src/lib.rs

+2-6
Original file line numberDiff line numberDiff line change
@@ -69,13 +69,9 @@ where
6969
extern "C" {
7070
fn unix_time_milliseconds_imported() -> u64;
7171
}
72-
let start_time = unsafe {
73-
unix_time_milliseconds_imported()
74-
};
72+
let start_time = unsafe { unix_time_milliseconds_imported() };
7573
let result = f();
76-
let end_time = unsafe {
77-
unix_time_milliseconds_imported()
78-
};
74+
let end_time = unsafe { unix_time_milliseconds_imported() };
7975

8076
let duration = std::time::Duration::from_millis(end_time - start_time);
8177
(result, duration)

src/scoring.rs

+5-4
Original file line numberDiff line numberDiff line change
@@ -92,12 +92,13 @@ lazy_static! {
9292
extern "C" {
9393
fn unix_time_milliseconds_imported() -> u64;
9494
}
95-
let unix_millis = unsafe {
96-
unix_time_milliseconds_imported()
97-
};
95+
let unix_millis = unsafe { unix_time_milliseconds_imported() };
9896

9997
use chrono::Datelike;
100-
chrono::DateTime::<chrono::Utc>::from(std::time::SystemTime::UNIX_EPOCH + std::time::Duration::from_millis(unix_millis)).year()
98+
chrono::DateTime::<chrono::Utc>::from(
99+
std::time::SystemTime::UNIX_EPOCH + std::time::Duration::from_millis(unix_millis),
100+
)
101+
.year()
101102
};
102103
}
103104

0 commit comments

Comments
 (0)