Skip to content

Commit

Permalink
remove unused imports
Browse files Browse the repository at this point in the history
  • Loading branch information
banocean committed Jan 15, 2024
1 parent d63a059 commit 6302ea6
Show file tree
Hide file tree
Showing 7 changed files with 5 additions and 22 deletions.
9 changes: 1 addition & 8 deletions src/database/redis.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use redis::{Client, Commands, RedisError};
use redis::{Client, RedisError};
use serde_json::json;
use twilight_model::id::marker::{GuildMarker, RoleMarker, UserMarker};
use twilight_model::id::Id;
Expand Down Expand Up @@ -82,11 +82,4 @@ impl RedisConnection {
let mut connection = self.client.get_async_connection().await?;
connection.zincr(path, user_id.to_string(), count).await
}

#[cfg(feature = "api")]
pub async fn check_guild(&self, id: Id<GuildMarker>) -> Result<bool, RedisError> {
let count: u8 = self.client.get_async_connection()
.await?.exists(format!("guilds.{id}")).await?;
Ok(count == 1)
}
}
1 change: 0 additions & 1 deletion src/server/authorize.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use std::fmt::Display;
use ed25519_dalek::Verifier;
use ed25519_dalek::{PublicKey, Signature};
use std::str::FromStr;
Expand Down
8 changes: 1 addition & 7 deletions src/server/error.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use std::convert::Infallible;
use std::fmt::{Debug, Display, Formatter, Write};
use std::fmt::{Debug, Display, Formatter};
use reqwest::StatusCode;
use warp::reject::Reject;
use warp::Reply;
Expand All @@ -11,8 +11,6 @@ pub enum Rejection {
#[cfg(feature = "http-interactions")]
InvalidSignature,
#[cfg(feature = "api")]
InvalidCode,
#[cfg(feature = "api")]
Unauthorized,
Internal(anyhow::Error)
}
Expand All @@ -25,8 +23,6 @@ impl Display for Rejection {
#[cfg(feature = "http-interactions")]
Rejection::InvalidSignature => f.write_str("Couldn't verify signature"),
#[cfg(feature = "api")]
Rejection::InvalidCode => f.write_str("Invalid `code` was provided"),
#[cfg(feature = "api")]
Rejection::Unauthorized => f.write_str("Invalid authorization data provided"),
Rejection::Internal(err) => std::fmt::Display::fmt(&err, f),
}?;
Expand Down Expand Up @@ -71,8 +67,6 @@ pub async fn handle_rejection(rejection: warp::Rejection) -> Result<impl Reply,
#[cfg(feature = "http-interactions")]
Rejection::InvalidSignature => StatusCode::BAD_REQUEST,
#[cfg(feature = "api")]
Rejection::InvalidCode => StatusCode::BAD_REQUEST,
#[cfg(feature = "api")]
Rejection::Unauthorized => StatusCode::UNAUTHORIZED,
_ => StatusCode::INTERNAL_SERVER_ERROR
})
Expand Down
4 changes: 0 additions & 4 deletions src/server/routes/guilds/mod.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
use std::sync::Arc;
use futures_util::future::join_all;
use futures_util::{FutureExt, StreamExt};
use redis::{AsyncCommands, RedisError, ToRedisArgs};
use serde::{Deserialize, Serialize};
use twilight_model::id::Id;
use twilight_model::id::marker::GuildMarker;
use twilight_model::user::CurrentUserGuild;
use warp::{Filter, Reply};
use warp::hyper::body::HttpBody;
use crate::context::Context;
use crate::{response_type, with_value};
use crate::server::error::MapErrorIntoInternalRejection;
Expand Down
2 changes: 1 addition & 1 deletion src/server/routes/interactions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use warp::reply::Json;
use crate::context::Context;
use crate::server::interaction::handle_interaction;
use crate::{response_type, with_value};
use crate::server::error::{MapErrorIntoInternalRejection, Rejection};
use crate::server::error::MapErrorIntoInternalRejection;

pub fn filter(
discord_http: Arc<Client>,
Expand Down
2 changes: 1 addition & 1 deletion src/server/routes/login.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use std::sync::Arc;
use std::time::{SystemTime, UNIX_EPOCH};
use futures_util::TryFutureExt;
use serde::{Deserialize, Serialize};
use twilight_http::Client;
use twilight_model::user::CurrentUser;
Expand Down Expand Up @@ -44,6 +43,7 @@ pub fn login(authenticator: Arc<Authenticator>, sessions: Arc<Sessions>) -> resp
enum GrantType {
#[serde(rename = "authorization_code")]
AuthorizationCode { code: String },
#[allow(dead_code)]
#[serde(rename = "refresh_token")]
RefreshToken { refresh_token: String }
}
Expand Down
1 change: 1 addition & 0 deletions src/server/session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ impl Sessions {
self.0.write().await.insert(data.user.id, data);
}

#[allow(dead_code, unused_variables)]
pub async fn refresh(&self, user_id: &Id<UserMarker>) {
todo!()
}
Expand Down

0 comments on commit 6302ea6

Please sign in to comment.