aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/configuration.rs6
-rw-r--r--src/lyrics_engine/genius.rs8
-rw-r--r--src/main.rs2
3 files changed, 7 insertions, 9 deletions
diff --git a/src/configuration.rs b/src/configuration.rs
index 56d60d9..8d79eba 100644
--- a/src/configuration.rs
+++ b/src/configuration.rs
@@ -1,5 +1,5 @@
use serde::{Deserialize, Serialize};
-use serde_json;
+use serde_json::{from_str, to_string};
use std::env;
use std::fs::{create_dir_all, write, File};
use std::io::{Read, Result};
@@ -65,12 +65,12 @@ impl Configuration {
let mut config_file = File::open(&config_file_path).ok()?;
let mut config_contents = String::new();
config_file.read_to_string(&mut config_contents).ok()?;
- serde_json::from_str(&config_contents).ok()?
+ from_str(&config_contents).ok()?
}
fn write(configuration: &Configuration) -> Result<()> {
let config_file_path = Configuration::file_path();
- if let Ok(serialized_configuration) = serde_json::to_string(&configuration) {
+ if let Ok(serialized_configuration) = to_string(&configuration) {
write(&config_file_path, serialized_configuration)?;
}
Ok(())
diff --git a/src/lyrics_engine/genius.rs b/src/lyrics_engine/genius.rs
index a8b0468..b33ff92 100644
--- a/src/lyrics_engine/genius.rs
+++ b/src/lyrics_engine/genius.rs
@@ -72,11 +72,9 @@ pub async fn get_lyrics(url: &str) -> Result<String> {
Element(element) => {
if element.name() == "br" {
lyrics.push('\n');
- } else {
- if let Some(element_ref) = ElementRef::wrap(node) {
- let text = element_ref.text().collect::<Vec<_>>().join("");
- lyrics.push_str(&text);
- }
+ } else if let Some(element_ref) = ElementRef::wrap(node) {
+ let text = element_ref.text().collect::<Vec<_>>().join("");
+ lyrics.push_str(&text);
}
}
Text(text) => {
diff --git a/src/main.rs b/src/main.rs
index 96569d9..cab96a5 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -98,7 +98,7 @@ async fn run() -> Result<()> {
if let Some(artist) = arguments.artist {
current_track = Track {
name: arguments.track_name.unwrap_or("".to_string()),
- artist: artist,
+ artist,
};
} else {
current_track =