Skip to content

Commit 9843900

Browse files
committed
refactor(examples): inline format args
Ditto. The instances in `basic_wio_terminal` were missed by Clippy due to conditional compilation.
1 parent 64f3e49 commit 9843900

File tree

3 files changed

+6
-12
lines changed

3 files changed

+6
-12
lines changed

examples/basic/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ const fn configure_app(b: &mut r3_kernel::Cfg<'_, SystemTraits>) -> Objects {
3939
}
4040

4141
fn task1_body() {
42-
log::trace!("COTTAGE = {:#?}", COTTAGE);
42+
log::trace!("COTTAGE = {COTTAGE:#?}");
4343
log::trace!("KENREL = {:#?}", System::debug());
4444

4545
COTTAGE.task2.activate().unwrap();

examples/basic_wio_terminal/src/main.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -848,10 +848,10 @@ fn panic(info: &PanicInfo) -> ! {
848848

849849
#[cortex_m_rt::exception]
850850
fn DefaultHandler(x: i16) -> ! {
851-
panic!("unhandled exception {}", x);
851+
panic!("unhandled exception {x}");
852852
}
853853

854854
#[cortex_m_rt::exception]
855855
fn HardFault(fr: &cortex_m_rt::ExceptionFrame) -> ! {
856-
panic!("hard fault: {:?}", fr);
856+
panic!("hard fault: {fr:?}");
857857
}

examples/common/build.rs

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ fn main() {
4040
w!("pub static ANIMATION_FRAMES_565: &[fn() -> \
4141
ImageRaw<'static, Rgb565, LittleEndian>] = &[\n");
4242
for i in 0..frames.len() {
43-
w!(" animation_{}_565,\n", i);
43+
w!(" animation_{i}_565,\n");
4444
}
4545
w!("];\n");
4646

@@ -69,14 +69,8 @@ fn write_image(out: &mut impl Write, dir: &Path, name: &str, image: &RgbaImage)
6969
.collect::<Vec<u8>>(),
7070
)
7171
.unwrap();
72-
w!(
73-
"pub fn {}() -> ImageRaw<'static, Rgb565, LittleEndian> {{\n",
74-
name565
75-
);
76-
w!(
77-
" static IMAGE: &[u8] = include_bytes!(\"{}\");\n",
78-
name565
79-
);
72+
w!("pub fn {name565}() -> ImageRaw<'static, Rgb565, LittleEndian> {{\n");
73+
w!(" static IMAGE: &[u8] = include_bytes!(\"{name565}\");\n");
8074
w!(" ImageRaw::new(IMAGE, {})\n", image.width());
8175
w!("}}\n");
8276
}

0 commit comments

Comments
 (0)