From 053c55c25431fc3dbb7d04fae06a6640eae7da07 Mon Sep 17 00:00:00 2001 From: bunnie Date: Thu, 1 Feb 2024 13:47:13 +0800 Subject: [PATCH] CHORE reformat PR I...could swear there was no merge warning when I clicked merge. why is this failing to check now? --- apps/hidv2/src/main.rs | 41 ++++++++-------------------- services/usb-device-xous/src/main.rs | 2 +- 2 files changed, 12 insertions(+), 31 deletions(-) diff --git a/apps/hidv2/src/main.rs b/apps/hidv2/src/main.rs index 965907be3..c2e2ad01e 100644 --- a/apps/hidv2/src/main.rs +++ b/apps/hidv2/src/main.rs @@ -2,10 +2,11 @@ #![cfg_attr(target_os = "none", no_main)] use core::fmt::Write; +use std::sync::mpsc::{self, Receiver, Sender}; + use graphics_server::api::GlyphStyle; use graphics_server::{DrawStyle, Gid, PixelColor, Point, Rectangle, TextBounds, TextView}; use num_traits::*; -use std::sync::mpsc::{self, Receiver, Sender}; use usb_device_xous::UsbHid; pub(crate) const SERVER_NAME_HIDV2: &str = "_HIDv2_"; @@ -68,18 +69,9 @@ impl HIDv2Demo { .expect("Could not register GAM UX") .unwrap(); - let content = gam - .request_content_canvas(gam_token) - .expect("Could not get content canvas"); - let screensize = gam - .get_canvas_bounds(content) - .expect("Could not get canvas dimensions"); - Self { - gam, - _gam_token: gam_token, - content, - screensize, - } + let content = gam.request_content_canvas(gam_token).expect("Could not get content canvas"); + let screensize = gam.get_canvas_bounds(content).expect("Could not get canvas dimensions"); + Self { gam, _gam_token: gam_token, content, screensize } } /// Clear the entire screen. @@ -90,11 +82,7 @@ impl HIDv2Demo { Rectangle::new_with_style( Point::new(0, 0), self.screensize, - DrawStyle { - fill_color: Some(PixelColor::Light), - stroke_color: None, - stroke_width: 0, - }, + DrawStyle { fill_color: Some(PixelColor::Light), stroke_color: None, stroke_width: 0 }, ), ) .expect("can't clear content area"); @@ -123,9 +111,7 @@ impl HIDv2Demo { write!(text_view.text, "{}", "Echoing whatever on HID USB stack...") .expect("Could not write to text view"); - self.gam - .post_textview(&mut text_view) - .expect("Could not render text view"); + self.gam.post_textview(&mut text_view).expect("Could not render text view"); self.gam.redraw().expect("Could not redraw screen"); } } @@ -140,9 +126,7 @@ fn main() -> ! { let mut allow_redraw = true; // Register the server with xous - let sid = xns - .register_name(SERVER_NAME_HIDV2, None) - .expect("can't register server"); + let sid = xns.register_name(SERVER_NAME_HIDV2, None).expect("can't register server"); let mut hidv2_demo = HIDv2Demo::new(&xns, sid); @@ -201,11 +185,9 @@ fn start_hid_thread() -> Sender { let usbd = UsbHid::new(); - usbd.connect_hid_app(FIDO_REPORT_DESCRIPTOR.to_vec()) - .unwrap(); + usbd.connect_hid_app(FIDO_REPORT_DESCRIPTOR.to_vec()).unwrap(); - usbd.switch_to_core(usb_device_xous::UsbDeviceType::HIDv2) - .unwrap(); + usbd.switch_to_core(usb_device_xous::UsbDeviceType::HIDv2).unwrap(); std::thread::spawn(move || { loop { @@ -227,8 +209,7 @@ fn start_hid_thread() -> Sender { std::thread::sleep(std::time::Duration::from_millis(50)); } - usbd.switch_to_core(usb_device_xous::UsbDeviceType::Debug) - .unwrap(); + usbd.switch_to_core(usb_device_xous::UsbDeviceType::Debug).unwrap(); }); return tx; diff --git a/services/usb-device-xous/src/main.rs b/services/usb-device-xous/src/main.rs index 7c74a493c..9c3f4faa8 100644 --- a/services/usb-device-xous/src/main.rs +++ b/services/usb-device-xous/src/main.rs @@ -24,7 +24,7 @@ use spinal_udc::*; #[cfg(all(any(feature = "precursor", feature = "renode"), feature = "mass-storage"))] mod apps_block_device; -#[cfg(any(feature="precursor", feature="renode"))] +#[cfg(any(feature = "precursor", feature = "renode"))] mod hid; #[cfg(not(target_os = "xous"))] mod hosted;