diff --git a/esp-hal-embassy/src/executor/thread.rs b/esp-hal-embassy/src/executor/thread.rs index b90d00a3425..e21c837001c 100644 --- a/esp-hal-embassy/src/executor/thread.rs +++ b/esp-hal-embassy/src/executor/thread.rs @@ -72,9 +72,7 @@ impl Executor { multi_core, doc = r#" - This will use software-interrupt 3 which isn't - available for anything else to wake the other core(s). - "# +This will use software-interrupt 3 which isn't available for anything else to wake the other core(s)."# )] pub fn new() -> Self { #[cfg(multi_core)] diff --git a/esp-hal/build.rs b/esp-hal/build.rs index f9aa7fb1ebf..d6c28894540 100644 --- a/esp-hal/build.rs +++ b/esp-hal/build.rs @@ -117,12 +117,6 @@ fn main() -> Result<(), Box> { )?; } - // needed for before_snippet! macro - let host = env::var_os("HOST").expect("HOST not set"); - if let Some("windows") = host.to_str().unwrap().split('-').nth(2) { - println!("cargo:rustc-cfg=host_os=\"windows\""); - } - // With the architecture-specific linker scripts taken care of, we can copy all // remaining linker scripts which are common to all devices: copy_dir_all(&config_symbols, "ld/sections", &out)?; diff --git a/esp-hal/doc-helper/before b/esp-hal/doc-helper/before deleted file mode 100644 index 7781574e3d0..00000000000 --- a/esp-hal/doc-helper/before +++ /dev/null @@ -1,12 +0,0 @@ -# #![no_std] -# use esp_hal::peripherals::Peripherals; -# use esp_hal::clock::ClockControl; -# use esp_hal::system::SystemControl; -# #[panic_handler] -# fn panic(_ : &core::panic::PanicInfo) -> ! { -# loop {} -# } -# fn main() { -# let peripherals = Peripherals::take(); -# let system = SystemControl::new(peripherals.SYSTEM); -# let mut clocks = ClockControl::boot_defaults(system.clock_control).freeze(); \ No newline at end of file diff --git a/esp-hal/src/lib.rs b/esp-hal/src/lib.rs index 9710e12bea0..1af867cfc8a 100644 --- a/esp-hal/src/lib.rs +++ b/esp-hal/src/lib.rs @@ -621,26 +621,22 @@ unsafe extern "C" fn stack_chk_fail() { #[doc(hidden)] /// Helper macro for checking doctest code snippets -#[cfg(not(host_os = "windows"))] #[macro_export] macro_rules! before_snippet { () => { - core::include_str!(concat!( - env!("CARGO_MANIFEST_DIR"), - "/../esp-hal/doc-helper/before" - )) - }; -} - -#[doc(hidden)] -/// Helper macro for checking doctest code snippets -#[cfg(host_os = "windows")] -#[macro_export] -macro_rules! before_snippet { - () => { - core::include_str!(concat!( - env!("CARGO_MANIFEST_DIR"), - "\\..\\esp-hal\\doc-helper\\before" - )) + r#" +# #![no_std] +# use esp_hal::peripherals::Peripherals; +# use esp_hal::clock::ClockControl; +# use esp_hal::system::SystemControl; +# #[panic_handler] +# fn panic(_ : &core::panic::PanicInfo) -> ! { +# loop {} +# } +# fn main() { +# let peripherals = Peripherals::take(); +# let system = SystemControl::new(peripherals.SYSTEM); +# let mut clocks = ClockControl::boot_defaults(system.clock_control).freeze(); +"# }; } diff --git a/esp-hal/src/mcpwm/operator.rs b/esp-hal/src/mcpwm/operator.rs index 272b13b8e4e..de6c5fe3517 100644 --- a/esp-hal/src/mcpwm/operator.rs +++ b/esp-hal/src/mcpwm/operator.rs @@ -480,7 +480,7 @@ impl<'d, Pin: OutputPin, PWM: PwmPeripheral, const OP: u8, const IS_A: bool> /// /// # H-Bridge example /// ```rust, no_run -#[doc = include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/doc-helper/before"))] +#[doc = crate::before_snippet!()] /// # use esp_hal::{mcpwm, prelude::*}; /// # use esp_hal::mcpwm::{McPwm, PeripheralClockConfig}; /// # use esp_hal::mcpwm::operator::{DeadTimeCfg, PwmPinConfig, PWMStream};