Skip to content

Commit

Permalink
Use if_chain as reminder for rust-lang/rust#53667
Browse files Browse the repository at this point in the history
  • Loading branch information
CrendKing committed Jun 11, 2024
1 parent 55ed114 commit 29ba71b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@ edition = '2021'
[dependencies]
chrono = { version = '*', default-features = false }
clap = { version = '*', features = ['derive'] }
if_chain = '*'
musicbrainz_rs = { version = '*', default-features = false, features = ['blocking'] }
reqwest = { version = '*', features = ['blocking'] }
11 changes: 7 additions & 4 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@ use std::time::Duration;

use chrono::Datelike;
use clap::Parser;
use if_chain::if_chain;
use musicbrainz_rs::entity::artist_credit::ArtistCredit;
use musicbrainz_rs::entity::release::Release;
use musicbrainz_rs::entity::CoverartResponse;
use musicbrainz_rs::{Fetch, FetchCoverart};

const USER_AGENT: &str = "musicbrainz_cuesheet/0.1.0 (alpha testing)";
const USER_AGENT: &str = "musicbrainz_cuesheet/0.1.0 (testing)";
const COVER_ART_PATH_COMPONENT: &str = "Cover";

#[derive(Parser)]
Expand Down Expand Up @@ -119,8 +120,10 @@ fn main() {
if is_album {
medium_title += &format!("- {medium_id}")
}
if let Some(t) = medium.title {
if !t.is_empty() {
if_chain! {
if let Some(t) = medium.title;
if !t.is_empty();
then {
medium_title += &format!(": {}", t);
}
}
Expand All @@ -129,7 +132,7 @@ fn main() {
let mut medium_cuesheet = format!("{medium_title}\n{release_cuesheet}");

let mut track_start = 0;
for track in medium.tracks.unwrap_or_default().iter() {
for track in medium.tracks.unwrap_or_default() {
writeln!(medium_cuesheet, " TRACK {:02} AUDIO", track.position).unwrap();
writeln!(medium_cuesheet, " TITLE \"{}\"", track.title).unwrap();

Expand Down

0 comments on commit 29ba71b

Please sign in to comment.