summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2018-12-23 02:49:04 -0500
committerJesse Luehrs <doy@tozt.net>2018-12-23 02:49:04 -0500
commit96c8e1e5ac561e450b78912f65b2415d41fc6a58 (patch)
tree6710f042521c37e85b90d3b2c8cf2b3a1f98d8cb
parentbb860c9777d971a72e685148c6c1b2cdc13b3e0b (diff)
downloadlastfm-query-96c8e1e5ac561e450b78912f65b2415d41fc6a58.tar.gz
lastfm-query-96c8e1e5ac561e450b78912f65b2415d41fc6a58.zip
rust 2018HEADmaster
-rw-r--r--Cargo.toml7
-rw-r--r--src/cmd.rs (renamed from src/cmd/mod.rs)8
-rw-r--r--src/cmd/recommend.rs4
-rw-r--r--src/cmd/sql.rs4
-rw-r--r--src/cmd/sync.rs6
-rw-r--r--src/db.rs2
-rw-r--r--src/lastfm.rs (renamed from src/lastfm/mod.rs)2
-rw-r--r--src/lastfm/api_types.rs2
-rw-r--r--src/main.rs14
-rw-r--r--src/util.rs2
10 files changed, 27 insertions, 24 deletions
diff --git a/Cargo.toml b/Cargo.toml
index c2bb578..5bf53f3 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -2,6 +2,7 @@
name = "lastfm-query"
version = "0.1.0"
authors = ["Jesse Luehrs <doy@tozt.net>"]
+edition = "2018"
[dependencies]
clap = "2.32"
@@ -14,3 +15,9 @@ rusqlite = "0.15"
serde = "1.0"
serde_json = "1.0"
serde_derive = "1.0"
+
+[profile.dev]
+panic = "abort"
+
+[profile.release]
+panic = "abort"
diff --git a/src/cmd/mod.rs b/src/cmd.rs
index e793b55..172f6a6 100644
--- a/src/cmd/mod.rs
+++ b/src/cmd.rs
@@ -2,7 +2,13 @@ mod recommend;
mod sql;
mod sync;
-const _DUMMY_DEPENDENCY: &str = include_str!("../../Cargo.toml");
+use clap::{
+ app_from_crate, crate_authors, crate_description, crate_name,
+ crate_version,
+};
+use failure::bail;
+
+const _DUMMY_DEPENDENCY: &str = include_str!("../Cargo.toml");
trait Command {
fn run(&self) -> failure::Fallible<()>;
diff --git a/src/cmd/recommend.rs b/src/cmd/recommend.rs
index 1d8eecc..413dc5f 100644
--- a/src/cmd/recommend.rs
+++ b/src/cmd/recommend.rs
@@ -1,5 +1,5 @@
-use db;
-use util;
+use crate::db;
+use crate::util;
use clap;
diff --git a/src/cmd/sql.rs b/src/cmd/sql.rs
index bf4b768..5abc5ef 100644
--- a/src/cmd/sql.rs
+++ b/src/cmd/sql.rs
@@ -1,5 +1,5 @@
-use db;
-use util;
+use crate::db;
+use crate::util;
use clap;
diff --git a/src/cmd/sync.rs b/src/cmd/sync.rs
index 2d5b25b..88fe95c 100644
--- a/src/cmd/sync.rs
+++ b/src/cmd/sync.rs
@@ -1,6 +1,6 @@
-use db;
-use lastfm;
-use util;
+use crate::db;
+use crate::lastfm;
+use crate::util;
use clap;
diff --git a/src/db.rs b/src/db.rs
index 4afa3df..15b15f5 100644
--- a/src/db.rs
+++ b/src/db.rs
@@ -1,4 +1,4 @@
-use lastfm;
+use crate::lastfm;
use failure::Fail;
diff --git a/src/lastfm/mod.rs b/src/lastfm.rs
index 0704e5a..2666e9a 100644
--- a/src/lastfm/mod.rs
+++ b/src/lastfm.rs
@@ -1,4 +1,4 @@
-use util;
+use crate::util;
use failure::Fail;
use std::io::{Read, Write};
diff --git a/src/lastfm/api_types.rs b/src/lastfm/api_types.rs
index 148b17f..5a87956 100644
--- a/src/lastfm/api_types.rs
+++ b/src/lastfm/api_types.rs
@@ -1,6 +1,8 @@
#![allow(non_camel_case_types)]
#![allow(non_snake_case)]
+use serde_derive::Deserialize;
+
#[derive(Deserialize)]
pub struct track_artist {
#[serde(rename = "#text")]
diff --git a/src/main.rs b/src/main.rs
index 8432184..d667eb1 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -1,17 +1,3 @@
-#[macro_use]
-extern crate clap;
-extern crate directories;
-#[macro_use]
-extern crate failure;
-extern crate indicatif;
-extern crate reqwest;
-extern crate rpassword;
-extern crate rusqlite;
-extern crate serde;
-extern crate serde_json;
-#[macro_use]
-extern crate serde_derive;
-
mod cmd;
mod db;
mod lastfm;
diff --git a/src/util.rs b/src/util.rs
index 0e99fc8..8e2444e 100644
--- a/src/util.rs
+++ b/src/util.rs
@@ -1,3 +1,5 @@
+use failure::format_err;
+
pub fn program_name() -> failure::Fallible<String> {
let program = std::env::args()
.next()