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}, | ||||
| }; | ||||
|  | ||||
| const DISCORD_APP_ID: &'static 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 DISCORD_APP_ID: &str = env!("DISCORD_APP_ID", "Missing DISCORD_APP_ID in env"); | ||||
| const LFM_API_KEY: &str = env!("LASTFM_API_KEY", "Missing LASTFM_API_KEY in env"); | ||||
|  | ||||
| #[tokio::main] | ||||
| 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 { | ||||
|         let user_url = format!("https://www.last.fm/user/{}", lfm_username); | ||||
|         loop { | ||||
|             match recv_stop.try_recv() { | ||||
|                 Err(oneshot::error::TryRecvError::Empty) => { | ||||
|         while let Err(oneshot::error::TryRecvError::Empty) = recv_stop.try_recv() { | ||||
|             let tracks_result = lfm | ||||
|                 .recent_tracks(&lfm_username) | ||||
|                 .await | ||||
| @@ -50,8 +48,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> { | ||||
|                 let last_track = &tracks.tracks[0]; | ||||
|                 match &last_track.attrs { | ||||
|                     Some(_) => { | ||||
|                                 let details = | ||||
|                                     format!("{} - {}", &last_track.artist.name, last_track.name); | ||||
|                         let details = format!("{} - {}", &last_track.artist.name, last_track.name); | ||||
|  | ||||
|                         println!( | ||||
|                             "{} Currently playing: {:#?}", | ||||
| @@ -72,8 +69,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> { | ||||
|                         }; | ||||
|  | ||||
|                         let state = format!("on {}", album_name); | ||||
|                                 let assets = | ||||
|                                     Assets::new().large_image(&album_art).large_text(&details); | ||||
|                         let assets = Assets::new().large_image(album_art).large_text(&details); | ||||
|                         let activity = Activity::new() | ||||
|                             .assets(assets) | ||||
|                             .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()); | ||||
|         } | ||||
|                 _ => { | ||||
|                     break; | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|     }); | ||||
|  | ||||
|     match signal::ctrl_c().await { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user