File tree 5 files changed +19
-12
lines changed
5 files changed +19
-12
lines changed Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ impl StandardId {
15
15
///
16
16
/// This will return `None` if `raw` is out of range of an 11-bit integer (`> 0x7FF`).
17
17
#[ inline]
18
+ #[ must_use]
18
19
pub const fn new ( raw : u16 ) -> Option < Self > {
19
20
if raw <= 0x7FF {
20
21
Some ( Self ( raw) )
@@ -28,12 +29,14 @@ impl StandardId {
28
29
/// # Safety
29
30
/// Using this method can create an invalid ID and is thus marked as unsafe.
30
31
#[ inline]
32
+ #[ must_use]
31
33
pub const unsafe fn new_unchecked ( raw : u16 ) -> Self {
32
34
Self ( raw)
33
35
}
34
36
35
37
/// Returns this CAN Identifier as a raw 16-bit integer.
36
38
#[ inline]
39
+ #[ must_use]
37
40
pub const fn as_raw ( & self ) -> u16 {
38
41
self . 0
39
42
}
@@ -54,6 +57,7 @@ impl ExtendedId {
54
57
///
55
58
/// This will return `None` if `raw` is out of range of an 29-bit integer (`> 0x1FFF_FFFF`).
56
59
#[ inline]
60
+ #[ must_use]
57
61
pub const fn new ( raw : u32 ) -> Option < Self > {
58
62
if raw <= 0x1FFF_FFFF {
59
63
Some ( Self ( raw) )
@@ -67,17 +71,20 @@ impl ExtendedId {
67
71
/// # Safety
68
72
/// Using this method can create an invalid ID and is thus marked as unsafe.
69
73
#[ inline]
74
+ #[ must_use]
70
75
pub const unsafe fn new_unchecked ( raw : u32 ) -> Self {
71
76
Self ( raw)
72
77
}
73
78
74
79
/// Returns this CAN Identifier as a raw 32-bit integer.
75
80
#[ inline]
81
+ #[ must_use]
76
82
pub const fn as_raw ( & self ) -> u32 {
77
83
self . 0
78
84
}
79
85
80
86
/// Returns the Base ID part of this extended identifier.
87
+ #[ must_use]
81
88
pub fn standard_id ( & self ) -> StandardId {
82
89
// ID-28 to ID-18
83
90
StandardId ( ( self . 0 >> 18 ) as u16 )
Original file line number Diff line number Diff line change @@ -17,11 +17,11 @@ where
17
17
{
18
18
#[ inline]
19
19
async fn delay_us ( & mut self , us : u32 ) {
20
- T :: delay_us ( self , us) . await
20
+ T :: delay_us ( self , us) . await ;
21
21
}
22
22
23
23
#[ inline]
24
24
async fn delay_ms ( & mut self , ms : u32 ) {
25
- T :: delay_ms ( self , ms) . await
25
+ T :: delay_ms ( self , ms) . await ;
26
26
}
27
27
}
Original file line number Diff line number Diff line change @@ -22,11 +22,11 @@ where
22
22
{
23
23
#[ inline]
24
24
fn delay_us ( & mut self , us : u32 ) {
25
- T :: delay_us ( self , us)
25
+ T :: delay_us ( self , us) ;
26
26
}
27
27
28
28
#[ inline]
29
29
fn delay_ms ( & mut self , ms : u32 ) {
30
- T :: delay_ms ( self , ms)
30
+ T :: delay_ms ( self , ms) ;
31
31
}
32
32
}
Original file line number Diff line number Diff line change @@ -58,10 +58,10 @@ pub trait Read: ErrorType {
58
58
Err ( e) => return Err ( ReadExactError :: Other ( e) ) ,
59
59
}
60
60
}
61
- if !buf. is_empty ( ) {
62
- Err ( ReadExactError :: UnexpectedEof )
63
- } else {
61
+ if buf. is_empty ( ) {
64
62
Ok ( ( ) )
63
+ } else {
64
+ Err ( ReadExactError :: UnexpectedEof )
65
65
}
66
66
}
67
67
}
@@ -170,7 +170,7 @@ impl<T: ?Sized + BufRead> BufRead for &mut T {
170
170
}
171
171
172
172
fn consume ( & mut self , amt : usize ) {
173
- T :: consume ( self , amt)
173
+ T :: consume ( self , amt) ;
174
174
}
175
175
}
176
176
Original file line number Diff line number Diff line change @@ -362,10 +362,10 @@ pub trait Read: ErrorType {
362
362
Err ( e) => return Err ( ReadExactError :: Other ( e) ) ,
363
363
}
364
364
}
365
- if !buf. is_empty ( ) {
366
- Err ( ReadExactError :: UnexpectedEof )
367
- } else {
365
+ if buf. is_empty ( ) {
368
366
Ok ( ( ) )
367
+ } else {
368
+ Err ( ReadExactError :: UnexpectedEof )
369
369
}
370
370
}
371
371
}
@@ -535,7 +535,7 @@ impl<T: ?Sized + BufRead> BufRead for &mut T {
535
535
}
536
536
537
537
fn consume ( & mut self , amt : usize ) {
538
- T :: consume ( self , amt)
538
+ T :: consume ( self , amt) ;
539
539
}
540
540
}
541
541
You can’t perform that action at this time.
0 commit comments