Description
Since I absolutely love clippy, I also wanted to run it on my embedded experiments but essentially failed to do so because I ran into tons of:
error: you have declared `#[inline(always)]` on `bit`. This is usually a bad idea
warnings and so I decided to look into whether that provides any benefit to the generated code at all and surprise it does not provide any benefit at all:
When compiling in release mode (with lto on) the only difference is that main
is not inlined into reset_handler
which is actually a positive since it makes debugging a whole lot easier if you have a trivially named main function you can put your breakpoint on.
In debug mode it has a slightly larger impact of around 20% but that seems to be mostly coming other skipped inlining opportunities rather any of the functions marked als always inline not being inline anymore which can probably offset by adjusting the inlining target, if necessary.
But most importantly to me, this allows me to run clippy just fine:
warning: equality checks against true are unnecessary
--> examples/flash_systick_hsi48.rs:30:16
|
30 | if rcc.cr2.read().hsi48rdy().bit() == true {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try simplifying it as shown: `rcc.cr2.read().hsi48rdy().bit()`
|
= note: #[warn(bool_comparison)] on by default
= help: for further information visit https://github.com/Manishearth/rust-clippy/wiki#bool_comparison
Woohoo!