File tree 4 files changed +6
-7
lines changed 4 files changed +6
-7
lines changed Original file line number Diff line number Diff line change @@ -86,7 +86,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
86
86
}
87
87
} ;
88
88
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 > ( ) ?) ;
90
90
91
91
println ! ( "listening on http://{}" , addr) ;
92
92
let server = web:: create ( usb_devices, notify_tx, addr) ;
Original file line number Diff line number Diff line change @@ -105,7 +105,7 @@ impl UsbDevices {
105
105
d. insert (
106
106
"path" . into ( ) ,
107
107
percent_encoding:: utf8_percent_encode (
108
- & device. 0 ,
108
+ device. 0 ,
109
109
percent_encoding:: NON_ALPHANUMERIC ,
110
110
)
111
111
. to_string ( ) ,
@@ -171,19 +171,18 @@ impl UsbDevices {
171
171
continue ;
172
172
}
173
173
} ;
174
- let product = product_string. as_ref ( ) ;
175
174
seen. push ( path. to_string ( ) ) ;
176
175
match devices_guard. entry ( path. to_string ( ) ) {
177
176
Entry :: Occupied ( _) => ( ) ,
178
177
Entry :: Vacant ( v) => {
179
178
info ! ( "Found BitBox02 at {}!" , path) ;
180
- v. insert ( DeviceEntry :: new ( & product ) ) ;
179
+ v. insert ( DeviceEntry :: new ( product_string ) ) ;
181
180
}
182
181
}
183
182
}
184
183
}
185
184
// Remove all devices that wasn't seen
186
- devices_guard. retain ( |k, _| seen. contains ( & k) ) ;
185
+ devices_guard. retain ( |k, _| seen. contains ( k) ) ;
187
186
Ok ( ( ) )
188
187
}
189
188
Original file line number Diff line number Diff line change @@ -205,7 +205,7 @@ pub fn create(
205
205
if let Some ( origin) = origin {
206
206
match origin. host ( ) {
207
207
Some ( host) => {
208
- if !is_valid_origin ( & host) {
208
+ if !is_valid_origin ( host) {
209
209
warn ! ( "Not whitelisted origin tried to connect: {}" , host) ;
210
210
return Err ( warp:: reject:: custom ( WebError :: NonLocalIp ) ) ;
211
211
}
Original file line number Diff line number Diff line change @@ -68,7 +68,7 @@ pub struct Device {
68
68
impl Clone for Device {
69
69
fn clone ( & self ) -> Self {
70
70
Device {
71
- inner : self . inner . as_ref ( ) . map ( |dev| Arc :: clone ( & dev) ) ,
71
+ inner : self . inner . as_ref ( ) . map ( |dev| Arc :: clone ( dev) ) ,
72
72
}
73
73
}
74
74
}
You can’t perform that action at this time.
0 commit comments