chore: Clippy fixes

This commit is contained in:
Ginger
2026-04-30 09:05:34 -04:00
parent 13917bb5c3
commit 3dc4c7d4fc
7 changed files with 15 additions and 27 deletions
-1
View File
@@ -4,7 +4,6 @@ mod token;
use axum::{
Json, Router,
extract::State,
routing::method_routing::{get, post},
};
use serde_json::json;
+2 -6
View File
@@ -1,9 +1,4 @@
use std::{
collections::{BTreeSet, HashSet},
fmt::Debug,
hash::Hash,
mem::discriminant,
};
use std::{collections::BTreeSet, fmt::Debug, hash::Hash, mem::discriminant};
use regex::Regex;
use ruma::OwnedDeviceId;
@@ -127,6 +122,7 @@ pub enum TokenRequest {
}
impl TokenRequest {
#[must_use]
pub fn client_id(&self) -> &str {
match self {
| Self::AuthorizationCode { client_id, .. }
+4 -4
View File
@@ -1,5 +1,5 @@
use std::{
collections::{BTreeMap, BTreeSet, HashMap},
collections::{BTreeSet, HashMap},
sync::{Arc, Mutex},
time::{Duration, SystemTime},
};
@@ -77,10 +77,10 @@ impl PendingCodeGrant {
const RANDOM_CODE_LENGTH: usize = 32;
#[must_use]
pub fn generate_code() -> String { utils::random_string(Self::RANDOM_CODE_LENGTH) }
pub(crate) fn generate_code() -> String { utils::random_string(Self::RANDOM_CODE_LENGTH) }
#[must_use]
pub fn is_valid_for(&self, client_id: &str) -> bool {
pub(crate) fn is_valid_for(&self, client_id: &str) -> bool {
let now = SystemTime::now();
self.expected_client_id == client_id
@@ -454,7 +454,7 @@ impl Service {
.remove(&session_info.current_refresh_token);
self.db
.userdeviceid_oauthsessioninfo
.del(&(user_id, device_id));
.del((user_id, device_id));
info!(?user_id, ?device_id, "Removed OAuth session");
}
}
+4 -4
View File
@@ -4,7 +4,7 @@ use askama::{Template, filters::HtmlSafe};
use base64::Engine;
use conduwuit_core::{result::FlatOk, utils};
use conduwuit_service::{Services, media::mxc::Mxc, oauth::client_metadata::ClientMetadata};
use ruma::{MilliSecondsSinceUnixEpoch, OwnedDeviceId, OwnedUserId, UserId};
use ruma::{OwnedDeviceId, OwnedUserId, UserId};
pub(super) mod form;
@@ -24,10 +24,10 @@ impl HtmlSafe for Avatar {}
impl Avatar {
pub(super) async fn for_local_user(services: &Services, user_id: &UserId) -> Self {
let display_name = services.users.displayname(&user_id).await.ok();
let display_name = services.users.displayname(user_id).await.ok();
let avatar_src = async {
let avatar_url = services.users.avatar_url(&user_id).await.ok()?;
let avatar_url = services.users.avatar_url(user_id).await.ok()?;
let (server_name, media_id) = avatar_url.parts().ok()?;
let file = services
.media
@@ -57,7 +57,7 @@ impl Avatar {
AvatarType::Initial(user_id.localpart().chars().next().unwrap())
};
Avatar { avatar_type }
Self { avatar_type }
}
}
+1
View File
@@ -42,6 +42,7 @@ macro_rules! template {
}
impl$(<$lifetime>)? $name$(<$lifetime>)? {
#[allow(clippy::too_many_arguments)]
fn new(state: &$crate::State, $($field_name: $field_type,)*) -> Self {
Self {
context: state.into(),
+3 -10
View File
@@ -3,18 +3,11 @@ use std::collections::BTreeSet;
use axum::{
Router,
extract::{Query, State},
response::{IntoResponse, Redirect},
response::Redirect,
routing::on,
};
use conduwuit_service::{
oauth::{
client_metadata::{self, ClientMetadata},
grant::{AuthorizationCodeQuery, Scope},
},
rooms::user,
};
use ruma::{OwnedDeviceId, OwnedUserId};
use serde::Deserialize;
use conduwuit_service::oauth::grant::{AuthorizationCodeQuery, Scope};
use ruma::OwnedUserId;
use url::Url;
use crate::{
+1 -2
View File
@@ -1,6 +1,5 @@
use std::{
borrow::Cow,
collections::HashMap,
mem::discriminant,
time::{Duration, SystemTime},
};
@@ -8,7 +7,7 @@ use std::{
use axum::{extract::FromRequestParts, http::request::Parts};
use conduwuit_service::oauth::grant::AuthorizationCodeQuery;
use ruma::{OwnedUserId, UserId};
use serde::{Deserialize, Deserializer, Serialize};
use serde::{Deserialize, Serialize};
use tower_sessions::Session;
use crate::{ROUTE_PREFIX, WebError};