diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index e164fe0..f99fef5 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -28,7 +28,7 @@ jobs: - name: Install Rust uses: dtolnay/rust-toolchain@stable with: - toolchain: 1.74.0 + toolchain: stable - name: cargo build run: cargo build --release --features ${{ matrix.feature }} - name: Create release directory @@ -66,7 +66,7 @@ jobs: - name: Install Rust uses: dtolnay/rust-toolchain@stable with: - toolchain: 1.74.0 + toolchain: stable - name: Install cargo bundle run: cargo install cargo-bundle - name: cargo build @@ -92,7 +92,7 @@ jobs: - name: Install Rust uses: dtolnay/rust-toolchain@stable with: - toolchain: 1.74.0 + toolchain: stable - name: cargo build run: cargo build --release - name: Download butler diff --git a/changelog.md b/changelog.md index f612491..2d346e7 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,10 @@ # 0.2.x +## 0.2.4 + +- Fixed clippy warnings for Rust 1.78 +- The GitHub workflow for building Cacophony now uses the latest version of Rust. + ## 0.2.3 - Optimized text and rectangle rendering, which reduces CPU usage by around 5%. diff --git a/common/src/u64_or_f32.rs b/common/src/u64_or_f32.rs index a7d94f2..b84b75e 100644 --- a/common/src/u64_or_f32.rs +++ b/common/src/u64_or_f32.rs @@ -1,6 +1,6 @@ use serde::de::{Error, Visitor}; use serde::{Deserialize, Serialize}; -use std::fmt; +use std::fmt::{self, Display}; /// A value that is expressed as a u64 or an f32. #[derive(Debug, PartialEq, Copy, Clone, Default)] @@ -46,9 +46,9 @@ impl From for U64orF32 { } } -impl ToString for U64orF32 { - fn to_string(&self) -> String { - self.u.to_string() +impl Display for U64orF32 { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + write!(f, "{}", self.u) } } diff --git a/input/src/lib.rs b/input/src/lib.rs index 5e216e6..d8f8bfc 100644 --- a/input/src/lib.rs +++ b/input/src/lib.rs @@ -316,7 +316,7 @@ impl Input { .iter() .filter(|c| Self::is_valid_char(c)) .copied() - .collect(), + .collect::>(), ) } @@ -329,7 +329,7 @@ impl Input { .iter() .filter(|c| Self::is_valid_char(c) && !ILLEGAL_FILENAME_CHARACTERS.contains(c)) .copied() - .collect(), + .collect::>(), ) } @@ -358,7 +358,7 @@ impl Input { .iter() .filter(|c| c.is_ascii_digit()) .copied() - .collect(), + .collect::>(), ); // Try to get a value. match T::from_str(string.as_str()) { @@ -369,7 +369,7 @@ impl Input { } /// Modify a string with qwerty input from this frame. - fn modify_string(&self, string: &mut String, chars: &Vec) -> bool { + fn modify_string(&self, string: &mut String, chars: &[char]) -> bool { // Delete the last character. if self.backspace { string.pop().is_some() diff --git a/io/src/export_panel.rs b/io/src/export_panel.rs index 813dd94..905bb91 100644 --- a/io/src/export_panel.rs +++ b/io/src/export_panel.rs @@ -34,7 +34,7 @@ impl Panel for ExportPanel { // We're done. let export_state = conn.export_state.lock(); if *export_state == ExportState::NotExporting { - state.panels = self.panels.clone(); + state.panels.clone_from(&self.panels); state.focus.set(self.focus); } None diff --git a/io/src/lib.rs b/io/src/lib.rs index 67036d6..cc6bb28 100644 --- a/io/src/lib.rs +++ b/io/src/lib.rs @@ -325,7 +325,7 @@ impl IO { // We aren't exporting already. if export_state == ExportState::NotExporting { self.pre_export_focus = state.focus.get(); - self.pre_export_panels = state.panels.clone(); + self.pre_export_panels.clone_from(&state.panels); self.open_file_panel.export(state, paths_state, conn) } } else if input.happened(&InputEvent::ImportMidi) { diff --git a/io/src/popup.rs b/io/src/popup.rs index abc86bd..1859581 100644 --- a/io/src/popup.rs +++ b/io/src/popup.rs @@ -13,14 +13,14 @@ impl Popup { /// Enable the panel. Store the state of the active panels. Set the state's active panels. pub fn enable(&mut self, state: &mut State, panels: Vec) { self.focus = state.focus.get(); - self.panels = state.panels.clone(); + self.panels.clone_from(&state.panels); state.panels = panels; state.focus = Index::new(0, state.panels.len()); } /// Disable the panel. Set the state's active panels. pub fn disable(&self, state: &mut State) { - state.panels = self.panels.clone(); + state.panels.clone_from(&self.panels); state.focus = Index::new(self.focus, self.panels.len()); } }