diff --git a/rtic-common/src/wait_queue.rs b/rtic-common/src/wait_queue.rs index ef3afe85c5..a3f5cab00b 100644 --- a/rtic-common/src/wait_queue.rs +++ b/rtic-common/src/wait_queue.rs @@ -29,6 +29,12 @@ impl DoublyLinkedList { } } +impl Default for DoublyLinkedList { + fn default() -> Self { + Self::new() + } +} + impl DoublyLinkedList { const R: Ordering = Ordering::Relaxed; diff --git a/rtic-common/src/waker_registration.rs b/rtic-common/src/waker_registration.rs index 174765c2ca..46c8818af3 100644 --- a/rtic-common/src/waker_registration.rs +++ b/rtic-common/src/waker_registration.rs @@ -64,3 +64,9 @@ impl CriticalSectionWakerRegistration { }); } } + +impl Default for CriticalSectionWakerRegistration { + fn default() -> Self { + Self::new() + } +} diff --git a/rtic-macros/src/codegen/main.rs b/rtic-macros/src/codegen/main.rs index 80f2cf6b8a..85808dd689 100644 --- a/rtic-macros/src/codegen/main.rs +++ b/rtic-macros/src/codegen/main.rs @@ -21,7 +21,7 @@ pub fn codegen(app: &App, analysis: &Analysis) -> TokenStream2 { let call_idle = if let Some(idle) = &app.idle { let name = &idle.name; quote!(#name(#name::Context::new())) - } else if analysis.channels.get(&0).is_some() { + } else if analysis.channels.contains_key(&0) { let dispatcher = util::zero_prio_dispatcher_ident(); quote!(#dispatcher();) } else { diff --git a/rtic-macros/src/codegen/module.rs b/rtic-macros/src/codegen/module.rs index 17c8ce7dfd..1b4ecaf041 100644 --- a/rtic-macros/src/codegen/module.rs +++ b/rtic-macros/src/codegen/module.rs @@ -147,7 +147,7 @@ pub fn codegen(ctxt: Context, app: &App, analysis: &Analysis) -> TokenStream2 { let priority = spawnee.args.priority; let cfgs = &spawnee.cfgs; // Store a copy of the task cfgs - task_cfgs = cfgs.clone(); + task_cfgs.clone_from(cfgs); let pend_interrupt = if priority > 0 { let int_mod = interrupt_mod(app); diff --git a/rtic-sync/src/channel.rs b/rtic-sync/src/channel.rs index 16cf9f768a..b49ed2f433 100644 --- a/rtic-sync/src/channel.rs +++ b/rtic-sync/src/channel.rs @@ -53,6 +53,12 @@ struct UnsafeAccess<'a, const N: usize> { num_senders: &'a mut usize, } +impl Default for Channel { + fn default() -> Self { + Self::new() + } +} + impl Channel { const _CHECK: () = assert!(N < 256, "This queue support a maximum of 255 entries"); diff --git a/rtic-time/src/timer_queue.rs b/rtic-time/src/timer_queue.rs index ea2c806a1c..357deb24dd 100644 --- a/rtic-time/src/timer_queue.rs +++ b/rtic-time/src/timer_queue.rs @@ -87,6 +87,12 @@ impl LinkPtr { unsafe impl Send for LinkPtr {} unsafe impl Sync for LinkPtr {} +impl Default for TimerQueue { + fn default() -> Self { + Self::new() + } +} + impl TimerQueue { /// Make a new queue. pub const fn new() -> Self { diff --git a/rtic/src/export/executor.rs b/rtic/src/export/executor.rs index 5d808a14d9..8d42c4153f 100644 --- a/rtic/src/export/executor.rs +++ b/rtic/src/export/executor.rs @@ -52,6 +52,12 @@ impl AsyncTaskExecutorPtr { } } +impl Default for AsyncTaskExecutorPtr { + fn default() -> Self { + Self::new() + } +} + /// Executor for an async task. pub struct AsyncTaskExecutor { // `task` is protected by the `running` flag. @@ -80,6 +86,12 @@ macro_rules! from_ptr_n_args { }; } +impl Default for AsyncTaskExecutor { + fn default() -> Self { + Self::new() + } +} + impl AsyncTaskExecutor { /// Create a new executor. #[inline(always)]