implement clippy suggestions
This commit is contained in:
parent
ed7bd5efc8
commit
aa04c6ef5b
5 changed files with 7 additions and 7 deletions
|
|
@ -40,10 +40,10 @@ impl<T, R> Responder<T, R> {
|
|||
|
||||
pub fn channel<T, R>() -> (Requester<T, R>, Responder<T, R>) {
|
||||
let (requester_tx, responder_rx) = mpsc::channel();
|
||||
return (
|
||||
(
|
||||
Requester { tx: requester_tx },
|
||||
Responder { rx: responder_rx },
|
||||
);
|
||||
)
|
||||
}
|
||||
|
||||
pub struct Request<T, R> {
|
||||
|
|
|
|||
|
|
@ -30,5 +30,5 @@ pub fn download_from_youtube(url: &str) -> Result<TrackInfo, DownloadError> {
|
|||
.replace('\n', "")
|
||||
+ ".mp3";
|
||||
|
||||
Ok(TrackInfo::new(&Path::new(filename.as_str())))
|
||||
Ok(TrackInfo::new(Path::new(filename.as_str())))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
use music_bot::{player::MusicPlayer, telegram};
|
||||
|
||||
fn main() {
|
||||
let player = MusicPlayer::new();
|
||||
let player = MusicPlayer::build();
|
||||
let mut bot = telegram::TelegramBot::build(player);
|
||||
bot.telegram_main();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ struct Worker {
|
|||
}
|
||||
|
||||
fn get_source(track: TrackInfo) -> Decoder<BufReader<File>> {
|
||||
let file = BufReader::new(File::open(&track.path).unwrap());
|
||||
let file = BufReader::new(File::open(track.path).unwrap());
|
||||
Decoder::new(file).unwrap()
|
||||
}
|
||||
|
||||
|
|
@ -100,7 +100,7 @@ impl Worker {
|
|||
}
|
||||
|
||||
impl MusicPlayer {
|
||||
pub fn new() -> MusicPlayer {
|
||||
pub fn build() -> MusicPlayer {
|
||||
let (requester, responder) = channel::channel();
|
||||
let _worker = thread::spawn(move || Worker::build(responder).main());
|
||||
MusicPlayer { requester, _worker }
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ impl TelegramBot {
|
|||
bot.send_message(msg.chat.id, "Added to the queue.").await?;
|
||||
},
|
||||
Err(_) => {
|
||||
bot.send_message(msg.chat.id, format!("Failed to download.")).await?;
|
||||
bot.send_message(msg.chat.id, "Failed to download.").await?;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue