1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-15 12:08:59 +00:00

style: make style_check passing

This commit is contained in:
matejcik 2024-09-26 15:14:12 +02:00 committed by matejcik
parent ac5a5147e9
commit 8d2f0a6566
14 changed files with 28 additions and 20 deletions

View File

@ -582,8 +582,7 @@ impl EventCtx {
}
pub fn send_button_request(&mut self, code: ButtonRequestCode, name: TString<'static>) {
#[cfg(feature = "ui_debug")]
assert!(self.button_request.is_none());
debug_assert!(self.button_request.is_none());
self.button_request = Some(ButtonRequest::new(code, name));
}
@ -612,8 +611,7 @@ impl EventCtx {
}
pub fn clear(&mut self) {
#[cfg(feature = "ui_debug")]
assert!(self.button_request.is_none());
debug_assert!(self.button_request.is_none());
// replace self with a new instance, keeping only the fields we care about
*self = Self::new();
}

View File

@ -53,7 +53,7 @@ impl<T: Component> Component for SendButtonRequest<T> {
}
}
SendButtonRequestPolicy::OnAttachAlways => {
if let Some(br) = self.button_request.clone() {
if let Some(br) = self.button_request {
ctx.send_button_request(br.code, br.name);
}
}

View File

@ -30,7 +30,10 @@ use crate::{
time::Duration,
ui::{
button_request::ButtonRequest,
component::{base::{AttachType, TimerToken}, Component, Event, EventCtx, Never},
component::{
base::{AttachType, TimerToken},
Component, Event, EventCtx, Never,
},
display,
event::USBEvent,
ui_features::ModelUI,

View File

@ -44,7 +44,10 @@ use crate::{
flow::Swipable,
geometry::{self, Direction},
layout::{
base::LAYOUT_STATE, obj::{ComponentMsgObj, LayoutObj, ATTACH_TYPE_OBJ}, result::{CANCELLED, CONFIRMED, INFO}, util::{upy_disable_animation, ConfirmBlob, PropsList, RecoveryType}
base::LAYOUT_STATE,
obj::{ComponentMsgObj, LayoutObj, ATTACH_TYPE_OBJ},
result::{CANCELLED, CONFIRMED, INFO},
util::{upy_disable_animation, ConfirmBlob, PropsList, RecoveryType},
},
model_mercury::{
component::{check_homescreen_format, SwipeContent},

View File

@ -47,7 +47,10 @@ use crate::{
},
geometry,
layout::{
base::LAYOUT_STATE, obj::{ComponentMsgObj, LayoutObj, ATTACH_TYPE_OBJ}, result::{CANCELLED, CONFIRMED, INFO}, util::{upy_disable_animation, ConfirmBlob, RecoveryType}
base::LAYOUT_STATE,
obj::{ComponentMsgObj, LayoutObj, ATTACH_TYPE_OBJ},
result::{CANCELLED, CONFIRMED, INFO},
util::{upy_disable_animation, ConfirmBlob, RecoveryType},
},
model_tr::component::check_homescreen_format,
},

View File

@ -58,7 +58,9 @@ impl MultiTapKeyboard {
/// Returns `true` if `event` is an `Event::Timer` for the currently pending
/// timer.
pub fn timeout_event(&mut self, event: Event) -> bool {
self.pending.as_mut().map_or(false, |t| t.timer.expire(event))
self.pending
.as_mut()
.map_or(false, |t| t.timer.expire(event))
}
/// Reset to the empty state. Takes `EventCtx` to request a paint pass (to

View File

@ -50,7 +50,10 @@ use crate::{
},
geometry,
layout::{
base::LAYOUT_STATE, obj::{ComponentMsgObj, LayoutObj, ATTACH_TYPE_OBJ}, result::{CANCELLED, CONFIRMED, INFO}, util::{upy_disable_animation, ConfirmBlob, PropsList, RecoveryType}
base::LAYOUT_STATE,
obj::{ComponentMsgObj, LayoutObj, ATTACH_TYPE_OBJ},
result::{CANCELLED, CONFIRMED, INFO},
util::{upy_disable_animation, ConfirmBlob, PropsList, RecoveryType},
},
model_tt::component::check_homescreen_format,
},

View File

@ -1,4 +1,4 @@
from trezor import TR, io, utils, wire
from trezor import TR, io, wire
from trezor.ui.layouts import confirm_action, show_error_and_raise
from trezor.utils import sd_hotswap_enabled

View File

@ -1,6 +1,5 @@
from typing import TYPE_CHECKING
from trezor import utils
from trezor.crypto import rlp
from trezor.messages import EthereumTxRequest
from trezor.utils import BufferReader

View File

@ -1,7 +1,6 @@
from typing import TYPE_CHECKING
from trezor import TR
from trezor.enums import ButtonRequestType
from trezor.ui.layouts.recovery import ( # noqa: F401
request_word_count,
show_group_share_success,
@ -11,7 +10,7 @@ from trezor.ui.layouts.recovery import ( # noqa: F401
from apps.common import backup_types
if TYPE_CHECKING:
from typing import Awaitable, Callable
from typing import Awaitable
from trezor.enums import BackupType

View File

@ -8,7 +8,7 @@ from trezor.wire import ActionCancelled
from ..common import draw_simple, interact, raise_if_not_confirmed, with_info
if TYPE_CHECKING:
from typing import Any, Awaitable, Iterable, NoReturn, Sequence, TypeVar
from typing import Awaitable, Iterable, NoReturn, Sequence, TypeVar
from ..common import ExceptionType, PropertyType

View File

@ -1,5 +1,3 @@
from typing import TYPE_CHECKING
import trezorui2
from trezor import ui
from trezor.enums import ButtonRequestType

View File

@ -1,7 +1,7 @@
from typing import TYPE_CHECKING
import trezorui2
from trezor import TR, ui
from trezor import TR
from trezor.enums import ButtonRequestType, RecoveryType
from ..common import interact

View File

@ -48,7 +48,7 @@ from .client import TrezorClient
from .exceptions import TrezorFailure
from .log import DUMP_BYTES
from .messages import DebugWaitType
from .tools import expect, session
from .tools import expect
if TYPE_CHECKING:
from typing_extensions import Protocol