Skip to content

Commit e31d70b

Browse files
authored
Merge pull request #123 from ithinuel/satisfy-clippy
Add Clippy checks
2 parents 98ccb7f + 19414a4 commit e31d70b

File tree

4 files changed

+18
-16
lines changed

4 files changed

+18
-16
lines changed

.github/workflows/rustfmt.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,7 @@ jobs:
2121
with:
2222
command: fmt
2323
args: --all -- --check
24+
- uses: actions-rs/cargo@v1
25+
with:
26+
command: clippy
27+
args: --all-features

src/descriptor.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -292,9 +292,9 @@ impl DescriptorWriter<'_> {
292292
///
293293
/// * `endpoint` - Endpoint previously allocated with
294294
/// [`UsbBusAllocator`](crate::bus::UsbBusAllocator).
295-
pub fn endpoint<'e, B: UsbBus, D: EndpointDirection>(
295+
pub fn endpoint<B: UsbBus, D: EndpointDirection>(
296296
&mut self,
297-
endpoint: &Endpoint<'e, B, D>,
297+
endpoint: &Endpoint<'_, B, D>,
298298
) -> Result<()> {
299299
self.endpoint_ex(endpoint, |_| Ok(0))
300300
}
@@ -310,9 +310,9 @@ impl DescriptorWriter<'_> {
310310
/// * `endpoint` - Endpoint previously allocated with
311311
/// [`UsbBusAllocator`](crate::bus::UsbBusAllocator).
312312
/// * `f` - Callback for the extra data. See `write_with` for more information.
313-
pub fn endpoint_ex<'e, B: UsbBus, D: EndpointDirection>(
313+
pub fn endpoint_ex<B: UsbBus, D: EndpointDirection>(
314314
&mut self,
315-
endpoint: &Endpoint<'e, B, D>,
315+
endpoint: &Endpoint<'_, B, D>,
316316
f: impl FnOnce(&mut [u8]) -> Result<usize>,
317317
) -> Result<()> {
318318
match self.num_endpoints_mark {

src/device.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -366,12 +366,10 @@ impl<B: UsbBus> UsbDevice<'_, B> {
366366
// Ask class implementations, whether they know the alternate setting
367367
// of the interface in question
368368
for cls in classes {
369-
match cls.get_alt_setting(InterfaceNumber(req.index as u8)) {
370-
Some(setting) => {
371-
xfer.accept_with(&setting.to_le_bytes()).ok();
372-
return;
373-
}
374-
None => (),
369+
if let Some(setting) = cls.get_alt_setting(InterfaceNumber(req.index as u8))
370+
{
371+
xfer.accept_with(&setting.to_le_bytes()).ok();
372+
return;
375373
}
376374
}
377375

src/test_class.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ impl<B: UsbBus> TestClass<'_, B> {
9393
}
9494

9595
/// Convenience method to create a UsbDevice that is configured correctly for TestClass.
96-
pub fn make_device<'a, 'b>(&'a self, usb_bus: &'b UsbBusAllocator<B>) -> UsbDevice<'b, B> {
96+
pub fn make_device<'a>(&self, usb_bus: &'a UsbBusAllocator<B>) -> UsbDevice<'a, B> {
9797
self.make_device_builder(usb_bus).build()
9898
}
9999

@@ -108,10 +108,10 @@ impl<B: UsbBus> TestClass<'_, B> {
108108
///
109109
/// on the returned builder. If you change the manufacturer, product, or serial number fields,
110110
/// the test host may misbehave.
111-
pub fn make_device_builder<'a, 'b>(
112-
&'a self,
113-
usb_bus: &'b UsbBusAllocator<B>,
114-
) -> UsbDeviceBuilder<'b, B> {
111+
pub fn make_device_builder<'a>(
112+
&self,
113+
usb_bus: &'a UsbBusAllocator<B>,
114+
) -> UsbDeviceBuilder<'a, B> {
115115
UsbDeviceBuilder::new(usb_bus, UsbVidPid(VID, PID))
116116
.manufacturer(MANUFACTURER)
117117
.product(PRODUCT)
@@ -311,7 +311,7 @@ impl<B: UsbBus> UsbClass<B> for TestClass<'_, B> {
311311

312312
xfer.accept().expect("control_out REQ_STORE_REQUEST failed");
313313
}
314-
REQ_WRITE_BUFFER if xfer.data().len() as usize <= self.control_buf.len() => {
314+
REQ_WRITE_BUFFER if xfer.data().len() <= self.control_buf.len() => {
315315
assert_eq!(
316316
xfer.data().len(),
317317
req.length as usize,

0 commit comments

Comments
 (0)