Clippy ftw
This commit is contained in:
		
							
								
								
									
										19
									
								
								src/main.rs
									
									
									
									
									
								
							
							
						
						
									
										19
									
								
								src/main.rs
									
									
									
									
									
								
							| @@ -13,8 +13,8 @@ use tokio::{ | |||||||
|     sync::oneshot::{self, channel}, |     sync::oneshot::{self, channel}, | ||||||
| }; | }; | ||||||
|  |  | ||||||
| const DISCORD_APP_ID: &'static str = env!("DISCORD_APP_ID", "Missing DISCORD_APP_ID in env"); | const DISCORD_APP_ID: &str = env!("DISCORD_APP_ID", "Missing DISCORD_APP_ID in env"); | ||||||
| const LFM_API_KEY: &'static str = env!("LASTFM_API_KEY", "Missing LASTFM_API_KEY in env"); | const LFM_API_KEY: &str = env!("LASTFM_API_KEY", "Missing LASTFM_API_KEY in env"); | ||||||
|  |  | ||||||
| #[tokio::main] | #[tokio::main] | ||||||
| async fn main() -> Result<(), Box<dyn std::error::Error>> { | async fn main() -> Result<(), Box<dyn std::error::Error>> { | ||||||
| @@ -36,9 +36,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> { | |||||||
|  |  | ||||||
|     tokio::spawn(async move { |     tokio::spawn(async move { | ||||||
|         let user_url = format!("https://www.last.fm/user/{}", lfm_username); |         let user_url = format!("https://www.last.fm/user/{}", lfm_username); | ||||||
|         loop { |         while let Err(oneshot::error::TryRecvError::Empty) = recv_stop.try_recv() { | ||||||
|             match recv_stop.try_recv() { |  | ||||||
|                 Err(oneshot::error::TryRecvError::Empty) => { |  | ||||||
|             let tracks_result = lfm |             let tracks_result = lfm | ||||||
|                 .recent_tracks(&lfm_username) |                 .recent_tracks(&lfm_username) | ||||||
|                 .await |                 .await | ||||||
| @@ -50,8 +48,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> { | |||||||
|                 let last_track = &tracks.tracks[0]; |                 let last_track = &tracks.tracks[0]; | ||||||
|                 match &last_track.attrs { |                 match &last_track.attrs { | ||||||
|                     Some(_) => { |                     Some(_) => { | ||||||
|                                 let details = |                         let details = format!("{} - {}", &last_track.artist.name, last_track.name); | ||||||
|                                     format!("{} - {}", &last_track.artist.name, last_track.name); |  | ||||||
|  |  | ||||||
|                         println!( |                         println!( | ||||||
|                             "{} Currently playing: {:#?}", |                             "{} Currently playing: {:#?}", | ||||||
| @@ -72,8 +69,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> { | |||||||
|                         }; |                         }; | ||||||
|  |  | ||||||
|                         let state = format!("on {}", album_name); |                         let state = format!("on {}", album_name); | ||||||
|                                 let assets = |                         let assets = Assets::new().large_image(album_art).large_text(&details); | ||||||
|                                     Assets::new().large_image(&album_art).large_text(&details); |  | ||||||
|                         let activity = Activity::new() |                         let activity = Activity::new() | ||||||
|                             .assets(assets) |                             .assets(assets) | ||||||
|                             .details(details.as_str()) |                             .details(details.as_str()) | ||||||
| @@ -93,11 +89,6 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> { | |||||||
|             } |             } | ||||||
|             thread::sleep(Duration::seconds(5).to_std().unwrap()); |             thread::sleep(Duration::seconds(5).to_std().unwrap()); | ||||||
|         } |         } | ||||||
|                 _ => { |  | ||||||
|                     break; |  | ||||||
|                 } |  | ||||||
|             } |  | ||||||
|         } |  | ||||||
|     }); |     }); | ||||||
|  |  | ||||||
|     match signal::ctrl_c().await { |     match signal::ctrl_c().await { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user