Skip to content

Commit a717448

Browse files
committed
Merge branch 'lazystatic'
2 parents cb481ba + becda2e commit a717448

File tree

8 files changed

+19
-39
lines changed

8 files changed

+19
-39
lines changed

src/rust/Cargo.lock

Lines changed: 0 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/rust/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ resolver = "2"
2929
[workspace.dependencies]
3030
bitcoin = { version = "0.32.2", default-features = false }
3131
hex = { version = "0.4", default-features = false, features = ["alloc"] }
32-
lazy_static = { version = "1.4.0" }
3332
num-bigint = { version = "0.4.3", default-features = false }
3433
sha2 = { version = "0.10.8", default-features = false }
3534
sha3 = { version = "0.10.8", default-features = false }

src/rust/bitbox02-rust/Cargo.toml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ blake2 = { version = "0.10.6", default-features = false, features = ["size_opt"]
4646
minicbor = { version = "0.24.0", default-features = false, features = ["alloc"], optional = true }
4747
crc = { version = "3.0.1", optional = true }
4848
ed25519-dalek = { version = "2.1.1", default-features = false, features = ["hazmat", "digest"], optional = true }
49-
lazy_static = { workspace = true, optional = true }
5049
hmac = { version = "0.12.1", default-features = false, features = ["reset"] }
5150

5251
miniscript = { version = "12.0.0", default-features = false, features = ["no-std"], optional = true }
@@ -110,9 +109,6 @@ app-cardano = [
110109
]
111110

112111
testing = [
113-
# enable these deps
114-
"lazy_static",
115-
116112
# enable these features
117113
"bitbox02/testing"
118114
]

src/rust/bitbox02-rust/src/hww.rs

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -51,20 +51,17 @@ pub struct SafeData<T>(T);
5151
unsafe impl<T> Sync for SafeData<T> {}
5252

5353
#[cfg(feature = "testing")]
54-
lazy_static! {
55-
pub static ref MOCK_NEXT_REQUEST: SafeData<
56-
core::cell::RefCell<
57-
Option<
58-
alloc::boxed::Box<
59-
dyn Fn(
60-
crate::pb::response::Response,
61-
)
62-
-> Result<crate::pb::request::Request, api::error::Error>,
63-
>,
54+
pub static MOCK_NEXT_REQUEST: SafeData<
55+
core::cell::RefCell<
56+
Option<
57+
alloc::boxed::Box<
58+
dyn Fn(
59+
crate::pb::response::Response,
60+
) -> Result<crate::pb::request::Request, api::error::Error>,
6461
>,
6562
>,
66-
> = SafeData(core::cell::RefCell::new(None));
67-
}
63+
>,
64+
> = SafeData(core::cell::RefCell::new(None));
6865

6966
/// Set `MOCK_NEXT_REQUEST` to mock requests from the host.
7067
#[cfg(feature = "testing")]

src/rust/bitbox02-rust/src/lib.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,6 @@ mod xpubcache;
4343
#[macro_use]
4444
extern crate alloc;
4545

46-
#[cfg(feature = "testing")]
47-
#[macro_use]
48-
extern crate lazy_static;
49-
5046
#[cfg(test)]
5147
mod test {
5248
use super::*;

src/rust/bitbox02/Cargo.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,10 @@ license = "Apache-2.0"
2525
bitbox02-sys = {path="../bitbox02-sys"}
2626
util = {path = "../util"}
2727
zeroize = { workspace = true }
28-
lazy_static = { workspace = true, optional = true }
2928

3029
[features]
3130
# Only to be enabled in unit tests.
32-
testing = ["lazy_static"]
31+
testing = []
3332
# Active when the Rust code is compiled to be linked into the C unit tests and simulator.
3433
c-unit-testing = []
3534

src/rust/bitbox02/src/lib.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,6 @@ extern crate alloc;
3030

3131
use alloc::string::String;
3232

33-
#[cfg(feature = "testing")]
34-
#[macro_use]
35-
extern crate lazy_static;
36-
3733
#[cfg(feature = "testing")]
3834
pub mod testing;
3935

src/rust/bitbox02/src/testing.rs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2020 Shift Crypto AG
1+
// Copyright 2020-2024 Shift Crypto AG
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.
@@ -37,9 +37,14 @@ pub struct SafeData(pub RefCell<Data>);
3737
// Safety: must not be accessed concurrently.
3838
unsafe impl Sync for SafeData {}
3939

40-
lazy_static! {
41-
pub static ref DATA: SafeData = SafeData(RefCell::new(Default::default()));
42-
}
40+
pub static DATA: SafeData = SafeData(RefCell::new(Data {
41+
ui_confirm_create: None,
42+
sdcard_inserted: None,
43+
ui_sdcard_create_arg: None,
44+
ui_transaction_address_create: None,
45+
ui_transaction_fee_create: None,
46+
ui_trinary_input_string_create: None,
47+
}));
4348

4449
/// Provide mock implementations and data. This also locks the keystore - use `mock_unlocked()` to mock a seeded and unlocked keystore.
4550
pub fn mock(data: Data) {

0 commit comments

Comments
 (0)