From 3b83002afdd9c4fdd99c1fe53b8525392906f680 Mon Sep 17 00:00:00 2001 From: Adin Ackerman Date: Fri, 1 Nov 2024 14:04:44 -0700 Subject: [PATCH] update ci (clippy) --- ci.sh | 6 +++--- cookie-cutter/src/lib.rs | 4 ++-- embedded-command/src/command_buffer.rs | 8 +++++++- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/ci.sh b/ci.sh index 9e4526c..1a03c98 100755 --- a/ci.sh +++ b/ci.sh @@ -7,9 +7,6 @@ rustup toolchain install nightly --component miri TARGETS=("thumbv6m-none-eabi" "thumbv7em-none-eabi" "thumbv7em-none-eabihf") CRATES=("macros" "cookie-cutter" "dispatch-bundle") -# clippy -cargo clippy - # build for TARGET in "${TARGETS[@]}"; do @@ -29,6 +26,9 @@ done cargo +nightly miri test -p embedded-command command_buffer +# clippy +cargo clippy + # crate-specific # cookie-cutter diff --git a/cookie-cutter/src/lib.rs b/cookie-cutter/src/lib.rs index 9956661..2c7af6a 100644 --- a/cookie-cutter/src/lib.rs +++ b/cookie-cutter/src/lib.rs @@ -84,13 +84,13 @@ pub unsafe trait SerializeBuf: SerializeIter { fn serialize_buf(&self, dest: &mut Self::Serialized) { // SAFETY: dependent on safety of trait implementation. // `Serialized` must be of sufficient length. - unsafe { SerializeIter::serialize_iter(self, &mut dest.get_iter_mut()).unwrap_unchecked() }; + unsafe { SerializeIter::serialize_iter(self, dest.get_iter_mut()).unwrap_unchecked() }; } /// Deserialize the implementer type from a /// serialization medium. fn deserialize_buf(src: &Self::Serialized) -> Result { - SerializeIter::deserialize_iter(&mut src.get_iter()).or_else(|err| match err { + SerializeIter::deserialize_iter(src.get_iter()).or_else(|err| match err { error::Error::Invalid => Err(error::Invalid), // SAFETY: dependent on safety of trait implementation. // `Serialized` must be of sufficient length. diff --git a/embedded-command/src/command_buffer.rs b/embedded-command/src/command_buffer.rs index 2dd9225..d675b3a 100644 --- a/embedded-command/src/command_buffer.rs +++ b/embedded-command/src/command_buffer.rs @@ -11,6 +11,12 @@ pub struct CommandBuffer { size: usize, } +impl Default for CommandBuffer { + fn default() -> Self { + Self::new() + } +} + impl CommandBuffer { pub const fn new() -> Self { Self { @@ -88,7 +94,7 @@ impl CommandBuffer { /// Create an iterator for the command buffer. #[inline] - pub fn iter<'a>(&'a mut self) -> CommandBufferIter<'a, N> { + pub fn iter(&mut self) -> CommandBufferIter<'_, N> { CommandBufferIter::new(self) }