@@ -321,13 +321,13 @@ impl<B: UsbBus> UsbDevice<'_, B> {
321
321
0x0000
322
322
} ;
323
323
324
- xfer. accept_with ( & status. to_le_bytes ( ) ) . ok ( ) ;
324
+ let _ = xfer. accept_with ( & status. to_le_bytes ( ) ) ;
325
325
}
326
326
327
327
( Recipient :: Interface , Request :: GET_STATUS ) => {
328
328
let status: u16 = 0x0000 ;
329
329
330
- xfer. accept_with ( & status. to_le_bytes ( ) ) . ok ( ) ;
330
+ let _ = xfer. accept_with ( & status. to_le_bytes ( ) ) ;
331
331
}
332
332
333
333
( Recipient :: Endpoint , Request :: GET_STATUS ) => {
@@ -339,7 +339,7 @@ impl<B: UsbBus> UsbDevice<'_, B> {
339
339
0x0000
340
340
} ;
341
341
342
- xfer. accept_with ( & status. to_le_bytes ( ) ) . ok ( ) ;
342
+ let _ = xfer. accept_with ( & status. to_le_bytes ( ) ) ;
343
343
}
344
344
345
345
( Recipient :: Device , Request :: GET_DESCRIPTOR ) => {
@@ -352,13 +352,13 @@ impl<B: UsbBus> UsbDevice<'_, B> {
352
352
_ => CONFIGURATION_NONE ,
353
353
} ;
354
354
355
- xfer. accept_with ( & config. to_le_bytes ( ) ) . ok ( ) ;
355
+ let _ = xfer. accept_with ( & config. to_le_bytes ( ) ) ;
356
356
}
357
357
358
358
( Recipient :: Interface , Request :: GET_INTERFACE ) => {
359
359
// Reject interface numbers bigger than 255
360
360
if req. index > core:: u8:: MAX . into ( ) {
361
- xfer. reject ( ) . ok ( ) ;
361
+ let _ = xfer. reject ( ) ;
362
362
return ;
363
363
}
364
364
@@ -367,22 +367,21 @@ impl<B: UsbBus> UsbDevice<'_, B> {
367
367
for cls in classes {
368
368
if let Some ( setting) = cls. get_alt_setting ( InterfaceNumber ( req. index as u8 ) )
369
369
{
370
- xfer. accept_with ( & setting. to_le_bytes ( ) ) . ok ( ) ;
370
+ let _ = xfer. accept_with ( & setting. to_le_bytes ( ) ) ;
371
371
return ;
372
372
}
373
373
}
374
374
375
375
// If no class returned an alternate setting, return the default value
376
- xfer. accept_with ( & DEFAULT_ALTERNATE_SETTING . to_le_bytes ( ) )
377
- . ok ( ) ;
376
+ let _ = xfer. accept_with ( & DEFAULT_ALTERNATE_SETTING . to_le_bytes ( ) ) ;
378
377
}
379
378
380
379
_ => ( ) ,
381
380
} ;
382
381
}
383
382
384
383
if self . control . waiting_for_response ( ) {
385
- self . control . reject ( ) . ok ( ) ;
384
+ let _ = self . control . reject ( ) ;
386
385
}
387
386
}
388
387
@@ -411,13 +410,13 @@ impl<B: UsbBus> UsbDevice<'_, B> {
411
410
Request :: FEATURE_DEVICE_REMOTE_WAKEUP ,
412
411
) => {
413
412
self . remote_wakeup_enabled = false ;
414
- xfer. accept ( ) . ok ( ) ;
413
+ let _ = xfer. accept ( ) ;
415
414
}
416
415
417
416
( Recipient :: Endpoint , Request :: CLEAR_FEATURE , Request :: FEATURE_ENDPOINT_HALT ) => {
418
417
self . bus
419
418
. set_stalled ( ( ( req. index as u8 ) & 0x8f ) . into ( ) , false ) ;
420
- xfer. accept ( ) . ok ( ) ;
419
+ let _ = xfer. accept ( ) ;
421
420
}
422
421
423
422
(
@@ -426,13 +425,13 @@ impl<B: UsbBus> UsbDevice<'_, B> {
426
425
Request :: FEATURE_DEVICE_REMOTE_WAKEUP ,
427
426
) => {
428
427
self . remote_wakeup_enabled = true ;
429
- xfer. accept ( ) . ok ( ) ;
428
+ let _ = xfer. accept ( ) ;
430
429
}
431
430
432
431
( Recipient :: Endpoint , Request :: SET_FEATURE , Request :: FEATURE_ENDPOINT_HALT ) => {
433
432
self . bus
434
433
. set_stalled ( ( ( req. index as u8 ) & 0x8f ) . into ( ) , true ) ;
435
- xfer. accept ( ) . ok ( ) ;
434
+ let _ = xfer. accept ( ) ;
436
435
}
437
436
438
437
( Recipient :: Device , Request :: SET_ADDRESS , 1 ..=127 ) => {
@@ -442,59 +441,59 @@ impl<B: UsbBus> UsbDevice<'_, B> {
442
441
} else {
443
442
self . pending_address = req. value as u8 ;
444
443
}
445
- xfer. accept ( ) . ok ( ) ;
444
+ let _ = xfer. accept ( ) ;
446
445
}
447
446
448
447
( Recipient :: Device , Request :: SET_CONFIGURATION , CONFIGURATION_VALUE_U16 ) => {
449
448
self . device_state = UsbDeviceState :: Configured ;
450
- xfer. accept ( ) . ok ( ) ;
449
+ let _ = xfer. accept ( ) ;
451
450
}
452
451
453
452
( Recipient :: Device , Request :: SET_CONFIGURATION , CONFIGURATION_NONE_U16 ) => {
454
453
match self . device_state {
455
454
UsbDeviceState :: Default => {
456
- xfer. reject ( ) . ok ( ) ;
455
+ let _ = xfer. accept ( ) ;
457
456
}
458
457
_ => {
459
458
self . device_state = UsbDeviceState :: Addressed ;
460
- xfer. accept ( ) . ok ( ) ;
459
+ let _ = xfer. accept ( ) ;
461
460
}
462
461
}
463
462
}
464
463
465
464
( Recipient :: Interface , Request :: SET_INTERFACE , alt_setting) => {
466
465
// Reject interface numbers and alt settings bigger than 255
467
466
if req. index > core:: u8:: MAX . into ( ) || alt_setting > core:: u8:: MAX . into ( ) {
468
- xfer. reject ( ) . ok ( ) ;
467
+ let _ = xfer. reject ( ) ;
469
468
return ;
470
469
}
471
470
472
471
// Ask class implementations, whether they accept the alternate interface setting.
473
472
for cls in classes {
474
473
if cls. set_alt_setting ( InterfaceNumber ( req. index as u8 ) , alt_setting as u8 )
475
474
{
476
- xfer. accept ( ) . ok ( ) ;
475
+ let _ = xfer. accept ( ) ;
477
476
return ;
478
477
}
479
478
}
480
479
481
480
// Default behaviour, if no class implementation accepted the alternate setting.
482
481
if alt_setting == DEFAULT_ALTERNATE_SETTING_U16 {
483
- xfer. accept ( ) . ok ( ) ;
482
+ let _ = xfer. accept ( ) ;
484
483
} else {
485
- xfer. reject ( ) . ok ( ) ;
484
+ let _ = xfer. reject ( ) ;
486
485
}
487
486
}
488
487
489
488
_ => {
490
- xfer. reject ( ) . ok ( ) ;
489
+ let _ = xfer. reject ( ) ;
491
490
return ;
492
491
}
493
492
}
494
493
}
495
494
496
495
if self . control . waiting_for_response ( ) {
497
- self . control . reject ( ) . ok ( ) ;
496
+ let _ = self . control . reject ( ) ;
498
497
}
499
498
}
500
499
@@ -507,12 +506,11 @@ impl<B: UsbBus> UsbDevice<'_, B> {
507
506
xfer : ControlIn < B > ,
508
507
f : impl FnOnce ( & mut DescriptorWriter ) -> Result < ( ) > ,
509
508
) {
510
- xfer. accept ( |buf| {
509
+ let _ = xfer. accept ( |buf| {
511
510
let mut writer = DescriptorWriter :: new ( buf) ;
512
511
f ( & mut writer) ?;
513
512
Ok ( writer. position ( ) )
514
- } )
515
- . ok ( ) ;
513
+ } ) ;
516
514
}
517
515
518
516
match dtype {
@@ -595,6 +593,7 @@ impl<B: UsbBus> UsbDevice<'_, B> {
595
593
2 => lang. product ,
596
594
3 => lang. serial ,
597
595
_ => unreachable ! ( ) ,
596
+
598
597
}
599
598
}
600
599
_ => {
@@ -608,13 +607,13 @@ impl<B: UsbBus> UsbDevice<'_, B> {
608
607
if let Some ( string_descriptor) = string {
609
608
accept_writer ( xfer, |w| w. string ( string_descriptor) ) ;
610
609
} else {
611
- xfer. reject ( ) . ok ( ) ;
610
+ let _ = xfer. reject ( ) ;
612
611
}
613
612
}
614
613
} ,
615
614
616
615
_ => {
617
- xfer. reject ( ) . ok ( ) ;
616
+ let _ = xfer. reject ( ) ;
618
617
}
619
618
}
620
619
}
0 commit comments