style: replace common Result return type with alias
This commit is contained in:
parent
f4c3a6a569
commit
8573b75047
1 changed files with 5 additions and 3 deletions
|
@ -15,6 +15,8 @@ const POLL_TIMEOUT: &str = "300";
|
|||
/// Update types to receive (filtered out on tg backend)
|
||||
const POLL_TYPES: &str = r#"["message"]"#;
|
||||
|
||||
type BotFnResult = Result<(), reqwest::Error>;
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() -> std::io::Result<()> {
|
||||
let cfg = {
|
||||
|
@ -63,7 +65,7 @@ async fn main() -> std::io::Result<()> {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
async fn init_cmds(client: &Client, token: &str) -> Result<(), reqwest::Error> {
|
||||
async fn init_cmds(client: &Client, token: &str) -> BotFnResult {
|
||||
client
|
||||
.post(format!("{BOT_URL}{token}/setMyCommands"))
|
||||
.form(&[(
|
||||
|
@ -83,7 +85,7 @@ async fn init_cmds(client: &Client, token: &str) -> Result<(), reqwest::Error> {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
async fn handler(cfg: &Config, s: &mut State) -> Result<(), reqwest::Error> {
|
||||
async fn handler(cfg: &Config, s: &mut State) -> BotFnResult {
|
||||
let mut updates = cfg
|
||||
.client
|
||||
.get((*cfg.upd_url).clone())
|
||||
|
@ -148,7 +150,7 @@ async fn handler(cfg: &Config, s: &mut State) -> Result<(), reqwest::Error> {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
async fn send_comic(cfg: Config, ctx: SenderCtx) -> Result<(), reqwest::Error> {
|
||||
async fn send_comic(cfg: Config, ctx: SenderCtx) -> BotFnResult {
|
||||
let info = cfg
|
||||
.client
|
||||
.get(ctx.url.clone())
|
||||
|
|
Loading…
Add table
Reference in a new issue