Fix clippy lints

This commit is contained in:
Emil Fresk 2024-05-27 10:48:58 +02:00
parent 9989af1b97
commit 2efdef6029
7 changed files with 38 additions and 2 deletions

View file

@ -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;

View file

@ -64,3 +64,9 @@ impl CriticalSectionWakerRegistration {
});
}
}
impl Default for CriticalSectionWakerRegistration {
fn default() -> Self {
Self::new()
}
}

View file

@ -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 {

View file

@ -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);

View file

@ -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");

View file

@ -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 {

View file

@ -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)]