clippy allow -> expect

This commit is contained in:
dasha_uwu
2026-01-22 21:48:41 +05:00
committed by Jason Volk
parent fbedd713ca
commit 0c9a3abb71
91 changed files with 126 additions and 166 deletions

View File

@@ -45,7 +45,6 @@ impl crate::Service for Service {
/// Places one event in the account data of the user and removes the
/// previous entry.
#[allow(clippy::needless_pass_by_value)]
#[implement(Service)]
pub async fn update(
&self,

View File

@@ -6,7 +6,7 @@ pub(super) const SIGNAL: &str = "SIGUSR2";
/// Possibly spawn the terminal console at startup if configured.
#[implement(super::Service)]
#[allow(clippy::unused_async)]
#[expect(clippy::unused_async)]
pub(super) async fn console_auto_start(&self) {
#[cfg(feature = "console")]
if self
@@ -23,7 +23,7 @@ pub(super) async fn console_auto_start(&self) {
/// Shutdown the console when the admin worker terminates.
#[implement(super::Service)]
#[allow(clippy::unused_async)]
#[expect(clippy::unused_async)]
pub(super) async fn console_auto_stop(&self) {
#[cfg(feature = "console")]
self.console.close().await;

View File

@@ -199,7 +199,6 @@ impl Service {
/// Checks if a given room id matches any exclusive appservice regex
///
/// TODO: use this?
#[allow(dead_code)]
pub async fn is_exclusive_room_id(&self, room_id: &RoomId) -> bool {
self.read()
.await

View File

@@ -88,7 +88,6 @@ impl Manager {
Ok(())
}
#[allow(clippy::unused_self)]
fn handle_abort(&self, _workers: &mut WorkersLocked<'_>, error: &Error) -> Result {
// not supported until service can be associated with abort
unimplemented!("unexpected worker task abort {error:?}");
@@ -106,7 +105,7 @@ impl Manager {
}
}
#[allow(clippy::unused_self)]
#[expect(clippy::unused_self)]
fn handle_finished(
&self,
_workers: &mut WorkersLocked<'_>,

View File

@@ -165,7 +165,7 @@ pub async fn download_image(&self, url: &str) -> Result<UrlPreviewData> {
#[cfg(not(feature = "url_preview"))]
#[implement(Service)]
#[allow(clippy::unused_async)]
#[expect(clippy::unused_async)]
pub async fn download_image(&self, _url: &str) -> Result<UrlPreviewData> {
Err!(FeatureDisabled("url_preview"))
}
@@ -215,7 +215,7 @@ async fn download_html(&self, url: &str) -> Result<UrlPreviewData> {
#[cfg(not(feature = "url_preview"))]
#[implement(Service)]
#[allow(clippy::unused_async)]
#[expect(clippy::unused_async)]
async fn download_html(&self, _url: &str) -> Result<UrlPreviewData> {
Err!(FeatureDisabled("url_preview"))
}

View File

@@ -128,7 +128,7 @@ async fn fetch_content_authenticated(
}
}
#[allow(deprecated)]
#[expect(deprecated)]
#[implement(super::Service)]
async fn fetch_thumbnail_unauthenticated(
&self,
@@ -164,7 +164,7 @@ async fn fetch_thumbnail_unauthenticated(
.await
}
#[allow(deprecated)]
#[expect(deprecated)]
#[implement(super::Service)]
async fn fetch_content_unauthenticated(
&self,
@@ -360,7 +360,7 @@ fn handle_federation_error(
}
#[implement(super::Service)]
#[allow(deprecated)]
#[expect(deprecated)]
pub async fn fetch_remote_thumbnail_legacy(
&self,
body: &media::get_content_thumbnail::v3::Request,
@@ -403,7 +403,7 @@ pub async fn fetch_remote_thumbnail_legacy(
}
#[implement(super::Service)]
#[allow(deprecated)]
#[expect(deprecated)]
pub async fn fetch_remote_content_legacy(
&self,
mxc: &Mxc<'_>,

View File

@@ -26,7 +26,6 @@ pub struct Dim {
impl super::Service {
/// Uploads or replaces a file thumbnail.
#[allow(clippy::too_many_arguments)]
pub async fn upload_thumbnail(
&self,
mxc: &Mxc<'_>,

View File

@@ -50,7 +50,7 @@ use crate::{
skip_all,
fields(%sender_user, %room_id)
)]
#[allow(clippy::too_many_arguments)]
#[expect(clippy::too_many_arguments)]
pub async fn join(
&self,
sender_user: &UserId,

View File

@@ -1,6 +1,6 @@
#![recursion_limit = "256"]
#![type_length_limit = "98304"]
#![allow(refining_impl_trait)]
#![expect(refining_impl_trait)]
mod manager;
mod migrations;

View File

@@ -48,7 +48,7 @@ impl PresenceAggregator {
pub(crate) async fn clear(&self) { self.inner.write().await.clear(); }
/// Update presence state for a single device.
#[allow(clippy::too_many_arguments)]
#[expect(clippy::too_many_arguments)]
pub(crate) async fn update(
&self,
user_id: &UserId,

View File

@@ -160,7 +160,6 @@ impl Service {
/// Removes the presence record for the given user from the database.
///
/// TODO: Why is this not used?
#[allow(dead_code)]
pub async fn remove_presence(&self, user_id: &UserId) {
self.db.remove_presence(user_id).await;
}

View File

@@ -86,7 +86,7 @@ impl Service {
expected_count != current_count
}
#[allow(clippy::too_many_arguments)]
#[expect(clippy::too_many_arguments)]
async fn apply_device_presence_update(
&self,
user_id: &UserId,

View File

@@ -108,11 +108,7 @@ impl Resolver {
Ok((conf, opts))
}
#[allow(
clippy::as_conversions,
clippy::cast_sign_loss,
clippy::cast_possible_truncation
)]
#[expect(clippy::as_conversions)]
fn configure_opts(server: &Arc<Server>, mut opts: ResolverOpts) -> ResolverOpts {
let config = &server.config;

View File

@@ -68,7 +68,7 @@ impl FedDest {
}
#[inline]
#[allow(clippy::string_slice)]
#[expect(clippy::string_slice)]
pub(crate) fn port(&self) -> Option<u16> {
match &self {
| Self::Literal(addr) => Some(addr.port()),

View File

@@ -26,11 +26,6 @@ type Resolving = MutexMap<OwnedServerName, ()>;
#[async_trait]
impl crate::Service for Service {
#[allow(
clippy::as_conversions,
clippy::cast_sign_loss,
clippy::cast_possible_truncation
)]
fn build(args: &crate::Args<'_>) -> Result<Arc<Self>> {
let cache = Cache::new(args);
Ok(Arc::new(Self {

View File

@@ -22,7 +22,7 @@ use super::check_room_id;
skip_all,
fields(%origin),
)]
#[allow(clippy::type_complexity)]
#[expect(clippy::type_complexity)]
pub(super) async fn fetch_prev<'a, Events>(
&self,
origin: &ServerName,

View File

@@ -12,7 +12,7 @@ use tuwunel_core::{
};
#[implement(super::Service)]
#[allow(clippy::too_many_arguments)]
#[expect(clippy::too_many_arguments)]
#[tracing::instrument(
name = "prev",
level = INFO_SPAN_LEVEL,

View File

@@ -42,7 +42,7 @@ pub struct CachedSpaceHierarchySummary {
summary: SpaceHierarchyParentSummary,
}
#[allow(clippy::large_enum_variant)]
#[expect(clippy::large_enum_variant)]
pub enum SummaryAccessibility {
Accessible(SpaceHierarchyParentSummary),
Inaccessible,

View File

@@ -365,7 +365,7 @@ pub fn set_room_state(
/// This fetches auth events from the current state.
#[implement(Service)]
#[allow(clippy::too_many_arguments)]
#[expect(clippy::too_many_arguments)]
#[tracing::instrument(skip(self, content), level = "debug")]
pub async fn get_auth_events(
&self,

View File

@@ -30,7 +30,7 @@ use tuwunel_database::{Json, serialize_key};
?membership_event,
),
)]
#[allow(clippy::too_many_arguments)]
#[expect(clippy::too_many_arguments)]
pub async fn update_membership(
&self,
room_id: &RoomId,
@@ -48,7 +48,7 @@ pub async fn update_membership(
//
// TODO: use futures to update remote profiles without blocking the membership
// update
#[allow(clippy::collapsible_if)]
#[expect(clippy::collapsible_if)]
if !self.services.globals.user_is_local(user_id) {
if !self.services.users.exists(user_id).await {
self.services

View File

@@ -41,7 +41,7 @@ struct Msg {
queue_id: Vec<u8>,
}
#[allow(clippy::module_name_repetitions)]
#[expect(clippy::module_name_repetitions)]
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
pub enum SendingEvent {
Pdu(RawPduId), // pduid

View File

@@ -159,7 +159,7 @@ impl Service {
});
}
#[allow(clippy::needless_pass_by_ref_mut)]
#[expect(clippy::needless_pass_by_ref_mut)]
async fn handle_response_ok<'a>(
&'a self,
dest: &Destination,
@@ -192,7 +192,7 @@ impl Service {
}
}
#[allow(clippy::needless_pass_by_ref_mut)]
#[expect(clippy::needless_pass_by_ref_mut)]
#[tracing::instrument(name = "request", level = "debug", skip_all)]
async fn handle_request<'a>(
&'a self,
@@ -245,7 +245,7 @@ impl Service {
skip_all,
fields(futures = %futures.len()),
)]
#[allow(clippy::needless_pass_by_ref_mut)]
#[expect(clippy::needless_pass_by_ref_mut)]
async fn startup_netburst<'a>(
&'a self,
id: usize,

View File

@@ -67,7 +67,7 @@ pub fn create(
}
#[implement(Service)]
#[allow(clippy::useless_let_if_seq)]
#[expect(clippy::useless_let_if_seq)]
pub async fn try_auth(
&self,
user_id: &UserId,

View File

@@ -389,13 +389,13 @@ impl Service {
}
#[cfg(not(feature = "ldap"))]
#[allow(clippy::unused_async)]
#[expect(clippy::unused_async)]
pub async fn search_ldap(&self, _user_id: &UserId) -> Result<Vec<(String, bool)>> {
Err!(FeatureDisabled("ldap"))
}
#[cfg(not(feature = "ldap"))]
#[allow(clippy::unused_async)]
#[expect(clippy::unused_async)]
pub async fn auth_ldap(&self, _user_dn: &str, _password: &str) -> Result {
Err!(FeatureDisabled("ldap"))
}