chore: fix trailing whitespaces

i'm not sure how this merged, the merge checks were all clean
on the previous PR...???
This commit is contained in:
bunnie 2024-02-01 13:16:18 +08:00
parent b63156e652
commit 3ed7736fa6

View file

@ -382,18 +382,18 @@ impl UsbHid {
} }
/// Sets the userland application HID device descriptor. /// Sets the userland application HID device descriptor.
/// It cannot be longer than 1024 bytes. /// It cannot be longer than 1024 bytes.
pub fn connect_hid_app(&self, descriptor: Vec<u8>) -> Result<(), xous::Error> { pub fn connect_hid_app(&self, descriptor: Vec<u8>) -> Result<(), xous::Error> {
if descriptor.len() > MAX_HID_REPORT_DESCRIPTOR_LEN { if descriptor.len() > MAX_HID_REPORT_DESCRIPTOR_LEN {
return Err(xous::Error::OutOfMemory) return Err(xous::Error::OutOfMemory);
} }
let mut container = HIDReportDescriptorMessage{ let mut container = HIDReportDescriptorMessage {
descriptor: [0u8; MAX_HID_REPORT_DESCRIPTOR_LEN], descriptor: [0u8; MAX_HID_REPORT_DESCRIPTOR_LEN],
len: descriptor.len(), len: descriptor.len(),
}; };
for (place, element) in container.descriptor.iter_mut().zip(descriptor.iter()) { for (place, element) in container.descriptor.iter_mut().zip(descriptor.iter()) {
*place = *element; *place = *element;
} }
@ -403,12 +403,12 @@ impl UsbHid {
Ok(()) Ok(())
} }
/// Unset the userland application HID device descriptor and discards the cached /// Unset the userland application HID device descriptor and discards the cached
/// reports. /// reports.
pub fn disconnect_hid_app(&self) -> Result<(), xous::Error> { pub fn disconnect_hid_app(&self) -> Result<(), xous::Error> {
match send_message(self.conn, Message::new_blocking_scalar( match send_message(
Opcode::HIDUnsetDescriptor.to_usize().unwrap(), self.conn,
0, 0, 0, 0) Message::new_blocking_scalar(Opcode::HIDUnsetDescriptor.to_usize().unwrap(), 0, 0, 0, 0),
) { ) {
Ok(_) => Ok(()), Ok(_) => Ok(()),
Err(err) => Err(err), Err(err) => Err(err),
@ -421,7 +421,7 @@ impl UsbHid {
let mut buf = Buffer::into_buf(report).or(Err(xous::Error::InternalError))?; let mut buf = Buffer::into_buf(report).or(Err(xous::Error::InternalError))?;
buf.lend_mut(self.conn, Opcode::HIDReadReport.to_u32().unwrap()).map(|_| ())?; buf.lend_mut(self.conn, Opcode::HIDReadReport.to_u32().unwrap()).map(|_| ())?;
let report = buf.as_flat::<HIDReportMessage, _>().unwrap(); let report = buf.as_flat::<HIDReportMessage, _>().unwrap();
match &report.data { match &report.data {
@ -433,8 +433,7 @@ impl UsbHid {
} }
Ok(ret) Ok(ret)
}
},
rkyv::core_impl::ArchivedOption::None => Err(xous::Error::UnknownError), rkyv::core_impl::ArchivedOption::None => Err(xous::Error::UnknownError),
} }
} }