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)
|
/// Update types to receive (filtered out on tg backend)
|
||||||
const POLL_TYPES: &str = r#"["message"]"#;
|
const POLL_TYPES: &str = r#"["message"]"#;
|
||||||
|
|
||||||
|
type BotFnResult = Result<(), reqwest::Error>;
|
||||||
|
|
||||||
#[tokio::main]
|
#[tokio::main]
|
||||||
async fn main() -> std::io::Result<()> {
|
async fn main() -> std::io::Result<()> {
|
||||||
let cfg = {
|
let cfg = {
|
||||||
|
@ -63,7 +65,7 @@ async fn main() -> std::io::Result<()> {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn init_cmds(client: &Client, token: &str) -> Result<(), reqwest::Error> {
|
async fn init_cmds(client: &Client, token: &str) -> BotFnResult {
|
||||||
client
|
client
|
||||||
.post(format!("{BOT_URL}{token}/setMyCommands"))
|
.post(format!("{BOT_URL}{token}/setMyCommands"))
|
||||||
.form(&[(
|
.form(&[(
|
||||||
|
@ -83,7 +85,7 @@ async fn init_cmds(client: &Client, token: &str) -> Result<(), reqwest::Error> {
|
||||||
Ok(())
|
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
|
let mut updates = cfg
|
||||||
.client
|
.client
|
||||||
.get((*cfg.upd_url).clone())
|
.get((*cfg.upd_url).clone())
|
||||||
|
@ -148,7 +150,7 @@ async fn handler(cfg: &Config, s: &mut State) -> Result<(), reqwest::Error> {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn send_comic(cfg: Config, ctx: SenderCtx) -> Result<(), reqwest::Error> {
|
async fn send_comic(cfg: Config, ctx: SenderCtx) -> BotFnResult {
|
||||||
let info = cfg
|
let info = cfg
|
||||||
.client
|
.client
|
||||||
.get(ctx.url.clone())
|
.get(ctx.url.clone())
|
||||||
|
|
Loading…
Add table
Reference in a new issue