From 2c1e83075526b150f263ec5a97b2cebe7ce941ce Mon Sep 17 00:00:00 2001 From: Nikolay Novik Date: Sun, 9 Nov 2025 10:52:51 -0500 Subject: [PATCH] chore: Address idiomatic rust lints. --- README.md | 2 +- src/commands.rs | 8 ++++---- src/responses.rs | 8 ++++---- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 7352d14..d0b9822 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# SmartAudio +# `SmartAudio` [![CI](https://github.com/jettify/smartaudio/actions/workflows/CI.yml/badge.svg)](https://github.com/jettify/smartaudio/actions/workflows/CI.yml) [![codecov](https://codecov.io/gh/jettify/smartaudio/graph/badge.svg?token=RCM2W4C0LB)](https://codecov.io/gh/jettify/smartaudio) [![crates.io](https://img.shields.io/crates/v/smartaudio)](https://crates.io/crates/smartaudio) diff --git a/src/commands.rs b/src/commands.rs index 2547687..f9f6ccf 100644 --- a/src/commands.rs +++ b/src/commands.rs @@ -82,10 +82,10 @@ pub struct SetModeCommand { impl SmartAudioCommand for SetModeCommand { fn to_bytes(&self, buffer: &mut [u8]) -> Result { - let mode = (self.pitmode_in_range_active as u8 * mode_flags::PITMODE_IN_RANGE) - | (self.pitmode_out_range_active as u8 * mode_flags::PITMODE_OUT_RANGE) - | (self.pitmode_enabled as u8 * mode_flags::PITMODE_ENABLED) - | (self.unlocked as u8 * mode_flags::UNLOCKED); + let mode = (u8::from(self.pitmode_in_range_active) * mode_flags::PITMODE_IN_RANGE) + | (u8::from(self.pitmode_out_range_active) * mode_flags::PITMODE_OUT_RANGE) + | (u8::from(self.pitmode_enabled) * mode_flags::PITMODE_ENABLED) + | (u8::from(self.unlocked) * mode_flags::UNLOCKED); let payload = [mode]; frame_payload(buffer, command::SET_MODE, &payload) } diff --git a/src/responses.rs b/src/responses.rs index 94fbc66..0fcb3ab 100644 --- a/src/responses.rs +++ b/src/responses.rs @@ -157,11 +157,11 @@ impl SmartAudioReponse for Settings { channel, power_level, frequency, + unlocked, + user_frequency_mode, pitmode_enabled, pitmode_in_range_active, pitmode_out_range_active, - unlocked, - user_frequency_mode, power_settings, } } @@ -214,7 +214,7 @@ pub struct ResponseIterator<'a, 'b> { position: usize, } -impl<'a, 'b> Iterator for ResponseIterator<'a, 'b> { +impl Iterator for ResponseIterator<'_, '_> { type Item = Result; fn next(&mut self) -> Option { @@ -224,7 +224,7 @@ impl<'a, 'b> Iterator for ResponseIterator<'a, 'b> { match self.parser.push_byte(byte) { Ok(Some(response)) => return Some(Ok(response)), - Ok(None) => continue, // Continue feeding bytes + Ok(None) => (), Err(e) => return Some(Err(e)), } }