Skip to content

Commit c55392e

Browse files
committed
refactor: clean code
Signed-off-by: Haobo Gu <haobogu@outlook.com>
1 parent a7d411e commit c55392e

3 files changed

Lines changed: 5 additions & 10 deletions

File tree

rmk/src/hid.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -165,10 +165,6 @@ impl AsInputReport for Report {
165165
pub enum HidError {
166166
UsbReadError(ReadError),
167167
UsbEndpointError(EndpointError),
168-
// FIXME: remove unused errors
169-
UsbDisabled,
170-
UsbPartialRead,
171-
BufferOverflow,
172168
ReportSerializeError,
173169
BleError,
174170
}

rmk/src/host/mod.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22
pub(crate) mod storage;
33
pub mod via;
44

5-
// TODO: Remove those aliases
6-
pub use via::UsbVialReaderWriter as UsbHostReaderWriter;
5+
pub use via::UsbHostReaderWriter;
76
#[cfg(feature = "vial")]
87
pub(crate) use via::VialService as HostService;
98

rmk/src/host/via/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -315,17 +315,17 @@ fn get_position_from_offset(offset: usize, max_row: usize, max_col: usize) -> (u
315315
(row, col, layer)
316316
}
317317

318-
pub struct UsbVialReaderWriter<'a, 'd, D: Driver<'d>> {
318+
pub struct UsbHostReaderWriter<'a, 'd, D: Driver<'d>> {
319319
pub(crate) vial_reader_writer: &'a mut HidReaderWriter<'d, D, 32, 32>,
320320
}
321321

322-
impl<'a, 'd, D: Driver<'d>> UsbVialReaderWriter<'a, 'd, D> {
322+
impl<'a, 'd, D: Driver<'d>> UsbHostReaderWriter<'a, 'd, D> {
323323
pub(crate) fn new(vial_reader_writer: &'a mut HidReaderWriter<'d, D, 32, 32>) -> Self {
324324
Self { vial_reader_writer }
325325
}
326326
}
327327

328-
impl<'d, D: Driver<'d>> HidWriterTrait for UsbVialReaderWriter<'_, 'd, D> {
328+
impl<'d, D: Driver<'d>> HidWriterTrait for UsbHostReaderWriter<'_, 'd, D> {
329329
type ReportType = ViaReport;
330330

331331
async fn write_report(&mut self, report: Self::ReportType) -> Result<usize, HidError> {
@@ -341,7 +341,7 @@ impl<'d, D: Driver<'d>> HidWriterTrait for UsbVialReaderWriter<'_, 'd, D> {
341341
}
342342
}
343343

344-
impl<'d, D: Driver<'d>> HidReaderTrait for UsbVialReaderWriter<'_, 'd, D> {
344+
impl<'d, D: Driver<'d>> HidReaderTrait for UsbHostReaderWriter<'_, 'd, D> {
345345
type ReportType = ViaReport;
346346

347347
async fn read_report(&mut self) -> Result<ViaReport, HidError> {

0 commit comments

Comments
 (0)