Clippy fixes
This commit is contained in:
@ -130,7 +130,7 @@ where
|
||||
/// closed by `recv` until they are all consumed.
|
||||
///
|
||||
/// [`close`]: Self::close
|
||||
pub fn recv<'m>(&'m mut self) -> RecvFuture<'m, M, T, N> {
|
||||
pub fn recv(&mut self) -> RecvFuture<'_, M, T, N> {
|
||||
RecvFuture {
|
||||
channel: self.channel,
|
||||
}
|
||||
@ -469,7 +469,7 @@ impl<T, const N: usize> ChannelState<T, N> {
|
||||
}
|
||||
Err(message) => {
|
||||
cx.into_iter()
|
||||
.for_each(|cx| self.set_senders_waker(&cx.waker()));
|
||||
.for_each(|cx| self.set_senders_waker(cx.waker()));
|
||||
Err(TrySendError::Full(message))
|
||||
}
|
||||
}
|
||||
@ -487,7 +487,7 @@ impl<T, const N: usize> ChannelState<T, N> {
|
||||
fn is_closed_with_context(&mut self, cx: Option<&mut Context<'_>>) -> bool {
|
||||
if self.closed {
|
||||
cx.into_iter()
|
||||
.for_each(|cx| self.set_senders_waker(&cx.waker()));
|
||||
.for_each(|cx| self.set_senders_waker(cx.waker()));
|
||||
true
|
||||
} else {
|
||||
false
|
||||
|
@ -12,6 +12,7 @@ impl<T> UninitCell<T> {
|
||||
(*self.0.as_ptr()).get()
|
||||
}
|
||||
|
||||
#[allow(clippy::mut_from_ref)]
|
||||
pub unsafe fn as_mut(&self) -> &mut T {
|
||||
&mut *self.as_mut_ptr()
|
||||
}
|
||||
|
@ -95,7 +95,7 @@ impl Spawner {
|
||||
/// fails. This is here to allow conditional use of `defmt::unwrap!`
|
||||
/// without introducing a `defmt` feature in the `embassy_macros` package,
|
||||
/// which would require use of `-Z namespaced-features`.
|
||||
pub fn must_spawn<F>(&self, token: SpawnToken<F>) -> () {
|
||||
pub fn must_spawn<F>(&self, token: SpawnToken<F>) {
|
||||
unwrap!(self.spawn(token));
|
||||
}
|
||||
|
||||
|
@ -39,7 +39,7 @@ impl<R: AsyncBufRead + ?Sized + Unpin> Future for ReadExact<'_, R> {
|
||||
this.buf[..n].copy_from_slice(&buf[..n]);
|
||||
Pin::new(&mut this.reader).consume(n);
|
||||
{
|
||||
let (_, rest) = mem::replace(&mut this.buf, &mut []).split_at_mut(n);
|
||||
let (_, rest) = mem::take(&mut this.buf).split_at_mut(n);
|
||||
this.buf = rest;
|
||||
}
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ impl<W: AsyncWrite + ?Sized + Unpin> Future for WriteAll<'_, W> {
|
||||
while !this.buf.is_empty() {
|
||||
let n = ready!(Pin::new(&mut this.writer).poll_write(cx, this.buf))?;
|
||||
{
|
||||
let (_, rest) = mem::replace(&mut this.buf, &[]).split_at(n);
|
||||
let (_, rest) = mem::take(&mut this.buf).split_at(n);
|
||||
this.buf = rest;
|
||||
}
|
||||
if n == 0 {
|
||||
|
@ -3,6 +3,7 @@
|
||||
#![feature(const_fn_trait_bound)]
|
||||
#![feature(const_fn_fn_ptr_basics)]
|
||||
#![feature(type_alias_impl_trait)]
|
||||
#![allow(clippy::new_without_default)]
|
||||
|
||||
// This mod MUST go first, so that the others see its macros.
|
||||
pub(crate) mod fmt;
|
||||
|
@ -13,10 +13,10 @@ pub struct Delay;
|
||||
impl crate::traits::delay::Delay for Delay {
|
||||
type DelayFuture<'a> = impl Future<Output = ()> + 'a;
|
||||
|
||||
fn delay_ms<'a>(&'a mut self, millis: u64) -> Self::DelayFuture<'a> {
|
||||
fn delay_ms(&mut self, millis: u64) -> Self::DelayFuture<'_> {
|
||||
Timer::after(Duration::from_millis(millis))
|
||||
}
|
||||
fn delay_us<'a>(&'a mut self, micros: u64) -> Self::DelayFuture<'a> {
|
||||
fn delay_us(&mut self, micros: u64) -> Self::DelayFuture<'_> {
|
||||
Timer::after(Duration::from_micros(micros))
|
||||
}
|
||||
}
|
||||
|
@ -45,6 +45,7 @@ impl<T> Forever<T> {
|
||||
///
|
||||
/// Returns a mutable reference to the stored value.
|
||||
#[inline(always)]
|
||||
#[allow(clippy::mut_from_ref)]
|
||||
pub fn put(&'static self, val: T) -> &'static mut T {
|
||||
if self
|
||||
.used
|
||||
@ -63,6 +64,7 @@ impl<T> Forever<T> {
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
#[allow(clippy::mut_from_ref)]
|
||||
pub fn put_with(&'static self, val: impl FnOnce() -> T) -> &'static mut T {
|
||||
if self
|
||||
.used
|
||||
@ -81,6 +83,7 @@ impl<T> Forever<T> {
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
#[allow(clippy::mut_from_ref)]
|
||||
pub unsafe fn steal(&'static self) -> &'static mut T {
|
||||
let p = self.t.get();
|
||||
let p = (&mut *p).as_mut_ptr();
|
||||
|
Reference in New Issue
Block a user