format cleanup & copy remove

a bunch of code has to be re-formatted because spacing changed
and we have a strict formatting rule
This commit is contained in:
bunnie 2024-09-22 15:29:23 +08:00
parent f6f7cbdc98
commit 0cdbfdfcc3
2 changed files with 7 additions and 15 deletions

View file

@ -62,7 +62,7 @@ pub(crate) enum UxLayout {
Framebuffer, Framebuffer,
} }
#[derive(Debug, Copy, Clone)] #[derive(Debug, Clone)]
pub(crate) struct UxContext { pub(crate) struct UxContext {
/// the type of the Ux defined here /// the type of the Ux defined here
pub layout: UxLayout, pub layout: UxLayout,
@ -517,7 +517,7 @@ impl ContextManager {
} else { } else {
None None
}, },
predictor: context.predictor, predictor: context.predictor.clone(),
token: context.gam_token, token: context.gam_token,
predictor_token: context.pred_token, predictor_token: context.pred_token,
}; };

View file

@ -553,11 +553,7 @@ fn wrapped_main() -> ! {
let registration = buffer.to_original::<UxRegistration, _>().unwrap(); let registration = buffer.to_original::<UxRegistration, _>().unwrap();
let init_focus_found = let init_focus_found =
if registration.app_name.as_str().unwrap_or("UTF-8 error") == INITIAL_APP_FOCUS { if registration.app_name.as_str() == INITIAL_APP_FOCUS { true } else { false };
true
} else {
false
};
// note that we are currently assigning all Ux registrations a trust level consistent with a // note that we are currently assigning all Ux registrations a trust level consistent with a
// boot context (ultimately trusted) this needs to be modified later on once // boot context (ultimately trusted) this needs to be modified later on once
// we allow post-boot apps to be created // we allow post-boot apps to be created
@ -577,10 +573,8 @@ fn wrapped_main() -> ! {
let gam_token = gam_token.clone(); let gam_token = gam_token.clone();
let conn = CB_TO_MAIN_CONN.load(Ordering::SeqCst); let conn = CB_TO_MAIN_CONN.load(Ordering::SeqCst);
move || { move || {
let switchapp = SwitchToApp { let switchapp =
token: gam_token, SwitchToApp { token: gam_token, app_name: String::from(INITIAL_APP_FOCUS) };
app_name: String::from(INITIAL_APP_FOCUS),
};
let buf = Buffer::into_buf(switchapp).or(Err(xous::Error::InternalError))?; let buf = Buffer::into_buf(switchapp).or(Err(xous::Error::InternalError))?;
buf.send(conn, Opcode::SwitchToApp.to_u32().unwrap()) buf.send(conn, Opcode::SwitchToApp.to_u32().unwrap())
.or(Err(xous::Error::InternalError)) .or(Err(xous::Error::InternalError))
@ -647,9 +641,7 @@ fn wrapped_main() -> ! {
switchapp.token switchapp.token
); );
if let Some(new_app_token) = if let Some(new_app_token) = context_mgr.find_app_token_by_name(switchapp.app_name.as_str()) {
context_mgr.find_app_token_by_name(switchapp.app_name.as_str())
{
if new_app_token != context_mgr.focused_app().unwrap_or([0, 0, 0, 0]) { if new_app_token != context_mgr.focused_app().unwrap_or([0, 0, 0, 0]) {
// two things: // two things:
// 1. [0, 0, 0, 0] is simply a very unlikely GID because it's a 128 bit TRNG, and this // 1. [0, 0, 0, 0] is simply a very unlikely GID because it's a 128 bit TRNG, and this
@ -735,7 +727,7 @@ fn wrapped_main() -> ! {
unsafe { Buffer::from_memory_message_mut(msg.body.memory_message_mut().unwrap()) }; unsafe { Buffer::from_memory_message_mut(msg.body.memory_message_mut().unwrap()) };
let mut spec = buffer.to_original::<Bip39Ipc, _>().unwrap(); let mut spec = buffer.to_original::<Bip39Ipc, _>().unwrap();
let mut phrase = Vec::<std::string::String>::new(); let mut phrase = Vec::<std::string::String>::new();
for maybe_word in spec.words { for maybe_word in spec.words.iter() {
if let Some(word) = maybe_word { if let Some(word) = maybe_word {
phrase.push(word.as_str().to_string()); phrase.push(word.as_str().to_string());
} }