Browse Source

Switch to the 2018 edition; fix some warnings

master
Paul van Tilburg 3 years ago
parent
commit
e8943b30c9
  1. 3
      Cargo.toml
  2. 13
      src/main.rs
  3. 2
      src/registry.rs

3
Cargo.toml

@ -2,10 +2,11 @@
name = "music-sync"
version = "0.1.0"
authors = ["Paul van Tilburg <paul@luon.net>"]
edition = "2018"
[dependencies]
clap = "2.32.0"
cursive = "0.9.0"
failure = "0.1.2"
lazy_static = "1"
walkdir = "2"
walkdir = "2"

13
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);
});

2
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));
}