style(core): fix clippy errors in extapp UI code
What changed, and why it matters
This commit is a code-style cleanup that fixes warnings reported by the Rust linter (Clippy) in user-interface code for external apps. It replaces some verbose conversion calls with simpler equivalents and removes an unnecessary pair of parentheses. There is no indication it fixes a security bug or changes behavior in a security-relevant way.
No security action needed; treat as routine style/lint cleanup.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The diff modifies core/embed/rust/src/ui/api/firmware_micropython.rs to satisfy Clippy. Changes include: replacing Obj::try_from(item.mono)? and Obj::try_from(*indeterminate)? with Obj::from(…) where the source type is infallibly convertible; simplifying (&m.items).into() to &m.items; and removing redundant parentheses around a final tuple expression. These are idiomatic cleanups with no functional change apparent from the diff.
Changed components
core/embed/rust/src/ui/api/firmware_micropython.rsInspect captured patch +7 / −8
### core/embed/rust/src/ui/api/firmware_micropython.rs
@@ -1288,8 +1288,7 @@ extern "C" fn new_process_ipc_message(n_args: usize, args: *const Obj, kwargs: *
let slice = archived.as_ref();
let mut list = List::with_capacity(slice.len())?;
for item in slice {
- let obj =
- Obj::try_from((Obj::try_from(item.key.as_ref())?, Obj::try_from(item.mono)?))?;
+ let obj = Obj::try_from((Obj::try_from(item.key.as_ref())?, Obj::from(item.mono)))?;
list.append(obj)?;
}
Ok(list.leak().into())
@@ -1302,7 +1301,7 @@ extern "C" fn new_process_ipc_message(n_args: usize, args: *const Obj, kwargs: *
let obj = Obj::try_from((
Obj::try_from(item.key.as_ref())?,
Obj::try_from(item.value.as_ref())?,
- Obj::try_from(item.mono)?,
+ Obj::from(item.mono),
))?;
list.append(obj)?;
}
@@ -1370,7 +1369,7 @@ extern "C" fn new_process_ipc_message(n_args: usize, args: *const Obj, kwargs: *
Archived::<TrezorUiEnum>::ShowInfoWithCancel(m) => wrap(
ModelUI::show_info_with_cancel(
tstr(&m.title)?,
- obj_from_proplist((&m.items).into())?,
+ obj_from_proplist(&m.items)?,
false,
m.chunkify,
)?,
@@ -1570,12 +1569,12 @@ extern "C" fn new_process_ipc_message(n_args: usize, args: *const Obj, kwargs: *
)?,
};
- Ok((
+ (
Obj::from(main_layout),
Obj::try_from(u32::try_from(br_code)?)?,
br_name,
)
- .try_into()?)
+ .try_into()
};
unsafe { util::try_with_args_and_kwargs(n_args, args, kwargs, block) }
}
@@ -1659,8 +1658,8 @@ extern "C" fn new_deserialize_progress_message(
(
description,
title,
- Obj::try_from(*indeterminate)?,
- Obj::try_from(*danger)?,
+ Obj::from(*indeterminate),
+ Obj::from(*danger),
)
.try_into()?
}Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.