Skip to content

Commit ff528e8

Browse files
committed
fix clippy warnings
1 parent 416ae49 commit ff528e8

File tree

4 files changed

+6
-7
lines changed

4 files changed

+6
-7
lines changed

bitbox-bridge/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
8686
}
8787
};
8888

89-
let addr = SocketAddr::new("127.0.0.1".parse()?, u16::from_str_radix(port, 10)?);
89+
let addr = SocketAddr::new("127.0.0.1".parse()?, port.parse::<u16>()?);
9090

9191
println!("listening on http://{}", addr);
9292
let server = web::create(usb_devices, notify_tx, addr);

bitbox-bridge/src/usb.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ impl UsbDevices {
105105
d.insert(
106106
"path".into(),
107107
percent_encoding::utf8_percent_encode(
108-
&device.0,
108+
device.0,
109109
percent_encoding::NON_ALPHANUMERIC,
110110
)
111111
.to_string(),
@@ -171,19 +171,18 @@ impl UsbDevices {
171171
continue;
172172
}
173173
};
174-
let product = product_string.as_ref();
175174
seen.push(path.to_string());
176175
match devices_guard.entry(path.to_string()) {
177176
Entry::Occupied(_) => (),
178177
Entry::Vacant(v) => {
179178
info!("Found BitBox02 at {}!", path);
180-
v.insert(DeviceEntry::new(&product));
179+
v.insert(DeviceEntry::new(product_string));
181180
}
182181
}
183182
}
184183
}
185184
// Remove all devices that wasn't seen
186-
devices_guard.retain(|k, _| seen.contains(&k));
185+
devices_guard.retain(|k, _| seen.contains(k));
187186
Ok(())
188187
}
189188

bitbox-bridge/src/web.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ pub fn create(
205205
if let Some(origin) = origin {
206206
match origin.host() {
207207
Some(host) => {
208-
if !is_valid_origin(&host) {
208+
if !is_valid_origin(host) {
209209
warn!("Not whitelisted origin tried to connect: {}", host);
210210
return Err(warp::reject::custom(WebError::NonLocalIp));
211211
}

hidapi-async/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ pub struct Device {
6868
impl Clone for Device {
6969
fn clone(&self) -> Self {
7070
Device {
71-
inner: self.inner.as_ref().map(|dev| Arc::clone(&dev)),
71+
inner: self.inner.as_ref().map(|dev| Arc::clone(dev)),
7272
}
7373
}
7474
}

0 commit comments

Comments
 (0)