summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorojacobson <ojacobson@noreply.codeberg.org>2025-05-27 04:09:01 +0200
committerojacobson <ojacobson@noreply.codeberg.org>2025-05-27 04:09:01 +0200
commit79d3598282fd573931e7cb14e4d3e54aad7c943c (patch)
treebeb3cd0de5077288f8a6c81373b6d0b7b737609f /src
parent1786c1eb9d13e570b028bef1206041f48d881cf0 (diff)
parent841fc1355ecef4636ad9f5ad6d081f72eeb868ac (diff)
Remove a bunch of clippy suppressions.
Notably, one of them was hiding a real (if unreachable) bug, by converting a "the token you have presented is not valid because the user was deleted" scenario into an internal server error, when it should have been an authorization error.
Diffstat (limited to 'src')
-rw-r--r--src/channel/routes/channel/delete.rs5
-rw-r--r--src/channel/routes/channel/post.rs3
-rw-r--r--src/channel/routes/post.rs5
-rw-r--r--src/invite/routes/invite/get.rs3
-rw-r--r--src/message/routes/message/mod.rs3
-rw-r--r--src/ui/assets.rs3
-rw-r--r--src/ui/routes/login.rs1
-rw-r--r--src/user/routes/logout/post.rs9
8 files changed, 16 insertions, 16 deletions
diff --git a/src/channel/routes/channel/delete.rs b/src/channel/routes/channel/delete.rs
index 9c093c1..3db7772 100644
--- a/src/channel/routes/channel/delete.rs
+++ b/src/channel/routes/channel/delete.rs
@@ -41,7 +41,6 @@ pub struct Error(#[from] pub app::DeleteError);
impl IntoResponse for Error {
fn into_response(self) -> response::Response {
let Self(error) = self;
- #[allow(clippy::match_wildcard_for_single_variants)]
match error {
app::DeleteError::NotFound(_) | app::DeleteError::Deleted(_) => {
NotFound(error).into_response()
@@ -49,7 +48,9 @@ impl IntoResponse for Error {
app::DeleteError::NotEmpty(_) => {
(StatusCode::CONFLICT, error.to_string()).into_response()
}
- other => Internal::from(other).into_response(),
+ app::DeleteError::Name(_) | app::DeleteError::Database(_) => {
+ Internal::from(error).into_response()
+ }
}
}
}
diff --git a/src/channel/routes/channel/post.rs b/src/channel/routes/channel/post.rs
index 0aad5e5..2547122 100644
--- a/src/channel/routes/channel/post.rs
+++ b/src/channel/routes/channel/post.rs
@@ -49,10 +49,9 @@ pub struct Error(#[from] pub SendError);
impl IntoResponse for Error {
fn into_response(self) -> response::Response {
let Self(error) = self;
- #[allow(clippy::match_wildcard_for_single_variants)]
match error {
SendError::ChannelNotFound(_) => NotFound(error).into_response(),
- other => Internal::from(other).into_response(),
+ SendError::Name(_) | SendError::Database(_) => Internal::from(error).into_response(),
}
}
}
diff --git a/src/channel/routes/post.rs b/src/channel/routes/post.rs
index 72eaad6..6ea9b61 100644
--- a/src/channel/routes/post.rs
+++ b/src/channel/routes/post.rs
@@ -49,7 +49,6 @@ pub struct Error(pub app::CreateError);
impl IntoResponse for Error {
fn into_response(self) -> response::Response {
let Self(error) = self;
- #[allow(clippy::match_wildcard_for_single_variants)]
match error {
app::CreateError::DuplicateName(_) => {
(StatusCode::CONFLICT, error.to_string()).into_response()
@@ -57,7 +56,9 @@ impl IntoResponse for Error {
app::CreateError::InvalidName(_) => {
(StatusCode::BAD_REQUEST, error.to_string()).into_response()
}
- other => Internal::from(other).into_response(),
+ app::CreateError::Name(_) | app::CreateError::Database(_) => {
+ Internal::from(error).into_response()
+ }
}
}
}
diff --git a/src/invite/routes/invite/get.rs b/src/invite/routes/invite/get.rs
index c8b52f1..f862833 100644
--- a/src/invite/routes/invite/get.rs
+++ b/src/invite/routes/invite/get.rs
@@ -30,10 +30,9 @@ pub enum Error {
impl IntoResponse for Error {
fn into_response(self) -> Response {
- #[allow(clippy::match_wildcard_for_single_variants)]
match self {
Self::NotFound(_) => NotFound(self).into_response(),
- other => Internal::from(other).into_response(),
+ Self::Database(_) => Internal::from(self).into_response(),
}
}
}
diff --git a/src/message/routes/message/mod.rs b/src/message/routes/message/mod.rs
index 4abd445..a05d344 100644
--- a/src/message/routes/message/mod.rs
+++ b/src/message/routes/message/mod.rs
@@ -47,7 +47,6 @@ pub mod delete {
impl IntoResponse for Error {
fn into_response(self) -> response::Response {
let Self(error) = self;
- #[allow(clippy::match_wildcard_for_single_variants)]
match error {
DeleteError::NotSender(_) => {
(StatusCode::FORBIDDEN, error.to_string()).into_response()
@@ -55,7 +54,7 @@ pub mod delete {
DeleteError::NotFound(_) | DeleteError::Deleted(_) => {
NotFound(error).into_response()
}
- other => Internal::from(other).into_response(),
+ DeleteError::Database(_) => Internal::from(error).into_response(),
}
}
}
diff --git a/src/ui/assets.rs b/src/ui/assets.rs
index 142cdf9..642679b 100644
--- a/src/ui/assets.rs
+++ b/src/ui/assets.rs
@@ -54,10 +54,9 @@ pub enum Error {
impl IntoResponse for Error {
fn into_response(self) -> Response {
- #[allow(clippy::match_wildcard_for_single_variants)]
match self {
Self::NotFound(_) => NotFound(self.to_string()).into_response(),
- other => Internal::from(other).into_response(),
+ Self::Mime(_) => Internal::from(self).into_response(),
}
}
}
diff --git a/src/ui/routes/login.rs b/src/ui/routes/login.rs
index 81a874c..39d45b9 100644
--- a/src/ui/routes/login.rs
+++ b/src/ui/routes/login.rs
@@ -4,7 +4,6 @@ pub mod get {
ui::assets::{Asset, Assets},
};
- #[allow(clippy::unused_async)]
pub async fn handler() -> Result<Asset, Internal> {
Assets::index()
}
diff --git a/src/user/routes/logout/post.rs b/src/user/routes/logout/post.rs
index bb09b9f..0ac663e 100644
--- a/src/user/routes/logout/post.rs
+++ b/src/user/routes/logout/post.rs
@@ -38,10 +38,13 @@ pub struct Error(#[from] pub app::ValidateError);
impl IntoResponse for Error {
fn into_response(self) -> Response {
let Self(error) = self;
- #[allow(clippy::match_wildcard_for_single_variants)]
match error {
- app::ValidateError::InvalidToken => Unauthorized.into_response(),
- other => Internal::from(other).into_response(),
+ app::ValidateError::InvalidToken | app::ValidateError::LoginDeleted => {
+ Unauthorized.into_response()
+ }
+ app::ValidateError::Name(_) | app::ValidateError::Database(_) => {
+ Internal::from(error).into_response()
+ }
}
}
}