Fix Clippy

This commit is contained in:
Temirkhan Myrzamadi 2020-07-16 20:02:39 +06:00
parent 8990b4a785
commit ca8ffba11f
2 changed files with 11 additions and 9 deletions

View file

@ -155,11 +155,11 @@ impl BotBuilder {
#[must_use] #[must_use]
pub fn build(self) -> Bot { pub fn build(self) -> Bot {
Bot { Bot {
client: self.client.unwrap_or(Client::new()), client: self.client.unwrap_or_default(),
token: self.token.unwrap_or( token: self.token.unwrap_or_else(|| {
std::env::var("TELOXIDE_TOKEN") std::env::var("TELOXIDE_TOKEN")
.expect("Cannot get the TELOXIDE_TOKEN env variable"), .expect("Cannot get the TELOXIDE_TOKEN env variable")
), }),
parse_mode: self.parse_mode, parse_mode: self.parse_mode,
} }
} }

View file

@ -135,11 +135,13 @@ fn parse_custom_parser() {
)) ))
} }
}; };
left.parse::<u8>().map(|res| (res, right.to_string())).map_err(|_| { left.parse::<u8>().map(|res| (res, (*right).to_string())).map_err(
ParseError::Custom( |_| {
"First argument must be a integer!".to_owned().into(), ParseError::Custom(
) "First argument must be a integer!".to_owned().into(),
}) )
},
)
} }
#[command(rename = "lowercase")] #[command(rename = "lowercase")]