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

@@ -938,7 +938,6 @@ perf = { level = "warn", priority = -1 }
################### ###################
#restriction = "warn" #restriction = "warn"
#allow_attributes = "warn" # UNSTABLE
arithmetic_side_effects = "warn" arithmetic_side_effects = "warn"
as_conversions = "warn" as_conversions = "warn"
as_underscore = "warn" as_underscore = "warn"

View File

@@ -252,7 +252,6 @@ pub(super) enum DebugCommand {
/// - Developer test stubs /// - Developer test stubs
#[command(subcommand)] #[command(subcommand)]
#[allow(non_snake_case)]
#[clap(hide(true))] #[clap(hide(true))]
Tester(TesterCommand), Tester(TesterCommand),
} }

View File

@@ -46,7 +46,7 @@ async fn timer(&self) -> Result {
#[inline(never)] #[inline(never)]
#[rustfmt::skip] #[rustfmt::skip]
#[allow(unused_variables)] #[expect(unused_variables)]
fn timed(body: &[&str]) { fn timed(body: &[&str]) {
} }

View File

@@ -1,4 +1,4 @@
#![allow(rustdoc::broken_intra_doc_links)] #![expect(rustdoc::broken_intra_doc_links)]
mod commands; mod commands;
use clap::Subcommand; use clap::Subcommand;

View File

@@ -1,6 +1,5 @@
#![allow(clippy::wildcard_imports)] #![expect(clippy::enum_glob_use)]
#![allow(clippy::enum_glob_use)] #![expect(clippy::too_many_arguments)]
#![allow(clippy::too_many_arguments)]
pub(crate) mod admin; pub(crate) mod admin;
pub(crate) mod context; pub(crate) mod context;

View File

@@ -173,7 +173,7 @@ fn capture_create(context: &Context<'_>) -> (Arc<Capture>, Arc<Mutex<String>>) {
} }
/// Parse chat messages from the admin room into an AdminCommand object /// Parse chat messages from the admin room into an AdminCommand object
#[allow(clippy::result_large_err)] #[expect(clippy::result_large_err)]
fn parse<'a>( fn parse<'a>(
services: &Arc<Services>, services: &Arc<Services>,
input: &'a CommandInput, input: &'a CommandInput,

View File

@@ -18,7 +18,6 @@ use crate::{admin_command, admin_command_dispatch};
#[admin_command_dispatch(handler_prefix = "raw")] #[admin_command_dispatch(handler_prefix = "raw")]
#[derive(Debug, Subcommand)] #[derive(Debug, Subcommand)]
#[allow(clippy::enum_variant_names)]
/// Query tables from database /// Query tables from database
pub(crate) enum RawCommand { pub(crate) enum RawCommand {
/// - List database maps /// - List database maps

View File

@@ -1,4 +1,4 @@
#![allow(dead_code)] #![expect(dead_code)]
use ruma::{OwnedRoomId, OwnedUserId, RoomId, UserId}; use ruma::{OwnedRoomId, OwnedUserId, RoomId, UserId};
use tuwunel_core::{Err, Result, err}; use tuwunel_core::{Err, Result, err};

View File

@@ -1,4 +1,4 @@
#![allow(deprecated)] #![expect(deprecated)]
use axum::extract::State; use axum::extract::State;
use axum_client_ip::InsecureClientIp; use axum_client_ip::InsecureClientIp;

View File

@@ -157,7 +157,7 @@ pub(crate) async fn get_pushrules_all_route(
// remove old deprecated mentions push rules as per MSC4210 // remove old deprecated mentions push rules as per MSC4210
// and update the stored server default push rules // and update the stored server default push rules
#[allow(deprecated)] #[expect(deprecated)]
{ {
use ruma::push::RuleKind::*; use ruma::push::RuleKind::*;
if global_ruleset if global_ruleset
@@ -245,7 +245,7 @@ pub(crate) async fn get_pushrules_global_route(
// remove old deprecated mentions push rules as per MSC4210 // remove old deprecated mentions push rules as per MSC4210
// and update the stored server default push rules // and update the stored server default push rules
#[allow(deprecated)] #[expect(deprecated)]
{ {
use ruma::push::RuleKind::*; use ruma::push::RuleKind::*;
if global_ruleset if global_ruleset
@@ -303,7 +303,7 @@ pub(crate) async fn get_pushrule_route(
.expect("user is authenticated"); .expect("user is authenticated");
// remove old deprecated mentions push rules as per MSC4210 // remove old deprecated mentions push rules as per MSC4210
#[allow(deprecated)] #[expect(deprecated)]
if body.rule_id.as_str() == PredefinedContentRuleId::ContainsUserName.as_str() if body.rule_id.as_str() == PredefinedContentRuleId::ContainsUserName.as_str()
|| body.rule_id.as_str() == PredefinedOverrideRuleId::ContainsDisplayName.as_str() || body.rule_id.as_str() == PredefinedOverrideRuleId::ContainsDisplayName.as_str()
|| body.rule_id.as_str() == PredefinedOverrideRuleId::RoomNotif.as_str() || body.rule_id.as_str() == PredefinedOverrideRuleId::RoomNotif.as_str()
@@ -396,7 +396,7 @@ pub(crate) async fn get_pushrule_actions_route(
let sender_user = body.sender_user(); let sender_user = body.sender_user();
// remove old deprecated mentions push rules as per MSC4210 // remove old deprecated mentions push rules as per MSC4210
#[allow(deprecated)] #[expect(deprecated)]
if body.rule_id.as_str() == PredefinedContentRuleId::ContainsUserName.as_str() if body.rule_id.as_str() == PredefinedContentRuleId::ContainsUserName.as_str()
|| body.rule_id.as_str() == PredefinedOverrideRuleId::ContainsDisplayName.as_str() || body.rule_id.as_str() == PredefinedOverrideRuleId::ContainsDisplayName.as_str()
|| body.rule_id.as_str() == PredefinedOverrideRuleId::RoomNotif.as_str() || body.rule_id.as_str() == PredefinedOverrideRuleId::RoomNotif.as_str()
@@ -463,7 +463,7 @@ pub(crate) async fn get_pushrule_enabled_route(
let sender_user = body.sender_user(); let sender_user = body.sender_user();
// remove old deprecated mentions push rules as per MSC4210 // remove old deprecated mentions push rules as per MSC4210
#[allow(deprecated)] #[expect(deprecated)]
if body.rule_id.as_str() == PredefinedContentRuleId::ContainsUserName.as_str() if body.rule_id.as_str() == PredefinedContentRuleId::ContainsUserName.as_str()
|| body.rule_id.as_str() == PredefinedOverrideRuleId::ContainsDisplayName.as_str() || body.rule_id.as_str() == PredefinedOverrideRuleId::ContainsDisplayName.as_str()
|| body.rule_id.as_str() == PredefinedOverrideRuleId::RoomNotif.as_str() || body.rule_id.as_str() == PredefinedOverrideRuleId::RoomNotif.as_str()

View File

@@ -127,7 +127,7 @@ pub(crate) async fn get_register_available_route(
/// - Creates a new account and populates it with default account data /// - Creates a new account and populates it with default account data
/// - If `inhibit_login` is false: Creates a device and returns device id and /// - If `inhibit_login` is false: Creates a device and returns device id and
/// access_token /// access_token
#[allow(clippy::doc_markdown)] #[expect(clippy::doc_markdown)]
#[tracing::instrument(skip_all, fields(%client), name = "register")] #[tracing::instrument(skip_all, fields(%client), name = "register")]
pub(crate) async fn register_route( pub(crate) async fn register_route(
State(services): State<crate::State>, State(services): State<crate::State>,

View File

@@ -108,7 +108,7 @@ pub(crate) async fn get_relating_events_route(
.await .await
} }
#[allow(clippy::too_many_arguments)] #[expect(clippy::too_many_arguments)]
#[tracing::instrument( #[tracing::instrument(
name = "relations", name = "relations",
level = "debug", level = "debug",

View File

@@ -55,7 +55,6 @@ use crate::{Ruma, client::utils::invite_check};
/// - Send events listed in initial state /// - Send events listed in initial state
/// - Send events implied by `name` and `topic` /// - Send events implied by `name` and `topic`
/// - Send invite events /// - Send invite events
#[allow(clippy::large_stack_frames)]
pub(crate) async fn create_room_route( pub(crate) async fn create_room_route(
State(services): State<crate::State>, State(services): State<crate::State>,
body: Ruma<create_room::v3::Request>, body: Ruma<create_room::v3::Request>,

View File

@@ -56,7 +56,7 @@ pub(crate) async fn search_events_route(
}) })
} }
#[allow(clippy::map_unwrap_or)] #[expect(clippy::map_unwrap_or)]
async fn category_room_events( async fn category_room_events(
services: &Services, services: &Services,
sender_user: &UserId, sender_user: &UserId,

View File

@@ -15,7 +15,7 @@ pub(super) fn handle_login(
body: &Ruma<Request>, body: &Ruma<Request>,
info: &ApplicationService, info: &ApplicationService,
) -> Result<OwnedUserId> { ) -> Result<OwnedUserId> {
#[allow(deprecated)] #[expect(deprecated)]
let ApplicationService { identifier, user } = info; let ApplicationService { identifier, user } = info;
let Some(ref info) = body.appservice_info else { let Some(ref info) = body.appservice_info else {

View File

@@ -177,7 +177,7 @@ pub(crate) async fn login_route(
.map(HomeserverInfo::new) .map(HomeserverInfo::new)
.map(DiscoveryInfo::new); .map(DiscoveryInfo::new);
#[allow(deprecated)] #[expect(deprecated)]
Ok(login::v3::Response { Ok(login::v3::Response {
user_id, user_id,
access_token, access_token,

View File

@@ -17,7 +17,7 @@ pub(super) async fn handle_login(
body: &Ruma<Request>, body: &Ruma<Request>,
info: &Password, info: &Password,
) -> Result<OwnedUserId> { ) -> Result<OwnedUserId> {
#[allow(deprecated)] #[expect(deprecated)]
let Password { identifier, password, user, .. } = info; let Password { identifier, password, user, .. } = info;
let user_id = if let Some(uiaa::UserIdentifier::UserIdOrLocalpart(user_id)) = identifier { let user_id = if let Some(uiaa::UserIdentifier::UserIdOrLocalpart(user_id)) = identifier {

View File

@@ -525,7 +525,6 @@ async fn process_presence_updates(
full = %full_state, full = %full_state,
), ),
)] )]
#[allow(clippy::too_many_arguments)]
async fn handle_left_room( async fn handle_left_room(
services: &Services, services: &Services,
since: u64, since: u64,
@@ -744,7 +743,7 @@ async fn load_left_room(
room_id = ?room_id, room_id = ?room_id,
), ),
)] )]
#[allow(clippy::too_many_arguments)] #[expect(clippy::too_many_arguments)]
async fn load_joined_room( async fn load_joined_room(
services: &Services, services: &Services,
sender_user: &UserId, sender_user: &UserId,
@@ -1163,7 +1162,7 @@ async fn load_joined_room(
cs = %current_shortstatehash, cs = %current_shortstatehash,
) )
)] )]
#[allow(clippy::too_many_arguments)] #[expect(clippy::too_many_arguments)]
async fn calculate_state_changes<'a>( async fn calculate_state_changes<'a>(
services: &Services, services: &Services,
sender_user: &UserId, sender_user: &UserId,

View File

@@ -21,7 +21,7 @@ pub(super) async fn filter_room(
room_id: &RoomId, room_id: &RoomId,
membership: Option<&MembershipState>, membership: Option<&MembershipState>,
) -> bool { ) -> bool {
#[allow(clippy::match_same_arms)] // helps readability #[expect(clippy::match_same_arms)] // helps readability
let match_invite = filter let match_invite = filter
.is_invite .is_invite
.map_async(async |is_invite| match (membership, is_invite) { .map_async(async |is_invite| match (membership, is_invite) {

View File

@@ -73,7 +73,6 @@ pub(super) async fn handle(
skip_all, skip_all,
fields(room_id, roomsince) fields(room_id, roomsince)
)] )]
#[allow(clippy::too_many_arguments)]
async fn handle_room( async fn handle_room(
SyncInfo { services, sender_user, .. }: SyncInfo<'_>, SyncInfo { services, sender_user, .. }: SyncInfo<'_>,
conn: &Connection, conn: &Connection,
@@ -360,7 +359,6 @@ async fn handle_room(
} }
#[tracing::instrument(name = "heroes", level = "trace", skip_all)] #[tracing::instrument(name = "heroes", level = "trace", skip_all)]
#[allow(clippy::type_complexity)]
async fn calculate_heroes( async fn calculate_heroes(
services: &Services, services: &Services,
sender_user: &UserId, sender_user: &UserId,

View File

@@ -1,5 +1,5 @@
#![type_length_limit = "262144"] //TODO: REDUCE ME #![type_length_limit = "262144"] //TODO: REDUCE ME
#![allow(clippy::toplevel_ref_arg)] #![expect(clippy::toplevel_ref_arg)]
pub mod client; pub mod client;
pub mod router; pub mod router;

View File

@@ -153,7 +153,7 @@ fn into_http_request(request: &Request, body: Bytes) -> hyper::Request<Bytes> {
.expect("http request body") .expect("http request body")
} }
#[allow(clippy::needless_pass_by_value)] #[expect(clippy::needless_pass_by_value)]
fn take_body( fn take_body(
services: &Services, services: &Services,
request: &mut Request, request: &mut Request,

View File

@@ -35,6 +35,7 @@ impl RouterExt for Router<State> {
macro_rules! ruma_handler { macro_rules! ruma_handler {
( $($tx:ident),* $(,)? ) => { ( $($tx:ident),* $(,)? ) => {
#[allow(clippy::allow_attributes)]
#[allow(non_snake_case)] #[allow(non_snake_case)]
impl<Err, Req, Fut, Fun, $($tx,)*> RumaHandler<($($tx,)* Ruma<Req>,)> for Fun impl<Err, Req, Fut, Fun, $($tx,)*> RumaHandler<($($tx,)* Ruma<Req>,)> for Fun
where where

View File

@@ -1,4 +1,4 @@
#![allow(deprecated)] #![expect(deprecated)]
use std::borrow::Borrow; use std::borrow::Borrow;

View File

@@ -1,4 +1,4 @@
#![allow(deprecated)] #![expect(deprecated)]
use axum::extract::State; use axum::extract::State;
use futures::FutureExt; use futures::FutureExt;

View File

@@ -197,7 +197,7 @@ fn resolve_deeper_event_set(c: &mut Criterion) {
/////////////////////////////////////////////////////////////////////*/ /////////////////////////////////////////////////////////////////////*/
struct TestStore<E: Event>(HashMap<OwnedEventId, E>); struct TestStore<E: Event>(HashMap<OwnedEventId, E>);
#[allow(unused)] #[expect(unused)]
impl<E: Event> TestStore<E> { impl<E: Event> TestStore<E> {
fn get_event(&self, room_id: &RoomId, event_id: &EventId) -> Result<E> { fn get_event(&self, room_id: &RoomId, event_id: &EventId) -> Result<E> {
self.0 self.0
@@ -278,7 +278,7 @@ impl<E: Event> TestStore<E> {
} }
impl TestStore<PduEvent> { impl TestStore<PduEvent> {
#[allow(clippy::type_complexity)] #[expect(clippy::type_complexity)]
fn set_up( fn set_up(
&mut self, &mut self,
) -> (StateMap<OwnedEventId>, StateMap<OwnedEventId>, StateMap<OwnedEventId>) { ) -> (StateMap<OwnedEventId>, StateMap<OwnedEventId>, StateMap<OwnedEventId>) {
@@ -463,7 +463,7 @@ where
} }
// all graphs start with these input events // all graphs start with these input events
#[allow(non_snake_case)] #[expect(non_snake_case)]
fn INITIAL_EVENTS() -> HashMap<OwnedEventId, PduEvent> { fn INITIAL_EVENTS() -> HashMap<OwnedEventId, PduEvent> {
vec![ vec![
to_pdu_event::<&EventId>( to_pdu_event::<&EventId>(
@@ -545,7 +545,7 @@ fn INITIAL_EVENTS() -> HashMap<OwnedEventId, PduEvent> {
} }
// all graphs start with these input events // all graphs start with these input events
#[allow(non_snake_case)] #[expect(non_snake_case)]
fn BAN_STATE_SET() -> HashMap<OwnedEventId, PduEvent> { fn BAN_STATE_SET() -> HashMap<OwnedEventId, PduEvent> {
vec![ vec![
to_pdu_event( to_pdu_event(

View File

@@ -22,7 +22,6 @@ pub fn reload(old: &Config, new: &Config) -> Result {
Ok(()) Ok(())
} }
#[allow(clippy::cognitive_complexity)]
pub fn check(config: &Config) -> Result { pub fn check(config: &Config) -> Result {
if cfg!(debug_assertions) { if cfg!(debug_assertions) {
warn!("Note: tuwunel was built without optimisations (i.e. debug build)"); warn!("Note: tuwunel was built without optimisations (i.e. debug build)");

View File

@@ -107,7 +107,7 @@ fn load(&self, handle: &mut [Option<Arc<Config>>]) -> &'static Arc<Config> {
skip_all, skip_all,
fields(%index, ?config) fields(%index, ?config)
)] )]
#[allow(clippy::transmute_ptr_to_ptr)] #[expect(clippy::transmute_ptr_to_ptr)]
fn load_miss( fn load_miss(
handle: &mut [Option<Arc<Config>>], handle: &mut [Option<Arc<Config>>],
index: usize, index: usize,

View File

@@ -33,8 +33,8 @@ use crate::{
}; };
/// All the config options for tuwunel. /// All the config options for tuwunel.
#[allow(clippy::struct_excessive_bools)] #[expect(clippy::struct_excessive_bools)]
#[allow(rustdoc::broken_intra_doc_links, rustdoc::bare_urls)] #[expect(rustdoc::broken_intra_doc_links, rustdoc::bare_urls)]
#[derive(Clone, Debug, Deserialize)] #[derive(Clone, Debug, Deserialize)]
#[config_example_generator( #[config_example_generator(
filename = "tuwunel-example.toml", filename = "tuwunel-example.toml",
@@ -97,7 +97,7 @@ pub struct Config {
#[serde(default = "default_new_user_displayname_suffix")] #[serde(default = "default_new_user_displayname_suffix")]
pub new_user_displayname_suffix: String, pub new_user_displayname_suffix: String,
#[allow(clippy::doc_link_with_quotes)] #[expect(clippy::doc_link_with_quotes)]
/// The default address (IPv4 or IPv6) tuwunel will listen on. /// The default address (IPv4 or IPv6) tuwunel will listen on.
/// ///
/// If you are using Docker or a container NAT networking setup, this must /// If you are using Docker or a container NAT networking setup, this must
@@ -821,7 +821,7 @@ pub struct Config {
#[serde(default)] #[serde(default)]
pub proxy: ProxyConfig, pub proxy: ProxyConfig,
#[allow(clippy::doc_link_with_quotes)] #[expect(clippy::doc_link_with_quotes)]
/// Servers listed here will be used to gather public keys of other servers /// Servers listed here will be used to gather public keys of other servers
/// (notary trusted key servers). /// (notary trusted key servers).
/// ///
@@ -1007,7 +1007,7 @@ pub struct Config {
#[serde(default)] #[serde(default)]
pub turn_password: String, pub turn_password: String,
#[allow(clippy::doc_link_with_quotes)] #[expect(clippy::doc_link_with_quotes)]
/// Vector list of TURN URIs/servers to use. /// Vector list of TURN URIs/servers to use.
/// ///
/// Replace "example.turn.uri" with your TURN domain, such as the coturn /// Replace "example.turn.uri" with your TURN domain, such as the coturn
@@ -1045,7 +1045,7 @@ pub struct Config {
#[serde(default = "default_turn_ttl")] #[serde(default = "default_turn_ttl")]
pub turn_ttl: u64, pub turn_ttl: u64,
#[allow(clippy::doc_link_with_quotes)] #[expect(clippy::doc_link_with_quotes)]
/// List/vector of room IDs or room aliases that tuwunel will make newly /// List/vector of room IDs or room aliases that tuwunel will make newly
/// registered users join. The rooms specified must be rooms that you have /// registered users join. The rooms specified must be rooms that you have
/// joined at least once on the server, and must be public. /// joined at least once on the server, and must be public.
@@ -1624,7 +1624,7 @@ pub struct Config {
#[serde(default, with = "serde_regex")] #[serde(default, with = "serde_regex")]
pub forbidden_remote_room_directory_server_names: RegexSet, pub forbidden_remote_room_directory_server_names: RegexSet,
#[allow(clippy::doc_link_with_quotes)] #[expect(clippy::doc_link_with_quotes)]
/// Vector list of IPv4 and IPv6 CIDR ranges / subnets *in quotes* that you /// Vector list of IPv4 and IPv6 CIDR ranges / subnets *in quotes* that you
/// do not want tuwunel to send outbound requests to. Defaults to /// do not want tuwunel to send outbound requests to. Defaults to
/// RFC1918, unroutable, loopback, multicast, and testnet addresses for /// RFC1918, unroutable, loopback, multicast, and testnet addresses for
@@ -1842,7 +1842,7 @@ pub struct Config {
#[serde(default)] #[serde(default)]
pub admin_console_automatic: bool, pub admin_console_automatic: bool,
#[allow(clippy::doc_link_with_quotes)] #[expect(clippy::doc_link_with_quotes)]
/// List of admin commands to execute on startup. /// List of admin commands to execute on startup.
/// ///
/// This option can also be configured with the `--execute` tuwunel /// This option can also be configured with the `--execute` tuwunel
@@ -2229,7 +2229,7 @@ pub struct Config {
pub identity_provider: HashSet<IdentityProvider>, pub identity_provider: HashSet<IdentityProvider>,
#[serde(flatten)] #[serde(flatten)]
#[allow(clippy::zero_sized_map_values)] #[expect(clippy::zero_sized_map_values)]
// this is a catchall, the map shouldn't be zero at runtime // this is a catchall, the map shouldn't be zero at runtime
catchall: BTreeMap<String, IgnoredAny>, catchall: BTreeMap<String, IgnoredAny>,
} }
@@ -2252,7 +2252,7 @@ pub struct TlsConfig {
pub dual_protocol: bool, pub dual_protocol: bool,
} }
#[allow(rustdoc::broken_intra_doc_links, rustdoc::bare_urls)] #[expect(rustdoc::broken_intra_doc_links, rustdoc::bare_urls)]
#[derive(Clone, Debug, Deserialize, Default)] #[derive(Clone, Debug, Deserialize, Default)]
#[config_example_generator( #[config_example_generator(
filename = "tuwunel-example.toml", filename = "tuwunel-example.toml",
@@ -2317,7 +2317,7 @@ pub struct WellKnownConfig {
} }
#[derive(Clone, Copy, Debug, Deserialize, Default)] #[derive(Clone, Copy, Debug, Deserialize, Default)]
#[allow(rustdoc::broken_intra_doc_links, rustdoc::bare_urls)] #[expect(rustdoc::broken_intra_doc_links, rustdoc::bare_urls)]
#[config_example_generator( #[config_example_generator(
filename = "tuwunel-example.toml", filename = "tuwunel-example.toml",
section = "global.blurhashing" section = "global.blurhashing"
@@ -3129,13 +3129,13 @@ fn default_rocksdb_compression_algo() -> String {
/// Default RocksDB compression level is 32767, which is internally read by /// Default RocksDB compression level is 32767, which is internally read by
/// RocksDB as the default magic number and translated to the library's default /// RocksDB as the default magic number and translated to the library's default
/// compression level as they all differ. See their `kDefaultCompressionLevel`. /// compression level as they all differ. See their `kDefaultCompressionLevel`.
#[allow(clippy::doc_markdown)] #[expect(clippy::doc_markdown)]
fn default_rocksdb_compression_level() -> i32 { 32767 } fn default_rocksdb_compression_level() -> i32 { 32767 }
/// Default RocksDB compression level is 32767, which is internally read by /// Default RocksDB compression level is 32767, which is internally read by
/// RocksDB as the default magic number and translated to the library's default /// RocksDB as the default magic number and translated to the library's default
/// compression level as they all differ. See their `kDefaultCompressionLevel`. /// compression level as they all differ. See their `kDefaultCompressionLevel`.
#[allow(clippy::doc_markdown)] #[expect(clippy::doc_markdown)]
fn default_rocksdb_bottommost_compression_level() -> i32 { 32767 } fn default_rocksdb_bottommost_compression_level() -> i32 { 32767 }
fn default_rocksdb_stats_level() -> u8 { 1 } fn default_rocksdb_stats_level() -> u8 { 1 }
@@ -3198,7 +3198,7 @@ fn default_admin_log_capture() -> String {
fn default_admin_room_tag() -> String { "m.server_notice".to_owned() } fn default_admin_room_tag() -> String { "m.server_notice".to_owned() }
#[allow(clippy::as_conversions, clippy::cast_precision_loss)] #[expect(clippy::as_conversions, clippy::cast_precision_loss)]
fn parallelism_scaled_f64(val: f64) -> f64 { val * (sys::available_parallelism() as f64) } fn parallelism_scaled_f64(val: f64) -> f64 { val * (sys::available_parallelism() as f64) }
fn parallelism_scaled_u32(val: u32) -> u32 { fn parallelism_scaled_u32(val: u32) -> u32 {

View File

@@ -127,7 +127,7 @@ impl WildCardedDomain {
impl std::str::FromStr for WildCardedDomain { impl std::str::FromStr for WildCardedDomain {
type Err = std::convert::Infallible; type Err = std::convert::Infallible;
#[allow(clippy::string_slice)] #[expect(clippy::string_slice)]
fn from_str(s: &str) -> Result<Self, Self::Err> { fn from_str(s: &str) -> Result<Self, Self::Err> {
// maybe do some domain validation? // maybe do some domain validation?
Ok(if s.starts_with("*.") { Ok(if s.starts_with("*.") {

View File

@@ -1,5 +1,3 @@
#![allow(clippy::disallowed_macros)]
use std::{any::Any, env, panic, sync::LazyLock}; use std::{any::Any, env, panic, sync::LazyLock};
use tracing::Level; use tracing::Level;
@@ -73,7 +71,6 @@ fn set_panic_trap() {
#[cold] #[cold]
#[inline(never)] #[inline(never)]
#[allow(deprecated_in_future)]
pub fn panic_handler(info: &panic::PanicHookInfo<'_>, next: &dyn Fn(&panic::PanicHookInfo<'_>)) { pub fn panic_handler(info: &panic::PanicHookInfo<'_>, next: &dyn Fn(&panic::PanicHookInfo<'_>)) {
trap(); trap();
next(info); next(info);

View File

@@ -239,7 +239,7 @@ impl<T> From<PoisonError<T>> for Error {
fn from(e: PoisonError<T>) -> Self { Self::Poison(e.to_string().into()) } fn from(e: PoisonError<T>) -> Self { Self::Poison(e.to_string().into()) }
} }
#[allow(clippy::fallible_impl_from)] #[expect(clippy::fallible_impl_from)]
impl From<Infallible> for Error { impl From<Infallible> for Error {
#[cold] #[cold]
#[inline(never)] #[inline(never)]
@@ -257,5 +257,5 @@ pub fn infallible(_e: &Infallible) {
/// Convenience functor for fundamental Error::sanitized_message(); see member. /// Convenience functor for fundamental Error::sanitized_message(); see member.
#[inline] #[inline]
#[must_use] #[must_use]
#[allow(clippy::needless_pass_by_value)] #[expect(clippy::needless_pass_by_value)]
pub fn sanitized_message(e: Error) -> String { e.sanitized_message() } pub fn sanitized_message(e: Error) -> String { e.sanitized_message() }

View File

@@ -1,5 +1,3 @@
#![allow(clippy::disallowed_macros)]
pub mod capture; pub mod capture;
pub mod color; pub mod color;
pub mod console; pub mod console;

View File

@@ -1,4 +1,4 @@
#![allow( #![expect(
clippy::cast_possible_wrap, clippy::cast_possible_wrap,
clippy::cast_sign_loss, clippy::cast_sign_loss,
clippy::as_conversions clippy::as_conversions

View File

@@ -22,11 +22,9 @@ impl<E: Event> RoomCreateEvent<E> {
pub fn new(event: E) -> Self { Self(event) } pub fn new(event: E) -> Self { Self(event) }
/// The version of the room. /// The version of the room.
#[allow(dead_code)]
pub fn room_version(&self) -> Result<RoomVersionId> { pub fn room_version(&self) -> Result<RoomVersionId> {
#[derive(Deserialize)] #[derive(Deserialize)]
struct RoomCreateContentRoomVersion { struct RoomCreateContentRoomVersion {
#[allow(dead_code)]
room_version: Option<RoomVersionId>, room_version: Option<RoomVersionId>,
} }

View File

@@ -146,7 +146,7 @@ where
Ok(0) Ok(0)
} }
#[allow(clippy::redundant_closure)] #[expect(clippy::redundant_closure)]
#[tracing::instrument(level = "trace", skip_all)] #[tracing::instrument(level = "trace", skip_all)]
async fn get_power_levels_auth_event<Fetch, Fut, Pdu>( async fn get_power_levels_auth_event<Fetch, Fut, Pdu>(
event: &Pdu, event: &Pdu,

View File

@@ -652,7 +652,7 @@ async fn join_rule_with_auth_chain() {
do_check(&join_rule.values().cloned().collect::<Vec<_>>(), edges, expected_state_ids).await; do_check(&join_rule.values().cloned().collect::<Vec<_>>(), edges, expected_state_ids).await;
} }
#[allow(non_snake_case)] #[expect(non_snake_case)]
fn BAN_STATE_SET() -> HashMap<OwnedEventId, PduEvent> { fn BAN_STATE_SET() -> HashMap<OwnedEventId, PduEvent> {
vec![ vec![
to_pdu_event( to_pdu_event(
@@ -697,7 +697,7 @@ fn BAN_STATE_SET() -> HashMap<OwnedEventId, PduEvent> {
.collect() .collect()
} }
#[allow(non_snake_case)] #[expect(non_snake_case)]
fn JOIN_RULE() -> HashMap<OwnedEventId, PduEvent> { fn JOIN_RULE() -> HashMap<OwnedEventId, PduEvent> {
vec![ vec![
to_pdu_event( to_pdu_event(
@@ -726,7 +726,7 @@ fn JOIN_RULE() -> HashMap<OwnedEventId, PduEvent> {
macro_rules! state_set { macro_rules! state_set {
($($kind:expr => $key:expr => $id:expr),* $(,)?) => {{ ($($kind:expr => $key:expr => $id:expr),* $(,)?) => {{
#[allow(unused_mut)] #[expect(unused_mut)]
let mut x = StateMap::new(); let mut x = StateMap::new();
$( $(
x.insert(($kind, $key.into()), $id); x.insert(($kind, $key.into()), $id);

View File

@@ -75,7 +75,7 @@ impl PartialOrd for TieBreaker<'_> {
graph = graph.len(), graph = graph.len(),
) )
)] )]
#[allow(clippy::implicit_hasher)] #[expect(clippy::implicit_hasher)]
pub async fn topological_sort<Query, Fut>( pub async fn topological_sort<Query, Fut>(
graph: &HashMap<OwnedEventId, HashSet<OwnedEventId>>, graph: &HashMap<OwnedEventId, HashSet<OwnedEventId>>,
query: &Query, query: &Query,

View File

@@ -248,7 +248,7 @@ pub(super) async fn do_check(
assert_eq!(expected_state, end_state); assert_eq!(expected_state, end_state);
} }
#[allow(clippy::exhaustive_structs)] #[expect(clippy::exhaustive_structs)]
pub(super) struct TestStore(pub(super) HashMap<OwnedEventId, PduEvent>); pub(super) struct TestStore(pub(super) HashMap<OwnedEventId, PduEvent>);
impl TestStore { impl TestStore {
@@ -286,7 +286,7 @@ impl TestStore {
} }
// A StateStore implementation for testing // A StateStore implementation for testing
#[allow(clippy::type_complexity)] #[expect(clippy::type_complexity)]
impl TestStore { impl TestStore {
pub(super) fn set_up( pub(super) fn set_up(
&mut self, &mut self,
@@ -646,7 +646,7 @@ pub(super) fn room_create_hydra_pdu_event(
} }
// all graphs start with these input events // all graphs start with these input events
#[allow(non_snake_case)] #[expect(non_snake_case)]
pub(super) fn INITIAL_EVENTS() -> HashMap<OwnedEventId, PduEvent> { pub(super) fn INITIAL_EVENTS() -> HashMap<OwnedEventId, PduEvent> {
vec![ vec![
to_pdu_event::<&EventId>( to_pdu_event::<&EventId>(
@@ -729,7 +729,7 @@ pub(super) fn INITIAL_EVENTS() -> HashMap<OwnedEventId, PduEvent> {
/// Batch of initial events to use for incoming events from room version /// Batch of initial events to use for incoming events from room version
/// `org.matrix.hydra.11` onwards. /// `org.matrix.hydra.11` onwards.
#[allow(non_snake_case)] #[expect(non_snake_case)]
pub(super) fn INITIAL_HYDRA_EVENTS() -> HashMap<OwnedEventId, PduEvent> { pub(super) fn INITIAL_HYDRA_EVENTS() -> HashMap<OwnedEventId, PduEvent> {
vec![ vec![
room_create_hydra_pdu_event( room_create_hydra_pdu_event(
@@ -807,7 +807,7 @@ pub(super) fn INITIAL_HYDRA_EVENTS() -> HashMap<OwnedEventId, PduEvent> {
} }
// all graphs start with these input events // all graphs start with these input events
#[allow(non_snake_case)] #[expect(non_snake_case)]
pub(super) fn INITIAL_EVENTS_CREATE_ROOM() -> HashMap<OwnedEventId, PduEvent> { pub(super) fn INITIAL_EVENTS_CREATE_ROOM() -> HashMap<OwnedEventId, PduEvent> {
vec![to_pdu_event::<&EventId>( vec![to_pdu_event::<&EventId>(
"CREATE", "CREATE",
@@ -823,7 +823,7 @@ pub(super) fn INITIAL_EVENTS_CREATE_ROOM() -> HashMap<OwnedEventId, PduEvent> {
.collect() .collect()
} }
#[allow(non_snake_case)] #[expect(non_snake_case)]
pub(super) fn INITIAL_EDGES() -> Vec<OwnedEventId> { pub(super) fn INITIAL_EDGES() -> Vec<OwnedEventId> {
vec!["START", "IMC", "IMB", "IJR", "IPOWER", "IMA", "CREATE"] vec!["START", "IMC", "IMB", "IJR", "IPOWER", "IMA", "CREATE"]
.into_iter() .into_iter()

View File

@@ -24,5 +24,5 @@ pub(crate) fn check_and_reset() -> bool { STATIC_DTORS.swap(0, ORDERING) == 0 }
/// Called by Module::unload() after unload to verify static destruction took /// Called by Module::unload() after unload to verify static destruction took
/// place. A call to prepare() must be made prior to Module::unload() and making /// place. A call to prepare() must be made prior to Module::unload() and making
/// this call. /// this call.
#[allow(dead_code)] #[expect(dead_code)]
pub(crate) fn check() -> bool { STATIC_DTORS.load(ORDERING) == 0 } pub(crate) fn check() -> bool { STATIC_DTORS.load(ORDERING) == 0 }

View File

@@ -28,7 +28,7 @@ pub trait BoolExt {
fn into_option(self) -> Option<()>; fn into_option(self) -> Option<()>;
#[allow(clippy::result_unit_err)] #[expect(clippy::result_unit_err)]
fn into_result(self) -> Result<(), ()>; fn into_result(self) -> Result<(), ()>;
#[must_use] #[must_use]

View File

@@ -60,7 +60,7 @@ impl<T: fmt::Debug> fmt::Debug for TruncatedSlice<'_, T> {
} }
impl fmt::Debug for TruncatedStr<'_> { impl fmt::Debug for TruncatedStr<'_> {
#[allow(clippy::string_slice)] #[expect(clippy::string_slice)]
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
if self.inner.len() <= self.max_len { if self.inner.len() <= self.max_len {
write!(f, "{:?}", self.inner) write!(f, "{:?}", self.inner)

View File

@@ -1,5 +1,5 @@
//! Extended external extensions to futures::FutureExt //! Extended external extensions to futures::FutureExt
#![allow(clippy::many_single_char_names, clippy::impl_trait_in_params)] #![expect(clippy::many_single_char_names, clippy::impl_trait_in_params)]
use std::marker::Unpin; use std::marker::Unpin;

View File

@@ -1,4 +1,4 @@
#![allow(clippy::wrong_self_convention)] #![expect(clippy::wrong_self_convention)]
use futures::{Future, FutureExt, future::OptionFuture}; use futures::{Future, FutureExt, future::OptionFuture};

View File

@@ -1,4 +1,4 @@
#![allow(clippy::wrong_self_convention)] #![expect(clippy::wrong_self_convention)]
use futures::Future; use futures::Future;

View File

@@ -1,8 +1,8 @@
//! Extended external extensions to futures::TryFutureExt //! Extended external extensions to futures::TryFutureExt
#![allow(clippy::type_complexity)] #![expect(clippy::type_complexity)]
// is_ok() has to consume *self rather than borrow. This extension is for a // is_ok() has to consume *self rather than borrow. This extension is for a
// caller only ever caring about result status while discarding all contents. // caller only ever caring about result status while discarding all contents.
#![allow(clippy::wrong_self_convention)] #![expect(clippy::wrong_self_convention)]
use std::marker::Unpin; use std::marker::Unpin;
@@ -22,7 +22,7 @@ where
where where
Self: Sized; Self: Sized;
#[allow(clippy::wrong_self_convention)] #[expect(clippy::wrong_self_convention)]
fn is_ok( fn is_ok(
self, self,
) -> MapOkOrElse<Self, impl FnOnce(Self::Ok) -> bool, impl FnOnce(Self::Error) -> bool> ) -> MapOkOrElse<Self, impl FnOnce(Self::Ok) -> bool, impl FnOnce(Self::Error) -> bool>

View File

@@ -42,7 +42,7 @@ macro_rules! expected {
#[collapse_debuginfo(yes)] #[collapse_debuginfo(yes)]
macro_rules! validated { macro_rules! validated {
($($input:tt)+) => { ($($input:tt)+) => {
//#[allow(clippy::arithmetic_side_effects)] { //#[expect(clippy::arithmetic_side_effects)] {
//Some($($input)*) //Some($($input)*)
// .ok_or_else(|| $crate::err!(Arithmetic("this error should never been seen"))) // .ok_or_else(|| $crate::err!(Arithmetic("this error should never been seen")))
//} //}
@@ -62,7 +62,6 @@ macro_rules! validated {
} }
#[inline] #[inline]
#[allow(clippy::as_conversions)]
pub fn usize_from_f64(val: f64) -> Result<usize, Error> { pub fn usize_from_f64(val: f64) -> Result<usize, Error> {
if val < 0.0 { if val < 0.0 {
return Err!(Arithmetic("Converting negative float to unsigned integer")); return Err!(Arithmetic("Converting negative float to unsigned integer"));
@@ -92,7 +91,7 @@ pub fn ruma_from_usize(val: usize) -> ruma::UInt {
#[inline] #[inline]
#[must_use] #[must_use]
#[allow(clippy::as_conversions, clippy::cast_possible_truncation)] #[expect(clippy::as_conversions, clippy::cast_possible_truncation)]
pub fn usize_from_u64_truncated(val: u64) -> usize { val as usize } pub fn usize_from_u64_truncated(val: u64) -> usize { val as usize }
#[inline] #[inline]

View File

@@ -1,4 +1,4 @@
#![allow(clippy::wrong_self_convention)] #![expect(clippy::wrong_self_convention)]
use super::Result; use super::Result;

View File

@@ -1,5 +1,5 @@
//! Synchronous combinator extensions to futures::Stream //! Synchronous combinator extensions to futures::Stream
#![allow(clippy::type_complexity)] #![expect(clippy::type_complexity)]
use futures::{ use futures::{
future::{FutureExt, Ready, ready}, future::{FutureExt, Ready, ready},
@@ -198,7 +198,7 @@ where
} }
#[inline] #[inline]
#[allow(clippy::unit_arg)] #[expect(clippy::unit_arg)]
fn ready_for_each<F>( fn ready_for_each<F>(
self, self,
mut f: F, mut f: F,

View File

@@ -1,5 +1,5 @@
//! Synchronous combinator extensions to futures::TryStream //! Synchronous combinator extensions to futures::TryStream
#![allow(clippy::type_complexity)] #![expect(clippy::type_complexity)]
use futures::{ use futures::{
future::{Ready, ready}, future::{Ready, ready},

View File

@@ -1,5 +1,5 @@
//! TryStreamTools for futures::TryStream //! TryStreamTools for futures::TryStream
#![allow(clippy::type_complexity)] #![expect(clippy::type_complexity)]
use futures::{TryStream, TryStreamExt, future, future::Ready, stream::TryTakeWhile}; use futures::{TryStream, TryStreamExt, future, future::Ready, stream::TryTakeWhile};

View File

@@ -65,7 +65,7 @@ pub fn camel_to_snake_string(s: &str) -> String {
} }
#[inline] #[inline]
#[allow(clippy::unbuffered_bytes)] // these are allocated string utilities, not file I/O utils #[expect(clippy::unbuffered_bytes)] // these are allocated string utilities, not file I/O utils
pub fn camel_to_snake_case<I, O>(output: &mut O, input: I) -> Result pub fn camel_to_snake_case<I, O>(output: &mut O, input: I) -> Result
where where
I: std::io::Read, I: std::io::Read,
@@ -95,7 +95,7 @@ where
/// common_prefix(&input) == "con"; /// common_prefix(&input) == "con";
/// ``` /// ```
#[must_use] #[must_use]
#[allow(clippy::string_slice)] #[expect(clippy::string_slice)]
pub fn common_prefix<T: AsRef<str>>(choice: &[T]) -> &str { pub fn common_prefix<T: AsRef<str>>(choice: &[T]) -> &str {
choice.first().map_or(EMPTY, move |best| { choice.first().map_or(EMPTY, move |best| {
choice choice
@@ -114,7 +114,7 @@ pub fn common_prefix<T: AsRef<str>>(choice: &[T]) -> &str {
#[inline] #[inline]
#[must_use] #[must_use]
#[allow(clippy::arithmetic_side_effects)] #[expect(clippy::arithmetic_side_effects)]
pub fn truncate_deterministic(str: &str, range: Option<Range<usize>>) -> &str { pub fn truncate_deterministic(str: &str, range: Option<Range<usize>>) -> &str {
let range = range.unwrap_or(0..str.len()); let range = range.unwrap_or(0..str.len());
let len = str let len = str

View File

@@ -34,7 +34,7 @@ impl<'a> From<&'a str> for &'a Unquoted {
//SAFETY: This is a pattern I lifted from ruma-identifiers for strong-type strs //SAFETY: This is a pattern I lifted from ruma-identifiers for strong-type strs
// by wrapping in a tuple-struct. // by wrapping in a tuple-struct.
#[allow(clippy::transmute_ptr_to_ptr)] #[expect(clippy::transmute_ptr_to_ptr)]
unsafe { unsafe {
std::mem::transmute(s) std::mem::transmute(s)
} }

View File

@@ -179,7 +179,7 @@ pub fn name_from_path(path: &Path) -> Result<String> {
} }
/// Get the (major, minor) of the block device on which Path is mounted. /// Get the (major, minor) of the block device on which Path is mounted.
#[allow( #[expect(
clippy::useless_conversion, clippy::useless_conversion,
clippy::unnecessary_fallible_conversions clippy::unnecessary_fallible_conversions
)] )]

View File

@@ -1,4 +1,4 @@
#![allow(clippy::disallowed_methods)] #![expect(clippy::disallowed_methods)]
use crate::utils; use crate::utils;
@@ -109,7 +109,7 @@ async fn mutex_map_contend() {
} }
#[test] #[test]
#[allow(clippy::iter_on_single_items, clippy::many_single_char_names)] #[expect(clippy::iter_on_single_items, clippy::many_single_char_names)]
fn set_intersection_none() { fn set_intersection_none() {
use utils::set::intersection; use utils::set::intersection;
@@ -139,7 +139,7 @@ fn set_intersection_none() {
} }
#[test] #[test]
#[allow(clippy::iter_on_single_items, clippy::many_single_char_names)] #[expect(clippy::iter_on_single_items, clippy::many_single_char_names)]
fn set_intersection_all() { fn set_intersection_all() {
use utils::set::intersection; use utils::set::intersection;
@@ -167,7 +167,7 @@ fn set_intersection_all() {
} }
#[test] #[test]
#[allow(clippy::iter_on_single_items, clippy::many_single_char_names)] #[expect(clippy::iter_on_single_items, clippy::many_single_char_names)]
fn set_intersection_some() { fn set_intersection_some() {
use utils::set::intersection; use utils::set::intersection;
@@ -189,7 +189,7 @@ fn set_intersection_some() {
} }
#[test] #[test]
#[allow(clippy::iter_on_single_items, clippy::many_single_char_names)] #[expect(clippy::iter_on_single_items, clippy::many_single_char_names)]
fn set_intersection_sorted_some() { fn set_intersection_sorted_some() {
use utils::set::intersection_sorted; use utils::set::intersection_sorted;
@@ -211,7 +211,7 @@ fn set_intersection_sorted_some() {
} }
#[test] #[test]
#[allow(clippy::iter_on_single_items, clippy::many_single_char_names)] #[expect(clippy::iter_on_single_items, clippy::many_single_char_names)]
fn set_intersection_sorted_all() { fn set_intersection_sorted_all() {
use utils::set::intersection_sorted; use utils::set::intersection_sorted;

View File

@@ -6,7 +6,7 @@ use crate::{Result, err};
#[inline] #[inline]
#[must_use] #[must_use]
#[allow(clippy::as_conversions, clippy::cast_possible_truncation)] #[expect(clippy::as_conversions, clippy::cast_possible_truncation)]
pub fn now_millis() -> u64 { now().as_millis() as u64 } pub fn now_millis() -> u64 { now().as_millis() as u64 }
#[inline] #[inline]
@@ -87,7 +87,7 @@ pub fn format(ts: SystemTime, str: &str) -> String {
} }
#[must_use] #[must_use]
#[allow( #[expect(
clippy::as_conversions, clippy::as_conversions,
clippy::cast_possible_truncation, clippy::cast_possible_truncation,
clippy::cast_sign_loss clippy::cast_sign_loss
@@ -113,7 +113,7 @@ pub fn pretty(d: Duration) -> String {
/// part is the largest Unit containing a non-zero value, the frac part is a /// part is the largest Unit containing a non-zero value, the frac part is a
/// rational remainder left over. /// rational remainder left over.
#[must_use] #[must_use]
#[allow(clippy::as_conversions, clippy::cast_precision_loss)] #[expect(clippy::as_conversions, clippy::cast_precision_loss)]
pub fn whole_and_frac(d: Duration) -> (Unit, f64) { pub fn whole_and_frac(d: Duration) -> (Unit, f64) {
use Unit::*; use Unit::*;

View File

@@ -270,7 +270,7 @@ pub(crate) fn cache_size(config: &Config, base_size: u32, entity_size: usize) ->
cache_size_f64(config, f64::from(base_size), entity_size) cache_size_f64(config, f64::from(base_size), entity_size)
} }
#[allow( #[expect(
clippy::as_conversions, clippy::as_conversions,
clippy::cast_sign_loss, clippy::cast_sign_loss,
clippy::cast_possible_truncation clippy::cast_possible_truncation

View File

@@ -255,7 +255,7 @@ pub(super) fn configure(server: &Arc<Server>) -> (Vec<usize>, Vec<usize>, Vec<us
(topology, workers, queues) (topology, workers, queues)
} }
#[allow(clippy::as_conversions, clippy::cast_precision_loss)] #[expect(clippy::as_conversions, clippy::cast_precision_loss)]
fn update_stream_width( fn update_stream_width(
server: &Arc<Server>, server: &Arc<Server>,
num_queues: usize, num_queues: usize,

View File

@@ -183,7 +183,6 @@ impl<W: Write> ser::Serializer for &mut Serializer<'_, W> {
unhandled!("serialize Struct Variant not implemented") unhandled!("serialize Struct Variant not implemented")
} }
#[allow(clippy::needless_borrows_for_generic_args)] // buggy
fn serialize_newtype_struct<T>(self, name: &'static str, value: &T) -> Result<Self::Ok> fn serialize_newtype_struct<T>(self, name: &'static str, value: &T) -> Result<Self::Ok>
where where
T: Serialize + ?Sized, T: Serialize + ?Sized,

View File

@@ -1,4 +1,4 @@
#![allow(clippy::needless_borrows_for_generic_args)] #![expect(clippy::needless_borrows_for_generic_args)]
use std::fmt::Debug; use std::fmt::Debug;

View File

@@ -12,7 +12,7 @@ use crate::{
pub(super) fn command(mut item: ItemFn, _args: &[Meta]) -> Result<TokenStream> { pub(super) fn command(mut item: ItemFn, _args: &[Meta]) -> Result<TokenStream> {
let attr: Vec<Attribute> = parse_quote! { let attr: Vec<Attribute> = parse_quote! {
#[tuwunel_macros::implement(crate::Context, params = "<'_>")] #[tuwunel_macros::implement(crate::Context, params = "<'_>")]
#[allow(clippy::unused_async)] #[expect(clippy::unused_async)]
}; };
item.attrs.extend(attr); item.attrs.extend(attr);
@@ -34,13 +34,13 @@ pub(super) fn command_dispatch(item: ItemEnum, args: &[Meta]) -> Result<TokenStr
.try_collect()?; .try_collect()?;
let switch = quote! { let switch = quote! {
#[allow(clippy::large_stack_frames)] //TODO: fixme #[expect(clippy::large_stack_frames)] //TODO: fixme
pub(super) async fn process( pub(super) async fn process(
command: #name, command: #name,
context: &crate::Context<'_> context: &crate::Context<'_>
) -> Result { ) -> Result {
use #name::*; use #name::*;
#[allow(non_snake_case)] #[expect(non_snake_case)]
match command { match command {
#( #arm )* #( #arm )*
} }

View File

@@ -19,7 +19,6 @@ pub(super) fn manifest(item: ItemConst, args: &[Meta]) -> Result<TokenStream> {
Ok(ret.into()) Ok(ret.into())
} }
#[allow(clippy::option_env_unwrap)]
fn manifest_path(member: Option<&str>) -> Result<PathBuf> { fn manifest_path(member: Option<&str>) -> Result<PathBuf> {
let Some(path) = option_env!("CARGO_MANIFEST_DIR") else { let Some(path) = option_env!("CARGO_MANIFEST_DIR") else {
return Err(Error::new( return Err(Error::new(

View File

@@ -17,7 +17,7 @@ const UNDOCUMENTED: &str = "# This item is undocumented. Please contribute docum
const HIDDEN: &[&str] = &["default", "display"]; const HIDDEN: &[&str] = &["default", "display"];
#[allow(clippy::needless_pass_by_value)] #[expect(clippy::needless_pass_by_value)]
pub(super) fn example_generator(input: ItemStruct, args: &[Meta]) -> Result<TokenStream> { pub(super) fn example_generator(input: ItemStruct, args: &[Meta]) -> Result<TokenStream> {
let write = is_cargo_build() && !is_cargo_test(); let write = is_cargo_build() && !is_cargo_test();
let additional = generate_example(&input, args, write)?; let additional = generate_example(&input, args, write)?;

View File

@@ -1,5 +1,3 @@
#![allow(clippy::disallowed_macros)]
mod admin; mod admin;
mod cargo; mod cargo;
mod config; mod config;

View File

@@ -17,7 +17,6 @@ pub(crate) type TracingFlameGuard =
#[cfg(not(feature = "perf_measurements"))] #[cfg(not(feature = "perf_measurements"))]
pub(crate) type TracingFlameGuard = Option<()>; pub(crate) type TracingFlameGuard = Option<()>;
#[allow(clippy::redundant_clone)]
pub(crate) fn init(config: &Config) -> Result<(TracingFlameGuard, Logging)> { pub(crate) fn init(config: &Config) -> Result<(TracingFlameGuard, Logging)> {
let reload_handles = LogLevelReloadHandles::default(); let reload_handles = LogLevelReloadHandles::default();
let cap_state = Arc::new(capture::State::new()); let cap_state = Arc::new(capture::State::new());
@@ -118,10 +117,6 @@ pub(crate) fn init(config: &Config) -> Result<(TracingFlameGuard, Logging)> {
}; };
#[cfg(not(feature = "perf_measurements"))] #[cfg(not(feature = "perf_measurements"))]
#[cfg_attr(
not(feature = "perf_measurements"),
allow(clippy::let_unit_value)
)]
let flame_guard = None; let flame_guard = None;
let subscriber = Arc::new(subscriber); let subscriber = Arc::new(subscriber);

View File

@@ -192,7 +192,7 @@ fn body_limit_layer(server: &Server) -> DefaultBodyLimit {
} }
#[tracing::instrument(name = "panic", level = "error", skip_all)] #[tracing::instrument(name = "panic", level = "error", skip_all)]
#[allow(clippy::needless_pass_by_value)] #[expect(clippy::needless_pass_by_value)]
fn catch_panic( fn catch_panic(
err: Box<dyn Any + Send + 'static>, err: Box<dyn Any + Send + 'static>,
services: Arc<Services>, services: Arc<Services>,

View File

@@ -73,7 +73,6 @@ pub(crate) async fn handle(
skip_all, skip_all,
ret(level = "trace"), ret(level = "trace"),
)] )]
#[allow(unused_variables)]
async fn execute( async fn execute(
// we made a safety contract that Services will not go out of scope // we made a safety contract that Services will not go out of scope
// during the request; this ensures a reference is accounted for at // during the request; this ensures a reference is accounted for at

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -41,7 +41,7 @@ struct Msg {
queue_id: Vec<u8>, queue_id: Vec<u8>,
} }
#[allow(clippy::module_name_repetitions)] #[expect(clippy::module_name_repetitions)]
#[derive(Clone, Debug, PartialEq, Eq, Hash)] #[derive(Clone, Debug, PartialEq, Eq, Hash)]
pub enum SendingEvent { pub enum SendingEvent {
Pdu(RawPduId), // pduid 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>( async fn handle_response_ok<'a>(
&'a self, &'a self,
dest: &Destination, 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)] #[tracing::instrument(name = "request", level = "debug", skip_all)]
async fn handle_request<'a>( async fn handle_request<'a>(
&'a self, &'a self,
@@ -245,7 +245,7 @@ impl Service {
skip_all, skip_all,
fields(futures = %futures.len()), fields(futures = %futures.len()),
)] )]
#[allow(clippy::needless_pass_by_ref_mut)] #[expect(clippy::needless_pass_by_ref_mut)]
async fn startup_netburst<'a>( async fn startup_netburst<'a>(
&'a self, &'a self,
id: usize, id: usize,

View File

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

View File

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