Skip to content

Commit 436aab2

Browse files
committed
Check can with clippy and fix clippy lints
1 parent 2ec11af commit 436aab2

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
features: ["rt"]
3636
include:
3737
- mcu: stm32f303xc
38-
features: rt,stm32-usbd
38+
features: rt,stm32-usbd,can
3939
steps:
4040
- uses: actions/checkout@v2
4141
- uses: actions-rs/toolchain@v1
@@ -65,7 +65,7 @@ jobs:
6565
with:
6666
token: ${{ secrets.GITHUB_TOKEN }}
6767
args: >
68-
--features=stm32f303xc,rt,stm32-usbd --lib --examples
68+
--features=stm32f303xc,rt,stm32-usbd,can --lib --examples
6969
-- -D warnings
7070
7171
rustfmt:

examples/can.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ fn main() -> ! {
8181
}
8282

8383
let data: [u8; 1] = [counter];
84-
let frame = CanFrame::data_frame(CanId::BaseId(ID.into()), &data);
84+
let frame = CanFrame::data_frame(CanId::BaseId(ID), &data);
8585

8686
block!(can_tx.transmit(&frame)).expect("Cannot send CAN frame");
8787
}

src/can.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ use nb::{self, Error};
1717

1818
use core::sync::atomic::{AtomicU8, Ordering};
1919

20-
const EXID_MASK: u32 = 0b11111_11111100_00000000_00000000;
20+
const EXID_MASK: u32 = 0b1_1111_1111_1100_0000_0000_0000_0000;
2121
const MAX_EXTENDED_ID: u32 = 0x1FFF_FFFF;
2222

2323
/// A CAN identifier, which can be either 11 or 27 (extended) bits.
@@ -302,7 +302,7 @@ impl Can {
302302
_tx: self._tx,
303303
};
304304

305-
return (transmitter, fifo0, fifo1);
305+
(transmitter, fifo0, fifo1)
306306
}
307307

308308
pub fn free(self) -> (stm32::CAN, gpioa::PA11<AF9>, gpioa::PA12<AF9>) {
@@ -353,7 +353,7 @@ impl embedded_hal_can::Transmitter for CanTransmitter {
353353
}),
354354
}
355355

356-
if let Some(_) = frame.data() {
356+
if frame.data().is_some() {
357357
for j in 0..frame.data.len() {
358358
let val = &frame.data[j];
359359

0 commit comments

Comments
 (0)