aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--rtic-common/src/wait_queue.rs6
-rw-r--r--rtic-common/src/waker_registration.rs6
-rw-r--r--rtic-macros/src/codegen/main.rs2
-rw-r--r--rtic-macros/src/codegen/module.rs2
-rw-r--r--rtic-sync/src/channel.rs6
-rw-r--r--rtic-time/src/timer_queue.rs6
-rw-r--r--rtic/src/export/executor.rs12
7 files changed, 38 insertions, 2 deletions
diff --git a/rtic-common/src/wait_queue.rs b/rtic-common/src/wait_queue.rs
index ef3afe8..a3f5cab 100644
--- a/rtic-common/src/wait_queue.rs
+++ b/rtic-common/src/wait_queue.rs
@@ -29,6 +29,12 @@ impl<T> DoublyLinkedList<T> {
}
}
+impl<T> Default for DoublyLinkedList<T> {
+ fn default() -> Self {
+ Self::new()
+ }
+}
+
impl<T: Clone> DoublyLinkedList<T> {
const R: Ordering = Ordering::Relaxed;
diff --git a/rtic-common/src/waker_registration.rs b/rtic-common/src/waker_registration.rs
index 174765c..46c8818 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 80f2cf6..85808dd 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 17c8ce7..1b4ecaf 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 16cf9f7..b49ed2f 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<T, const N: usize> Default for Channel<T, N> {
+ fn default() -> Self {
+ Self::new()
+ }
+}
+
impl<T, const N: usize> Channel<T, N> {
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 ea2c806..357deb2 100644
--- a/rtic-time/src/timer_queue.rs
+++ b/rtic-time/src/timer_queue.rs
@@ -87,6 +87,12 @@ impl<Backend: TimerQueueBackend> LinkPtr<Backend> {
unsafe impl<Backend: TimerQueueBackend> Send for LinkPtr<Backend> {}
unsafe impl<Backend: TimerQueueBackend> Sync for LinkPtr<Backend> {}
+impl<Backend: TimerQueueBackend> Default for TimerQueue<Backend> {
+ fn default() -> Self {
+ Self::new()
+ }
+}
+
impl<Backend: TimerQueueBackend> TimerQueue<Backend> {
/// Make a new queue.
pub const fn new() -> Self {
diff --git a/rtic/src/export/executor.rs b/rtic/src/export/executor.rs
index 5d808a1..8d42c41 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<F: Future> {
// `task` is protected by the `running` flag.
@@ -80,6 +86,12 @@ macro_rules! from_ptr_n_args {
};
}
+impl<F: Future> Default for AsyncTaskExecutor<F> {
+ fn default() -> Self {
+ Self::new()
+ }
+}
+
impl<F: Future> AsyncTaskExecutor<F> {
/// Create a new executor.
#[inline(always)]