Skip to content

Commit

Permalink
Fix Clippy warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
NathanRoyer committed Dec 6, 2023
1 parent 2a4cfbc commit cb7cb55
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
3 changes: 3 additions & 0 deletions kernel/usb/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
#![no_std]
#![allow(unused)]

// The allocator macros sometime mess with clippy
#![allow(clippy::needless_pub_self)]

extern crate alloc;

use memory::{MappedPages, BorrowedMappedPages, Mutable, PhysicalAddress, map_frame_range, create_identity_mapping, PAGE_SIZE, MMIO_FLAGS};
Expand Down
6 changes: 3 additions & 3 deletions kernel/usb/src/request.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ pub(crate) enum Request<'a> {
SetDeviceDescriptor(descriptors::Device),

GetConfigDescriptor(DescriptorIndex, &'a mut descriptors::Configuration),
SetConfigDescriptor(DescriptorIndex, descriptors::Configuration),
SetConfigDescriptor(DescriptorIndex, &'a descriptors::Configuration),

GetConfiguration(&'a mut Option<NonZeroU8>),
SetConfiguration(Option<NonZeroU8>),
Expand Down Expand Up @@ -249,7 +249,7 @@ impl<'a> Request<'a> {
Request::GetDeviceDescriptor(_d) => shmem.descriptors.device.allocate(None),
Request::SetDeviceDescriptor(d) => shmem.descriptors.device.allocate(Some(*d)),
Request::GetConfigDescriptor(_desc_idx, _d) => shmem.descriptors.configuration.allocate(None),
Request::SetConfigDescriptor(_desc_idx, d) => shmem.descriptors.configuration.allocate(Some(*d)),
Request::SetConfigDescriptor(_desc_idx, d) => shmem.descriptors.configuration.allocate(Some(**d)),
Request::GetConfiguration(_config) => shmem.bytes.allocate(None),
Request::SetConfiguration(_config) => Ok(invalid_ptr_slot()),
Request::GetInterfaceAltSetting(_interface_idx, _alt_setting) => shmem.bytes.allocate(None),
Expand Down Expand Up @@ -300,7 +300,7 @@ impl<'a> Request<'a> {
Request::SetInterfaceAltSetting(_interface_idx, _alt_setting) => Ok(()),
Request::ReadString(_string_idx, string) => {
let string_desc = &shmem.descriptors.string.free(shmem_index)?;
let str_len = string_desc.length.checked_sub(2).unwrap_or(0) as usize;
let str_len = string_desc.length.saturating_sub(2) as usize;
let slice = &string_desc.unicode_bytes[..str_len];

string.clear();
Expand Down

0 comments on commit cb7cb55

Please sign in to comment.