there was a better way to do it

This commit is contained in:
Adrian Malacoda 2018-02-22 03:13:03 -06:00
parent bcbc14ed17
commit 6446bb87db

View File

@ -20,7 +20,7 @@ use std::collections::BTreeMap;
pub struct AutolinkModule {} pub struct AutolinkModule {}
impl AutolinkModule { impl AutolinkModule {
pub fn new (_: &Table, config: &Table) -> Box<EventLoop> { pub fn new (_: &Table, _: &Table) -> Box<EventLoop> {
Box::new(AutolinkModule {}) Box::new(AutolinkModule {})
} }
} }
@ -41,11 +41,8 @@ fn print_mtg_card (card: &MtgCard, message: &Message) {
message.reply(&format!("*{}*", flavor)); message.reply(&format!("*{}*", flavor));
} }
// 12 March 2017: Is there a better way to do this? if let (&Some(ref power), &Some(ref toughness)) = (&card.power, &card.toughness) {
if let Some(ref power) = card.power { message.reply(&format!("{}/{}", power, toughness));
if let Some(ref toughness) = card.toughness {
message.reply(&format!("{}/{}", power, toughness));
}
} }
} }
@ -68,10 +65,8 @@ fn print_ygo_card (card: &YugiohCard, message: &Message) {
message.reply(&format!("{}", card.text)); message.reply(&format!("{}", card.text));
if let Some(ref atk) = card.atk { if let (&Some(ref atk), &Some(ref def)) = (&card.atk, &card.def) {
if let Some(ref def) = card.def { message.reply(&format!("{}/{}", atk, def));
message.reply(&format!("{}/{}", atk, def));
}
} }
} }