Skip to content

Commit

Permalink
Fixed clippy warnings for Rust 1.78
Browse files Browse the repository at this point in the history
  • Loading branch information
subalterngames committed May 16, 2024
1 parent da9e964 commit e85de4e
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 15 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
5 changes: 5 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -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%.
Expand Down
8 changes: 4 additions & 4 deletions common/src/u64_or_f32.rs
Original file line number Diff line number Diff line change
@@ -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)]
Expand Down Expand Up @@ -46,9 +46,9 @@ impl From<f32> 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)
}
}

Expand Down
8 changes: 4 additions & 4 deletions input/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ impl Input {
.iter()
.filter(|c| Self::is_valid_char(c))
.copied()
.collect(),
.collect::<Vec<char>>(),
)
}

Expand All @@ -329,7 +329,7 @@ impl Input {
.iter()
.filter(|c| Self::is_valid_char(c) && !ILLEGAL_FILENAME_CHARACTERS.contains(c))
.copied()
.collect(),
.collect::<Vec<char>>(),
)
}

Expand Down Expand Up @@ -358,7 +358,7 @@ impl Input {
.iter()
.filter(|c| c.is_ascii_digit())
.copied()
.collect(),
.collect::<Vec<char>>(),
);
// Try to get a value.
match T::from_str(string.as_str()) {
Expand All @@ -369,7 +369,7 @@ impl Input {
}

/// Modify a string with qwerty input from this frame.
fn modify_string(&self, string: &mut String, chars: &Vec<char>) -> bool {
fn modify_string(&self, string: &mut String, chars: &[char]) -> bool {
// Delete the last character.
if self.backspace {
string.pop().is_some()
Expand Down
2 changes: 1 addition & 1 deletion io/src/export_panel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion io/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
4 changes: 2 additions & 2 deletions io/src/popup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<PanelType>) {
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());
}
}

0 comments on commit e85de4e

Please sign in to comment.