diff --git a/src/app/twitch.rs b/src/app/twitch.rs index f22c40b..519a358 100644 --- a/src/app/twitch.rs +++ b/src/app/twitch.rs @@ -3,13 +3,17 @@ use twitch_api2::{ types::UserId, twitch_oauth2::UserToken, }; -use irc::client::prelude::Message; -use irc::proto::{Command, Response}; -use crate::app::State; -use crate::app::config::CommandExecutor; -use crate::app::rhai_tools::ExecutorState; -use std::sync::Arc; +use irc::{ + client::prelude::Message, + proto::{Command, Response}, +}; use tokio_tungstenite::tungstenite::Message as WsMessage; +use crate::app::{ + State, + config::CommandExecutor, + rhai_tools::ExecutorState, +}; +use std::sync::Arc; pub struct Twitch { pub client: TwitchClient<'static, reqwest::Client>, diff --git a/src/app/web.rs b/src/app/web.rs index b81ef3c..aa2b3d5 100644 --- a/src/app/web.rs +++ b/src/app/web.rs @@ -1,13 +1,17 @@ mod template; mod route; -use std::sync::Arc; -use crate::app::State; -use warp::{Filter, Rejection, Reply}; -use std::convert::Infallible; -use warp::http::StatusCode; -use std::borrow::Cow; +use warp::{ + Filter, Rejection, Reply, + http::StatusCode, +}; use self::route::*; +use crate::app::State; +use std::{ + borrow::Cow, + convert::Infallible, + sync::Arc, +}; pub async fn start_web(state: Arc) { let cookie_state = Arc::clone(&state); diff --git a/src/app/web/route/commands.rs b/src/app/web/route/commands.rs index caaf9f8..e789502 100644 --- a/src/app/web/route/commands.rs +++ b/src/app/web/route/commands.rs @@ -1,3 +1,4 @@ +use chrono::Duration; use warp::{Filter, Reply, filters::BoxedFilter, http::Uri, Rejection}; use crate::app::{ State, @@ -10,10 +11,9 @@ use crate::app::{ use std::{ collections::HashMap, convert::Infallible, + str::FromStr, sync::Arc, }; -use std::str::FromStr; -use chrono::Duration; pub fn commands_routes(state: Arc) -> BoxedFilter<(impl Reply, )> { warp::get() diff --git a/src/app/web/route/redemptions.rs b/src/app/web/route/redemptions.rs index 109cfaf..f554d86 100644 --- a/src/app/web/route/redemptions.rs +++ b/src/app/web/route/redemptions.rs @@ -1,4 +1,7 @@ -use twitch_api2::types::RewardId; +use twitch_api2::{ + helix::points::{GetCustomRewardRequest, CustomReward}, + types::RewardId, +}; use warp::{ Filter, Reply, filters::BoxedFilter, @@ -9,7 +12,7 @@ use crate::app::{ config::Redemption, web::{ CustomRejection, - template::redemptions::{RedemptionsTemplate, AddRedemptionTemplate}, + template::redemptions::{RedemptionsTemplate, AddRedemptionTemplate, ListRedemptionsTemplate}, }, }; use std::{ @@ -17,8 +20,6 @@ use std::{ convert::Infallible, sync::Arc, }; -use twitch_api2::helix::points::{GetCustomRewardRequest, CustomReward}; -use crate::app::web::template::redemptions::ListRedemptionsTemplate; pub fn redemptions_routes(state: Arc) -> BoxedFilter<(impl Reply, )> { warp::get() diff --git a/src/app/web/template/redemptions.rs b/src/app/web/template/redemptions.rs index 53d4d9a..acfcd88 100644 --- a/src/app/web/template/redemptions.rs +++ b/src/app/web/template/redemptions.rs @@ -1,6 +1,6 @@ use askama::Template; -use crate::app::config::Redemption; use twitch_api2::helix::points::CustomReward; +use crate::app::config::Redemption; #[derive(Template)] #[template(path = "redemptions.html")] diff --git a/src/main.rs b/src/main.rs index e65e8fe..aa3befc 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,19 +1,22 @@ -#![feature(try_blocks)] -#![feature(drain_filter)] +#![feature(try_blocks, drain_filter)] mod app; -use tokio::runtime::{Builder, Handle}; -use tokio::io::{AsyncReadExt, AsyncWriteExt}; +use futures::FutureExt; +use tokio::{ + fs::OpenOptions, + io::{AsyncReadExt, AsyncWriteExt}, + runtime::{Builder, Handle}, +}; use crate::app::{ State, config::Config, user_config::UserConfig, }; -use std::path::Path; -use tokio::fs::OpenOptions; -use futures::FutureExt; -use std::sync::Arc; +use std::{ + path::Path, + sync::Arc, +}; fn main() -> anyhow::Result<()> { let runtime = Builder::new_multi_thread()