From e8943b30c9ddebd03dddfc3ab7a055e0d72731f0 Mon Sep 17 00:00:00 2001 From: Paul van Tilburg Date: Wed, 27 Mar 2019 21:50:03 +0100 Subject: [PATCH] Switch to the 2018 edition; fix some warnings --- Cargo.toml | 3 ++- src/main.rs | 13 ++----------- src/registry.rs | 2 +- 3 files changed, 5 insertions(+), 13 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 6b33fb0..4172a5e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,10 +2,11 @@ name = "music-sync" version = "0.1.0" authors = ["Paul van Tilburg "] +edition = "2018" [dependencies] clap = "2.32.0" cursive = "0.9.0" failure = "0.1.2" lazy_static = "1" -walkdir = "2" \ No newline at end of file +walkdir = "2" diff --git a/src/main.rs b/src/main.rs index 2fd3573..7d94097 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,18 +1,9 @@ -#![allow(unknown_lints)] -#![warn(clippy)] - -extern crate clap; -extern crate cursive; -extern crate failure; -#[macro_use] -extern crate lazy_static; -extern crate walkdir; - use clap::{App, Arg}; use cursive::traits::*; use cursive::views::{Checkbox, Dialog, ListView, ProgressBar, TextView}; use cursive::Cursive; use failure::Error; +use lazy_static::lazy_static; use std::ffi::OsStr; use std::os::unix::process::CommandExt; use std::path::PathBuf; @@ -97,7 +88,7 @@ fn select_albums(ui: &mut Cursive) { let album_name = album_name(&album_path); let album_path = album_path.clone(); - let mut checkbox = Checkbox::new().on_change(move |_, checked| { + let checkbox = Checkbox::new().on_change(move |_, checked| { let mut registry = REGISTRY.lock().unwrap(); registry.select_album(&album_path, checked); }); diff --git a/src/registry.rs b/src/registry.rs index f75342a..c19cf49 100644 --- a/src/registry.rs +++ b/src/registry.rs @@ -50,7 +50,7 @@ impl Registry { let line_filter = |line: &&str| line.ends_with("***"); for line in contents.lines().filter(line_filter) { - let path = line.trim_left_matches('#').trim_right_matches("/***"); + let path = line.trim_start_matches('#').trim_end_matches("/***"); if !line.starts_with('#') { self.selected_albums.insert(PathBuf::from(path)); }