File tree Expand file tree Collapse file tree 5 files changed +19
-12
lines changed Expand file tree Collapse file tree 5 files changed +19
-12
lines changed Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ impl StandardId {
1515 ///
1616 /// This will return `None` if `raw` is out of range of an 11-bit integer (`> 0x7FF`).
1717 #[ inline]
18+ #[ must_use]
1819 pub const fn new ( raw : u16 ) -> Option < Self > {
1920 if raw <= 0x7FF {
2021 Some ( Self ( raw) )
@@ -28,12 +29,14 @@ impl StandardId {
2829 /// # Safety
2930 /// Using this method can create an invalid ID and is thus marked as unsafe.
3031 #[ inline]
32+ #[ must_use]
3133 pub const unsafe fn new_unchecked ( raw : u16 ) -> Self {
3234 Self ( raw)
3335 }
3436
3537 /// Returns this CAN Identifier as a raw 16-bit integer.
3638 #[ inline]
39+ #[ must_use]
3740 pub const fn as_raw ( & self ) -> u16 {
3841 self . 0
3942 }
@@ -54,6 +57,7 @@ impl ExtendedId {
5457 ///
5558 /// This will return `None` if `raw` is out of range of an 29-bit integer (`> 0x1FFF_FFFF`).
5659 #[ inline]
60+ #[ must_use]
5761 pub const fn new ( raw : u32 ) -> Option < Self > {
5862 if raw <= 0x1FFF_FFFF {
5963 Some ( Self ( raw) )
@@ -67,17 +71,20 @@ impl ExtendedId {
6771 /// # Safety
6872 /// Using this method can create an invalid ID and is thus marked as unsafe.
6973 #[ inline]
74+ #[ must_use]
7075 pub const unsafe fn new_unchecked ( raw : u32 ) -> Self {
7176 Self ( raw)
7277 }
7378
7479 /// Returns this CAN Identifier as a raw 32-bit integer.
7580 #[ inline]
81+ #[ must_use]
7682 pub const fn as_raw ( & self ) -> u32 {
7783 self . 0
7884 }
7985
8086 /// Returns the Base ID part of this extended identifier.
87+ #[ must_use]
8188 pub fn standard_id ( & self ) -> StandardId {
8289 // ID-28 to ID-18
8390 StandardId ( ( self . 0 >> 18 ) as u16 )
Original file line number Diff line number Diff line change @@ -17,11 +17,11 @@ where
1717{
1818 #[ inline]
1919 async fn delay_us ( & mut self , us : u32 ) {
20- T :: delay_us ( self , us) . await
20+ T :: delay_us ( self , us) . await ;
2121 }
2222
2323 #[ inline]
2424 async fn delay_ms ( & mut self , ms : u32 ) {
25- T :: delay_ms ( self , ms) . await
25+ T :: delay_ms ( self , ms) . await ;
2626 }
2727}
Original file line number Diff line number Diff line change @@ -22,11 +22,11 @@ where
2222{
2323 #[ inline]
2424 fn delay_us ( & mut self , us : u32 ) {
25- T :: delay_us ( self , us)
25+ T :: delay_us ( self , us) ;
2626 }
2727
2828 #[ inline]
2929 fn delay_ms ( & mut self , ms : u32 ) {
30- T :: delay_ms ( self , ms)
30+ T :: delay_ms ( self , ms) ;
3131 }
3232}
Original file line number Diff line number Diff line change @@ -58,10 +58,10 @@ pub trait Read: ErrorType {
5858 Err ( e) => return Err ( ReadExactError :: Other ( e) ) ,
5959 }
6060 }
61- if !buf. is_empty ( ) {
62- Err ( ReadExactError :: UnexpectedEof )
63- } else {
61+ if buf. is_empty ( ) {
6462 Ok ( ( ) )
63+ } else {
64+ Err ( ReadExactError :: UnexpectedEof )
6565 }
6666 }
6767}
@@ -170,7 +170,7 @@ impl<T: ?Sized + BufRead> BufRead for &mut T {
170170 }
171171
172172 fn consume ( & mut self , amt : usize ) {
173- T :: consume ( self , amt)
173+ T :: consume ( self , amt) ;
174174 }
175175}
176176
Original file line number Diff line number Diff line change @@ -362,10 +362,10 @@ pub trait Read: ErrorType {
362362 Err ( e) => return Err ( ReadExactError :: Other ( e) ) ,
363363 }
364364 }
365- if !buf. is_empty ( ) {
366- Err ( ReadExactError :: UnexpectedEof )
367- } else {
365+ if buf. is_empty ( ) {
368366 Ok ( ( ) )
367+ } else {
368+ Err ( ReadExactError :: UnexpectedEof )
369369 }
370370 }
371371}
@@ -535,7 +535,7 @@ impl<T: ?Sized + BufRead> BufRead for &mut T {
535535 }
536536
537537 fn consume ( & mut self , amt : usize ) {
538- T :: consume ( self , amt)
538+ T :: consume ( self , amt) ;
539539 }
540540}
541541
You can’t perform that action at this time.
0 commit comments