Switch to the 2018 edition; fix some warnings
This commit is contained in:
parent
5cdb16b708
commit
e8943b30c9
|
@ -2,10 +2,11 @@
|
||||||
name = "music-sync"
|
name = "music-sync"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
authors = ["Paul van Tilburg <paul@luon.net>"]
|
authors = ["Paul van Tilburg <paul@luon.net>"]
|
||||||
|
edition = "2018"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
clap = "2.32.0"
|
clap = "2.32.0"
|
||||||
cursive = "0.9.0"
|
cursive = "0.9.0"
|
||||||
failure = "0.1.2"
|
failure = "0.1.2"
|
||||||
lazy_static = "1"
|
lazy_static = "1"
|
||||||
walkdir = "2"
|
walkdir = "2"
|
||||||
|
|
13
src/main.rs
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 clap::{App, Arg};
|
||||||
use cursive::traits::*;
|
use cursive::traits::*;
|
||||||
use cursive::views::{Checkbox, Dialog, ListView, ProgressBar, TextView};
|
use cursive::views::{Checkbox, Dialog, ListView, ProgressBar, TextView};
|
||||||
use cursive::Cursive;
|
use cursive::Cursive;
|
||||||
use failure::Error;
|
use failure::Error;
|
||||||
|
use lazy_static::lazy_static;
|
||||||
use std::ffi::OsStr;
|
use std::ffi::OsStr;
|
||||||
use std::os::unix::process::CommandExt;
|
use std::os::unix::process::CommandExt;
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
|
@ -97,7 +88,7 @@ fn select_albums(ui: &mut Cursive) {
|
||||||
let album_name = album_name(&album_path);
|
let album_name = album_name(&album_path);
|
||||||
let album_path = album_path.clone();
|
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();
|
let mut registry = REGISTRY.lock().unwrap();
|
||||||
registry.select_album(&album_path, checked);
|
registry.select_album(&album_path, checked);
|
||||||
});
|
});
|
||||||
|
|
|
@ -50,7 +50,7 @@ impl Registry {
|
||||||
let line_filter = |line: &&str| line.ends_with("***");
|
let line_filter = |line: &&str| line.ends_with("***");
|
||||||
|
|
||||||
for line in contents.lines().filter(line_filter) {
|
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('#') {
|
if !line.starts_with('#') {
|
||||||
self.selected_albums.insert(PathBuf::from(path));
|
self.selected_albums.insert(PathBuf::from(path));
|
||||||
}
|
}
|
||||||
|
|
Reference in New Issue