Skip to content

Updated logger to use HostStream for semihosting

ca70caf
Select commit
Loading
Failed to load commit list.
Sign in for the full log view
Merged

Fix CI Issues #42

Updated logger to use HostStream for semihosting
ca70caf
Select commit
Loading
Failed to load commit list.
GitHub Actions / clippy succeeded Jan 21, 2025 in 0s

clippy

34 warnings

Details

Results

Message level Amount
Internal compiler error 0
Error 0
Warning 34
Note 0
Help 0

Versions

  • rustc 1.84.0 (9fc6b4312 2025-01-07)
  • cargo 1.84.0 (66221abde 2024-11-19)
  • clippy 0.1.84 (9fc6b43126 2025-01-07)

Annotations

Check warning on line 132 in examples/usb_midi.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

creating a mutable reference to mutable static is discouraged

warning: creating a mutable reference to mutable static is discouraged
   --> examples/usb_midi.rs:132:43
    |
132 |                 UsbBus::new(usb, unsafe { &mut EP_MEMORY })
    |                                           ^^^^^^^^^^^^^^ mutable reference to mutable static
    |
    = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/static-mut-references.html>
    = note: mutable references to mutable statics are dangerous; it's undefined behavior if any other pointer to the static is used or if any other reference is created for the static while the mutable reference lives
    = note: `#[warn(static_mut_refs)]` on by default
help: use `&raw mut` instead to create a raw pointer
    |
132 |                 UsbBus::new(usb, unsafe { &raw mut EP_MEMORY })
    |                                           ~~~~~~~~

Check warning on line 219 in examples/usb_midi.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

unnecessary `if let` since only the `Ok` variant of the iterator element is used

warning: unnecessary `if let` since only the `Ok` variant of the iterator element is used
   --> examples/usb_midi.rs:207:17
    |
207 |                   for packet in buffer_reader.into_iter() {
    |                   ^             ------------------------- help: try: `buffer_reader.into_iter().flatten()`
    |  _________________|
    | |
208 | |                     if let Ok(packet) = packet {
209 | |                         match packet.message {
210 | |                             Message::NoteOn(_, _, U7::MIN) | Message::NoteOff(..) => {
...   |
218 | |                     }
219 | |                 }
    | |_________________^
    |
help: ...and remove the `if let` statement in the for loop
   --> examples/usb_midi.rs:208:21
    |
208 | /                     if let Ok(packet) = packet {
209 | |                         match packet.message {
210 | |                             Message::NoteOn(_, _, U7::MIN) | Message::NoteOff(..) => {
211 | |                                 led.set_low();
...   |
217 | |                         }
218 | |                     }
    | |_____________________^
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_flatten
    = note: `#[warn(clippy::manual_flatten)]` on by default

Check warning on line 71 in examples/usb_midi.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

the method `timer` doesn't need a mutable reference

warning: the method `timer` doesn't need a mutable reference
  --> examples/usb_midi.rs:71:13
   |
71 |             &mut ccdr.clocks,
   |             ^^^^^^^^^^^^^^^^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_mut_passed
   = note: `#[warn(clippy::unnecessary_mut_passed)]` on by default

Check warning on line 105 in examples/sdmmc.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

the function `sdmmc::init` doesn't need a mutable reference

warning: the function `sdmmc::init` doesn't need a mutable reference
   --> examples/sdmmc.rs:105:13
    |
105 |             &mut ccdr.clocks,
    |             ^^^^^^^^^^^^^^^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_mut_passed
    = note: `#[warn(clippy::unnecessary_mut_passed)]` on by default

Check warning on line 69 in examples/sdram.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

usage of a legacy numeric constant

warning: usage of a legacy numeric constant
  --> examples/sdram.rs:69:35
   |
69 |             data = (data + 1.0) % core::f32::MAX;
   |                                   ^^^^^^^^^^^^^^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#legacy_numeric_constants
help: use the associated constant instead
   |
69 |             data = (data + 1.0) % f32::MAX;
   |                                   ~~~~~~~~

Check warning on line 61 in examples/sdram.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

usage of a legacy numeric constant

warning: usage of a legacy numeric constant
  --> examples/sdram.rs:61:35
   |
61 |             data = (data + 1.0) % core::f32::MAX;
   |                                   ^^^^^^^^^^^^^^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#legacy_numeric_constants
   = note: `#[warn(clippy::legacy_numeric_constants)]` on by default
help: use the associated constant instead
   |
61 |             data = (data + 1.0) % f32::MAX;
   |                                   ~~~~~~~~

Check warning on line 21 in examples/sdram.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

unused import: `micromath::F32Ext`

warning: unused import: `micromath::F32Ext`
  --> examples/sdram.rs:21:9
   |
21 |     use micromath::F32Ext;
   |         ^^^^^^^^^^^^^^^^^
   |
   = note: `#[warn(unused_imports)]` on by default

Check warning on line 211 in src/audio.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

creating a mutable reference to mutable static is discouraged

warning: creating a mutable reference to mutable static is discouraged
   --> src/audio.rs:211:43
    |
211 |         let output = Output::new(unsafe { &mut TX_BUFFER });
    |                                           ^^^^^^^^^^^^^^ mutable reference to mutable static
    |
    = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/static-mut-references.html>
    = note: mutable references to mutable statics are dangerous; it's undefined behavior if any other pointer to the static is used or if any other reference is created for the static while the mutable reference lives
help: use `&raw mut` instead to create a raw pointer
    |
211 |         let output = Output::new(unsafe { &raw mut TX_BUFFER });
    |                                           ~~~~~~~~

Check warning on line 210 in src/audio.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

creating a mutable reference to mutable static is discouraged

warning: creating a mutable reference to mutable static is discouraged
   --> src/audio.rs:210:41
    |
210 |         let input = Input::new(unsafe { &mut RX_BUFFER });
    |                                         ^^^^^^^^^^^^^^ mutable reference to mutable static
    |
    = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/static-mut-references.html>
    = note: mutable references to mutable statics are dangerous; it's undefined behavior if any other pointer to the static is used or if any other reference is created for the static while the mutable reference lives
help: use `&raw mut` instead to create a raw pointer
    |
210 |         let input = Input::new(unsafe { &raw mut RX_BUFFER });
    |                                         ~~~~~~~~

Check warning on line 158 in src/audio.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

creating a mutable reference to mutable static is discouraged

warning: creating a mutable reference to mutable static is discouraged
   --> src/audio.rs:158:71
    |
158 |         let rx_buffer: &'static mut [u32; DMA_BUFFER_SIZE] = unsafe { &mut RX_BUFFER };
    |                                                                       ^^^^^^^^^^^^^^ mutable reference to mutable static
    |
    = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/static-mut-references.html>
    = note: mutable references to mutable statics are dangerous; it's undefined behavior if any other pointer to the static is used or if any other reference is created for the static while the mutable reference lives
help: use `&raw mut` instead to create a raw pointer
    |
158 |         let rx_buffer: &'static mut [u32; DMA_BUFFER_SIZE] = unsafe { &raw mut RX_BUFFER };
    |                                                                       ~~~~~~~~

Check warning on line 141 in src/audio.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

creating a mutable reference to mutable static is discouraged

warning: creating a mutable reference to mutable static is discouraged
   --> src/audio.rs:141:71
    |
141 |         let tx_buffer: &'static mut [u32; DMA_BUFFER_SIZE] = unsafe { &mut TX_BUFFER };
    |                                                                       ^^^^^^^^^^^^^^ mutable reference to mutable static
    |
    = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/static-mut-references.html>
    = note: mutable references to mutable statics are dangerous; it's undefined behavior if any other pointer to the static is used or if any other reference is created for the static while the mutable reference lives
    = note: `#[warn(static_mut_refs)]` on by default
help: use `&raw mut` instead to create a raw pointer
    |
141 |         let tx_buffer: &'static mut [u32; DMA_BUFFER_SIZE] = unsafe { &raw mut TX_BUFFER };
    |                                                                       ~~~~~~~~

Check warning on line 112 in src/system.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

the method `timer` doesn't need a mutable reference

warning: the method `timer` doesn't need a mutable reference
   --> src/system.rs:112:13
    |
112 |             &mut ccdr.clocks,
    |             ^^^^^^^^^^^^^^^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_mut_passed
    = note: `#[warn(clippy::unnecessary_mut_passed)]` on by default

Check warning on line 70 in src/system.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

this expression creates a reference which is immediately dereferenced by the compiler

warning: this expression creates a reference which is immediately dereferenced by the compiler
  --> src/system.rs:70:26
   |
70 |             .freeze(vos, &syscfg)
   |                          ^^^^^^^ help: change this to: `syscfg`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow

Check warning on line 141 in src/sdram.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

an implementation of `From` is preferred since it gives you `Into<_>` for free where the reverse isn't true

warning: an implementation of `From` is preferred since it gives you `Into<_>` for free where the reverse isn't true
   --> src/sdram.rs:141:1
    |
141 | impl<T: Sized> Into<&'static mut [T]> for Sdram {
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = help: `impl From<Local> for Foreign` is allowed by the orphan rules, for more information see
            https://doc.rust-lang.org/reference/items/implementations.html#trait-implementation-coherence
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#from_over_into
    = note: `#[warn(clippy::from_over_into)]` on by default
help: replace the `Into` implementation with `From<sdram::Sdram>`
    |
141 ~ impl<T: Sized> From<Sdram> for &'static mut [T] {
142 ~     fn from(val: Sdram) -> Self {
143 |         unsafe {
144 |             core::slice::from_raw_parts_mut(
145 ~                 val.inner as *mut T,
146 ~                 Sdram::bytes() / core::mem::size_of::<T>(),
    |

Check warning on line 95 in src/sdram.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

this function has too many arguments (63/7)

warning: this function has too many arguments (63/7)
  --> src/sdram.rs:31:5
   |
31 | /     pub fn new<D: DelayUs<u8>>(
32 | |         fmc_d: stm32::FMC,
33 | |         fmc_p: rcc::rec::Fmc,
34 | |         clocks: &rcc::CoreClocks,
...  |
94 | |         ii10: gpioi::PI10<Analog>,
95 | |     ) -> Self {
   | |_____________^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#too_many_arguments

Check warning on line 21 in src/sdmmc.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

this function has too many arguments (9/7)

warning: this function has too many arguments (9/7)
  --> src/sdmmc.rs:10:1
   |
10 | / pub fn init<P: SdmmcPeripheral>(
11 | |     daisy1: gpio::gpioc::PC11<Analog>,
12 | |     daisy2: gpio::gpioc::PC10<Analog>,
13 | |     daisy3: gpio::gpioc::PC9<Analog>,
...  |
20 | |     clocks: &hal::rcc::CoreClocks,
21 | | ) -> hal::sdmmc::Sdmmc<stm32::SDMMC1, P> {
   | |________________________________________^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#too_many_arguments

Check warning on line 13 in src/mpu.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

empty line after doc comment

warning: empty line after doc comment
  --> src/mpu.rs:12:1
   |
12 | / /// will panic if `size` is not at least 32 bytes.
13 | |
   | |_^
...
16 |   use log::info;
   |       --------- the comment documents this import
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#empty_line_after_doc_comments
   = note: `#[warn(clippy::empty_line_after_doc_comments)]` on by default
   = help: if the empty line is unintentional remove it
help: if the comment should document the parent module use an inner doc comment
   |
3  ~ //!
4  ~ //! Based on example from:
5  ~ //! https://github.com/richardeoin/stm32h7-fmc/blob/master/examples/stm32h747i-disco.rs
6  ~ //!
7  ~ //! Memory address in location will be 32-byte aligned.
8  ~ //!
9  ~ //! # Panics
10 ~ //!
11 ~ //! Function will panic if `size` is not a power of 2. Function
12 ~ //! will panic if `size` is not at least 32 bytes.
   |
help: if the documentation should include the empty line include it in the comment
   |
13 | ///
   |

Check warning on line 346 in src/hid.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

this if-then-else expression returns a bool literal

warning: this if-then-else expression returns a bool literal
   --> src/hid.rs:342:25
    |
342 |           let is_bright = if self.brightness > self.pwm {
    |  _________________________^
343 | |             true
344 | |         } else {
345 | |             false
346 | |         };
    | |_________^ help: you can reduce it to: `self.brightness > self.pwm`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_bool
    = note: `#[warn(clippy::needless_bool)]` on by default

Check warning on line 288 in src/hid.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

clamp-like pattern without using clamp function

warning: clamp-like pattern without using clamp function
   --> src/hid.rs:282:21
    |
282 |           let value = if value > 1.0 {
    |  _____________________^
283 | |             1.0
284 | |         } else if value < 0.0 {
285 | |             0.0
286 | |         } else {
287 | |             value
288 | |         };
    | |_________^ help: replace with clamp: `value.clamp(0.0, 1.0)`
    |
    = note: clamp will panic if max < min, min.is_nan(), or max.is_nan()
    = note: clamp returns NaN if the input is NaN
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_clamp

Check warning on line 80 in src/hid.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

manual implementation of `Option::map`

warning: manual implementation of `Option::map`
  --> src/hid.rs:76:33
   |
76 |           self.double_threshold = if let Some(double_threshold) = double_threshold {
   |  _________________________________^
77 | |             Some(double_threshold)
78 | |         } else {
79 | |             None
80 | |         };
   | |_________^ help: try: `double_threshold.map(|double_threshold| double_threshold)`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_map

Check warning on line 71 in src/hid.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

manual implementation of `Option::map`

warning: manual implementation of `Option::map`
  --> src/hid.rs:67:31
   |
67 |           self.held_threshold = if let Some(held_threshold) = held_threshold {
   |  _______________________________^
68 | |             Some(held_threshold)
69 | |         } else {
70 | |             None
71 | |         };
   | |_________^ help: try: `held_threshold.map(|held_threshold| held_threshold)`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_map
   = note: `#[warn(clippy::manual_map)]` on by default

Check warning on line 120 in src/gpio.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

this function has too many arguments (33/7)

warning: this function has too many arguments (33/7)
   --> src/gpio.rs:86:5
    |
86  | /     pub fn init(
87  | |         seed_led: gpio::gpioc::PC7<Analog>,
88  | |         codec: gpio::gpiob::PB11<Analog>,
89  | |         daisy0: Option<gpio::gpiob::PB12<Analog>>,
...   |
119 | |         daisy30: Option<gpio::gpiob::PB15<Analog>>,
120 | |     ) -> GPIO {
    | |_____________^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#too_many_arguments

Check warning on line 266 in src/flash.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

doc list item without indentation

warning: doc list item without indentation
   --> src/flash.rs:266:9
    |
266 |     /// page will remain unchanged.
    |         ^
    |
    = help: if this is supposed to be its own paragraph, add a blank line
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation
help: indent this line
    |
266 |     ///   page will remain unchanged.
    |         ++

Check warning on line 265 in src/flash.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

doc list item without indentation

warning: doc list item without indentation
   --> src/flash.rs:265:9
    |
265 |     /// data to be programmed are less than a full page, the data of all other bytes on the same
    |         ^
    |
    = help: if this is supposed to be its own paragraph, add a blank line
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation
help: indent this line
    |
265 |     ///   data to be programmed are less than a full page, the data of all other bytes on the same
    |         ++

Check warning on line 264 in src/flash.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

doc list item without indentation

warning: doc list item without indentation
   --> src/flash.rs:264:9
    |
264 |     /// page is reached, the address will wrap around to the beginning of the same page. If the
    |         ^
    |
    = help: if this is supposed to be its own paragraph, add a blank line
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation
help: indent this line
    |
264 |     ///   page is reached, the address will wrap around to the beginning of the same page. If the
    |         ++