From 11607643adbb45675ce3c1487959ba7a6e2313c8 Mon Sep 17 00:00:00 2001 From: chrysn Date: Wed, 28 Aug 2024 20:34:32 +0200 Subject: [PATCH] treewide: Reduce use of cstr! macro in favor of c"" literals --- Cargo.toml | 2 ++ src/gcoap.rs | 2 +- src/panic.rs | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index b8c240b..4d8109e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -28,6 +28,8 @@ mutex-trait = "0.2" bare-metal = "1" +# Only used for shell, where a macro is described to take a string literal and +# in the macro implementation turns it into a CStr. cstr = "^0.2.11" heapless = "^0.8" diff --git a/src/gcoap.rs b/src/gcoap.rs index 4e530d0..8d90768 100644 --- a/src/gcoap.rs +++ b/src/gcoap.rs @@ -155,7 +155,7 @@ where /// [coap_handler::Handler], you can wrap it in [crate::coap_handler::GcoapHandler] to for adaptation. pub fn new_catch_all(handler: &'a mut H) -> Self { Self::new( - cstr::cstr!("/"), + c"/", riot_sys::COAP_GET | riot_sys::COAP_POST | riot_sys::COAP_PUT diff --git a/src/panic.rs b/src/panic.rs index 688d5da..0176125 100644 --- a/src/panic.rs +++ b/src/panic.rs @@ -22,7 +22,7 @@ fn panic(info: &::core::panic::PanicInfo) -> ! { unsafe { riot_sys::core_panic( riot_sys::core_panic_t_PANIC_GENERAL_ERROR, - cstr::cstr!("RUST PANIC").as_ptr() as _, + c"RUST PANIC".as_ptr() as _, ) }; } else {