Update rust toolchain to 1.80 (#180)
All checks were successful
Cargo CI / Build and Test (push) Successful in 1m55s
Cargo CI / Lint (push) Successful in 1m5s

Closes #179

Reviewed-on: #180
This commit is contained in:
Wojciech Kozlowski 2024-08-24 15:10:54 +02:00
parent f395433343
commit 8ff09e66ba
8 changed files with 10 additions and 19 deletions

View File

@ -1,4 +1,4 @@
FROM docker.io/library/rust:1.79
FROM docker.io/library/rust:1.80
RUN rustup component add \
clippy \

View File

@ -13,7 +13,7 @@ env:
jobs:
build_and_test:
name: Build and Test
container: docker.io/drrobot/musichoard-ci:rust-1.79
container: docker.io/drrobot/musichoard-ci:rust-1.80
env:
BEETSDIR: ./
LLVM_PROFILE_FILE: target/debug/profraw/musichoard-%p-%m.profraw
@ -48,7 +48,7 @@ jobs:
lint:
name: Lint
container: docker.io/drrobot/musichoard-ci:rust-1.75
container: docker.io/drrobot/musichoard-ci:rust-1.80
steps:
- uses: actions/checkout@v3
- run: cargo clippy --no-default-features --all-targets -- -D warnings

View File

@ -1,5 +1,6 @@
fn main() {
println!("cargo::rustc-check-cfg=cfg(nightly)");
if let Some(true) = version_check::is_feature_flaggable() {
println!("cargo:rustc-cfg=nightly");
println!("cargo::rustc-cfg=nightly");
}
}

View File

@ -159,11 +159,7 @@ impl<BLE: IBeetsLibraryExecutor> BeetsLibrary<BLE> {
let album_title = split[5].to_string();
let track_number = split[6].parse::<u32>()?;
let track_title = split[7].to_string();
let track_artist = split[8]
.to_string()
.split("; ")
.map(|s| s.to_owned())
.collect();
let track_artist = split[8].split("; ").map(|s| s.to_owned()).collect();
let track_format = match str_to_format(split[9].to_string().as_str()) {
Some(format) => format,
None => return Err(Error::Invalid(line.to_string())),

View File

@ -1,4 +1,4 @@
use crossterm::event::{KeyEvent, MouseEvent};
use crossterm::event::KeyEvent;
use std::fmt;
use std::sync::mpsc;
@ -36,8 +36,6 @@ impl From<mpsc::RecvError> for EventError {
#[derive(Clone, Copy, Debug)]
pub enum Event {
Key(KeyEvent),
Mouse(MouseEvent),
Resize(u16, u16),
}
pub struct EventChannel {

View File

@ -41,8 +41,6 @@ impl<APP: IAppInteract> IEventHandler<APP> for EventHandler {
fn handle_next_event(&self, mut app: APP) -> Result<APP, EventError> {
match self.events.recv()? {
Event::Key(key_event) => app = Self::handle_key_event(app, key_event),
Event::Mouse(_) => {}
Event::Resize(_, _) => {}
};
Ok(app)
}

View File

@ -33,9 +33,7 @@ impl IEventListener for EventListener {
Ok(event) => {
if let Err(err) = match event {
CrosstermEvent::Key(e) => self.events.send(Event::Key(e)),
CrosstermEvent::Mouse(e) => self.events.send(Event::Mouse(e)),
CrosstermEvent::Resize(w, h) => self.events.send(Event::Resize(w, h)),
_ => unimplemented!(),
_ => Ok(()),
} {
return err;
}

View File

@ -231,13 +231,13 @@ impl<'a> ArtistOverlay<'a> {
let indent = format!("\n{item_indent}");
let list = vec
.iter()
.map(|(k, v)| format!("{k}: {}", Self::vec_to_string(v, list_indent)))
.map(|(k, v)| format!("{k}: {}", Self::slice_to_string(v, list_indent)))
.collect::<Vec<String>>()
.join(&indent);
format!("{indent}{list}")
}
fn vec_to_string<S: AsRef<str>>(vec: &Vec<S>, indent: &str) -> String {
fn slice_to_string<S: AsRef<str>>(vec: &[S], indent: &str) -> String {
if vec.len() < 2 {
vec.first()
.map(|item| item.as_ref())