Skip to content

Commit

Permalink
Clippy fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
miek committed Jan 8, 2024
1 parent 800aa65 commit 3a5bf00
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 6 deletions.
3 changes: 0 additions & 3 deletions src/capture.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1707,9 +1707,7 @@ mod tests {

pub mod prelude {
pub use super::{
create_capture,
create_endpoint,
CaptureReader,
CaptureWriter,
CaptureError,
Device,
Expand All @@ -1719,7 +1717,6 @@ pub mod prelude {
EndpointId,
EndpointType,
EndpointState,
EndpointReader,
EndpointWriter,
EndpointTransactionId,
EndpointTransferId,
Expand Down
2 changes: 1 addition & 1 deletion src/ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ impl DeviceSelector {
)
}
let no_speeds = vec![];
let speed_strings = self.dev_speeds.get(0).unwrap_or(&no_speeds);
let speed_strings = self.dev_speeds.first().unwrap_or(&no_speeds);
self.replace_dropdown(&self.dev_dropdown, &self.dev_strings);
self.replace_dropdown(&self.speed_dropdown, speed_strings);
let available = self.device_available();
Expand Down
2 changes: 0 additions & 2 deletions src/usb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -911,7 +911,6 @@ pub mod prelude {
SetupFields,
SplitFields,
StartComplete,
Speed,
Direction,
EndpointAddr,
StandardRequest,
Expand All @@ -920,7 +919,6 @@ pub mod prelude {
DescriptorType,
DeviceDescriptor,
ConfigDescriptor,
InterfaceDescriptor,
EndpointDescriptor,
Configuration,
Interface,
Expand Down

3 comments on commit 3a5bf00

@martinling
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The idea of the prelude submodules in capture and usb was to have a simple way to import all the public types from those modules, specifically so that it's not necessary to keep editing the list of imports.

I think it's pretty dumb for clippy to warn about unused imports when those imports were brought in via a use prelude::* statement, and I'd be inclined to file that as a bug.

Perhaps there's some way we can mark the preludes as "don't warn if these are not used"? I can't see anything like that on the gtk prelude module, though, and we don't get warnings about unused imports there.

@miek
Copy link
Member Author

@miek miek commented on 3a5bf00 Jan 8, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah yeah, my bad, I should've spotted that. I've opened #85 to re-add them and squelch the warnings.

I guess it may be warning here and not in gtk because we're not building as a library?

@martinling
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's clippy's bad, not yours, but I'm not sufficiently sure what changed or what the correct behaviour should be to file a bug about it.

And yeah, I expect those modules not being public in lib.rs is part of why it happens.

Please sign in to comment.