mirror of
https://github.com/teloxide/teloxide.git
synced 2025-03-14 11:44:04 +01:00
fmt
This commit is contained in:
parent
5e276d65f4
commit
1e71268748
3 changed files with 12 additions and 12 deletions
|
@ -45,7 +45,7 @@ futures = "0.3.1"
|
|||
pin-project = "0.4.6"
|
||||
serde_with_macros = "1.0.1"
|
||||
|
||||
teloxide-macros = {git="https://github.com/teloxide/teloxide-macros", branch="dev"}
|
||||
teloxide-macros = { path="../teloxide-macros" }
|
||||
|
||||
[dev-dependencies]
|
||||
smart-default = "0.6.0"
|
||||
|
|
|
@ -45,8 +45,8 @@
|
|||
//!
|
||||
//! [examples/admin_bot]: https://github.com/teloxide/teloxide/blob/master/examples/admin_bot/
|
||||
|
||||
pub use teloxide_macros::BotCommand;
|
||||
use std::error::Error;
|
||||
pub use teloxide_macros::BotCommand;
|
||||
|
||||
/// An enumeration of bot's commands.
|
||||
///
|
||||
|
@ -94,8 +94,7 @@ use std::error::Error;
|
|||
/// Text(String),
|
||||
/// }
|
||||
///
|
||||
/// let command =
|
||||
/// Command::parse("/text hello my dear friend!", "").unwrap();
|
||||
/// let command = Command::parse("/text hello my dear friend!", "").unwrap();
|
||||
/// assert_eq!(command, Command::Text("hello my dear friend!".to_string()));
|
||||
/// ```
|
||||
///
|
||||
|
@ -157,12 +156,11 @@ use std::error::Error;
|
|||
/// 2 => {
|
||||
/// let num =
|
||||
/// input.parse().map_err(|_| ParseError::IncorrectFormat)?;
|
||||
/// Ok((num, ))
|
||||
/// Ok((num,))
|
||||
/// }
|
||||
/// len => Err(ParseError::Custom(format!(
|
||||
/// "Only 2 digits allowed, not {}",
|
||||
/// len
|
||||
/// ).into())),
|
||||
/// len => Err(ParseError::Custom(
|
||||
/// format!("Only 2 digits allowed, not {}", len).into(),
|
||||
/// )),
|
||||
/// }
|
||||
/// }
|
||||
///
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use teloxide::utils::command::{BotCommand, ParseError};
|
||||
|
||||
// We put tests here because macro expand in unit tests in module teloxide::utils::command
|
||||
// was a failure
|
||||
// We put tests here because macro expand in unit tests in module
|
||||
// teloxide::utils::command was a failure
|
||||
|
||||
#[test]
|
||||
fn parse_command_with_args() {
|
||||
|
@ -132,7 +132,9 @@ fn parse_custom_parser() {
|
|||
_ => return Err(ParseError::IncorrectFormat),
|
||||
};
|
||||
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(),
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue