Skip to content

Commit 2318826

Browse files
committed
rust: change imports to util::bb02_async
1 parent 44e6231 commit 2318826

26 files changed

+26
-30
lines changed

src/rust/bitbox02-rust-c/src/workflow.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ extern crate alloc;
2424

2525
use alloc::boxed::Box;
2626
use alloc::string::String;
27-
use bitbox02_rust::bb02_async::{Task, spin};
2827
use bitbox02_rust::workflow::confirm;
2928
use core::task::Poll;
29+
use util::bb02_async::{Task, spin};
3030

3131
enum TaskState<'a, O> {
3232
Nothing,

src/rust/bitbox02-rust/src/async_usb.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@
1515
//! This module provides the executor for tasks that are spawned with an API request and deliver a
1616
//! USB response. Terminology: host = computer, device = BitBox02.
1717
18-
use crate::bb02_async::{Task, option, spin as spin_task};
1918
use alloc::boxed::Box;
2019
use alloc::vec::Vec;
2120
use core::cell::RefCell;
2221
use core::task::Poll;
22+
use util::bb02_async::{Task, option, spin as spin_task};
2323

2424
type UsbOut = Vec<u8>;
2525
type UsbIn = Vec<u8>;

src/rust/bitbox02-rust/src/bb02_async.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,10 @@
1414

1515
use core::cell::RefCell;
1616

17-
#[cfg(feature = "testing")]
18-
pub use util::bb02_async::block_on;
19-
pub use util::bb02_async::{Task, option, spin};
20-
2117
/// Disables the screensaver while waiting for an option to contain a value. Afterwards, it returns that value
2218
pub async fn option_no_screensaver<O>(opt: &RefCell<Option<O>>) -> O {
2319
bitbox02::screen_saver::screen_saver_disable();
24-
let result = option(opt).await;
20+
let result = util::bb02_async::option(opt).await;
2521
bitbox02::screen_saver::screen_saver_enable();
2622
result
2723
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,10 +136,10 @@ mod tests {
136136
use super::*;
137137
extern crate std;
138138

139-
use crate::bb02_async::block_on;
140139
use crate::hal::testing::TestingHal;
141140
use crate::workflow::testing::Screen;
142141
use bitbox02::testing::mock_memory;
142+
use util::bb02_async::block_on;
143143

144144
use prost::Message;
145145

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,11 +162,11 @@ pub fn list(hal: &mut impl crate::hal::Hal) -> Result<Response, Error> {
162162
mod tests {
163163
use super::*;
164164

165-
use crate::bb02_async::block_on;
166165
use crate::hal::testing::TestingHal;
167166
use crate::workflow::testing::Screen;
168167
use alloc::boxed::Box;
169168
use bitbox02::testing::{mock_memory, mock_unlocked, mock_unlocked_using_mnemonic};
169+
use util::bb02_async::block_on;
170170

171171
/// Test backup creation on a uninitialized keystore.
172172
#[test]

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,6 @@ pub async fn process_api(
331331
mod tests {
332332
use super::*;
333333

334-
use crate::bb02_async::block_on;
335334
use crate::bip32::parse_xpub;
336335
use crate::hal::testing::TestingHal;
337336
use crate::workflow::testing::Screen;
@@ -341,6 +340,7 @@ mod tests {
341340
TEST_MNEMONIC, mock_memory, mock_unlocked, mock_unlocked_using_mnemonic,
342341
};
343342
use pb::btc_script_config::multisig::ScriptType as MultisigScriptType;
343+
use util::bb02_async::block_on;
344344
use util::bip32::HARDENED;
345345

346346
#[test]

src/rust/bitbox02-rust/src/hww/api/bitcoin/signmsg.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,11 +140,11 @@ pub async fn process(
140140
mod tests {
141141
use super::*;
142142

143-
use crate::bb02_async::block_on;
144143
use crate::hal::testing::TestingHal;
145144
use crate::workflow::testing::Screen;
146145
use alloc::boxed::Box;
147146
use bitbox02::testing::mock_unlocked;
147+
use util::bb02_async::block_on;
148148
use util::bip32::HARDENED;
149149

150150
const MESSAGE: &str = "message";

src/rust/bitbox02-rust/src/hww/api/bitcoin/signtx.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1273,13 +1273,13 @@ pub async fn process(
12731273
#[cfg(test)]
12741274
mod tests {
12751275
use super::*;
1276-
use crate::bb02_async::block_on;
12771276
use crate::bip32::parse_xpub;
12781277
use crate::hal::testing::TestingHal;
12791278
use crate::workflow::testing::Screen;
12801279
use alloc::boxed::Box;
12811280
use bitbox02::testing::{mock_memory, mock_unlocked, mock_unlocked_using_mnemonic};
12821281
use pb::btc_payment_request_request::{Memo, memo};
1282+
use util::bb02_async::block_on;
12831283
use util::bip32::HARDENED;
12841284

12851285
fn extract_next(response: &Response) -> &pb::BtcSignNextResponse {

src/rust/bitbox02-rust/src/hww/api/bitcoin/xpubs.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,8 @@ pub async fn process_xpubs(request: &pb::BtcXpubsRequest) -> Result<Response, Er
6868
mod tests {
6969
use super::*;
7070

71-
use crate::bb02_async::block_on;
7271
use bitbox02::testing::{mock_memory, mock_unlocked, mock_unlocked_using_mnemonic};
72+
use util::bb02_async::block_on;
7373
use util::bip32::HARDENED;
7474

7575
#[test]

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,8 +230,8 @@ pub async fn process_api(
230230
mod tests {
231231
use super::*;
232232

233-
use crate::bb02_async::block_on;
234233
use bitbox02::testing::mock_memory;
234+
use util::bb02_async::block_on;
235235

236236
#[test]
237237
fn test_chunk_streaming() {

0 commit comments

Comments
 (0)