diff --git a/Cargo.toml b/Cargo.toml index 28a52c3c..c6eaf140 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -938,7 +938,6 @@ perf = { level = "warn", priority = -1 } ################### #restriction = "warn" -#allow_attributes = "warn" # UNSTABLE arithmetic_side_effects = "warn" as_conversions = "warn" as_underscore = "warn" diff --git a/src/admin/debug/mod.rs b/src/admin/debug/mod.rs index 4db0acf9..5f5413f8 100644 --- a/src/admin/debug/mod.rs +++ b/src/admin/debug/mod.rs @@ -252,7 +252,6 @@ pub(super) enum DebugCommand { /// - Developer test stubs #[command(subcommand)] - #[allow(non_snake_case)] #[clap(hide(true))] Tester(TesterCommand), } diff --git a/src/admin/debug/tester.rs b/src/admin/debug/tester.rs index ffc9fc7b..164ef4ea 100644 --- a/src/admin/debug/tester.rs +++ b/src/admin/debug/tester.rs @@ -46,7 +46,7 @@ async fn timer(&self) -> Result { #[inline(never)] #[rustfmt::skip] -#[allow(unused_variables)] +#[expect(unused_variables)] fn timed(body: &[&str]) { } diff --git a/src/admin/media/mod.rs b/src/admin/media/mod.rs index 06c9a091..a7292abd 100644 --- a/src/admin/media/mod.rs +++ b/src/admin/media/mod.rs @@ -1,4 +1,4 @@ -#![allow(rustdoc::broken_intra_doc_links)] +#![expect(rustdoc::broken_intra_doc_links)] mod commands; use clap::Subcommand; diff --git a/src/admin/mod.rs b/src/admin/mod.rs index 4e0eeaf4..a2e592d3 100644 --- a/src/admin/mod.rs +++ b/src/admin/mod.rs @@ -1,6 +1,5 @@ -#![allow(clippy::wildcard_imports)] -#![allow(clippy::enum_glob_use)] -#![allow(clippy::too_many_arguments)] +#![expect(clippy::enum_glob_use)] +#![expect(clippy::too_many_arguments)] pub(crate) mod admin; pub(crate) mod context; diff --git a/src/admin/processor.rs b/src/admin/processor.rs index 4099d193..97478472 100644 --- a/src/admin/processor.rs +++ b/src/admin/processor.rs @@ -173,7 +173,7 @@ fn capture_create(context: &Context<'_>) -> (Arc, Arc>) { } /// Parse chat messages from the admin room into an AdminCommand object -#[allow(clippy::result_large_err)] +#[expect(clippy::result_large_err)] fn parse<'a>( services: &Arc, input: &'a CommandInput, diff --git a/src/admin/query/raw.rs b/src/admin/query/raw.rs index e9fddc33..38a6bbbe 100644 --- a/src/admin/query/raw.rs +++ b/src/admin/query/raw.rs @@ -18,7 +18,6 @@ use crate::{admin_command, admin_command_dispatch}; #[admin_command_dispatch(handler_prefix = "raw")] #[derive(Debug, Subcommand)] -#[allow(clippy::enum_variant_names)] /// Query tables from database pub(crate) enum RawCommand { /// - List database maps diff --git a/src/admin/utils.rs b/src/admin/utils.rs index 1802aa00..cdde11b6 100644 --- a/src/admin/utils.rs +++ b/src/admin/utils.rs @@ -1,4 +1,4 @@ -#![allow(dead_code)] +#![expect(dead_code)] use ruma::{OwnedRoomId, OwnedUserId, RoomId, UserId}; use tuwunel_core::{Err, Result, err}; diff --git a/src/api/client/media_legacy.rs b/src/api/client/media_legacy.rs index 931a8606..96e8d1d9 100644 --- a/src/api/client/media_legacy.rs +++ b/src/api/client/media_legacy.rs @@ -1,4 +1,4 @@ -#![allow(deprecated)] +#![expect(deprecated)] use axum::extract::State; use axum_client_ip::InsecureClientIp; diff --git a/src/api/client/push.rs b/src/api/client/push.rs index 2fb6495a..86bfa8be 100644 --- a/src/api/client/push.rs +++ b/src/api/client/push.rs @@ -157,7 +157,7 @@ pub(crate) async fn get_pushrules_all_route( // remove old deprecated mentions push rules as per MSC4210 // and update the stored server default push rules - #[allow(deprecated)] + #[expect(deprecated)] { use ruma::push::RuleKind::*; if global_ruleset @@ -245,7 +245,7 @@ pub(crate) async fn get_pushrules_global_route( // remove old deprecated mentions push rules as per MSC4210 // and update the stored server default push rules - #[allow(deprecated)] + #[expect(deprecated)] { use ruma::push::RuleKind::*; if global_ruleset @@ -303,7 +303,7 @@ pub(crate) async fn get_pushrule_route( .expect("user is authenticated"); // remove old deprecated mentions push rules as per MSC4210 - #[allow(deprecated)] + #[expect(deprecated)] 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::RoomNotif.as_str() @@ -396,7 +396,7 @@ pub(crate) async fn get_pushrule_actions_route( let sender_user = body.sender_user(); // remove old deprecated mentions push rules as per MSC4210 - #[allow(deprecated)] + #[expect(deprecated)] 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::RoomNotif.as_str() @@ -463,7 +463,7 @@ pub(crate) async fn get_pushrule_enabled_route( let sender_user = body.sender_user(); // remove old deprecated mentions push rules as per MSC4210 - #[allow(deprecated)] + #[expect(deprecated)] 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::RoomNotif.as_str() diff --git a/src/api/client/register.rs b/src/api/client/register.rs index 330edc38..28c96be5 100644 --- a/src/api/client/register.rs +++ b/src/api/client/register.rs @@ -127,7 +127,7 @@ pub(crate) async fn get_register_available_route( /// - Creates a new account and populates it with default account data /// - If `inhibit_login` is false: Creates a device and returns device id and /// access_token -#[allow(clippy::doc_markdown)] +#[expect(clippy::doc_markdown)] #[tracing::instrument(skip_all, fields(%client), name = "register")] pub(crate) async fn register_route( State(services): State, diff --git a/src/api/client/relations.rs b/src/api/client/relations.rs index a5a5286d..feb8ed63 100644 --- a/src/api/client/relations.rs +++ b/src/api/client/relations.rs @@ -108,7 +108,7 @@ pub(crate) async fn get_relating_events_route( .await } -#[allow(clippy::too_many_arguments)] +#[expect(clippy::too_many_arguments)] #[tracing::instrument( name = "relations", level = "debug", diff --git a/src/api/client/room/create.rs b/src/api/client/room/create.rs index 3f59f848..e8afb336 100644 --- a/src/api/client/room/create.rs +++ b/src/api/client/room/create.rs @@ -55,7 +55,6 @@ use crate::{Ruma, client::utils::invite_check}; /// - Send events listed in initial state /// - Send events implied by `name` and `topic` /// - Send invite events -#[allow(clippy::large_stack_frames)] pub(crate) async fn create_room_route( State(services): State, body: Ruma, diff --git a/src/api/client/search.rs b/src/api/client/search.rs index 63340691..a6f47714 100644 --- a/src/api/client/search.rs +++ b/src/api/client/search.rs @@ -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( services: &Services, sender_user: &UserId, diff --git a/src/api/client/session/appservice.rs b/src/api/client/session/appservice.rs index d2ccaf83..7224e822 100644 --- a/src/api/client/session/appservice.rs +++ b/src/api/client/session/appservice.rs @@ -15,7 +15,7 @@ pub(super) fn handle_login( body: &Ruma, info: &ApplicationService, ) -> Result { - #[allow(deprecated)] + #[expect(deprecated)] let ApplicationService { identifier, user } = info; let Some(ref info) = body.appservice_info else { diff --git a/src/api/client/session/mod.rs b/src/api/client/session/mod.rs index 02eb8cfb..b834f1c6 100644 --- a/src/api/client/session/mod.rs +++ b/src/api/client/session/mod.rs @@ -177,7 +177,7 @@ pub(crate) async fn login_route( .map(HomeserverInfo::new) .map(DiscoveryInfo::new); - #[allow(deprecated)] + #[expect(deprecated)] Ok(login::v3::Response { user_id, access_token, diff --git a/src/api/client/session/password.rs b/src/api/client/session/password.rs index 5264daf4..7931c77d 100644 --- a/src/api/client/session/password.rs +++ b/src/api/client/session/password.rs @@ -17,7 +17,7 @@ pub(super) async fn handle_login( body: &Ruma, info: &Password, ) -> Result { - #[allow(deprecated)] + #[expect(deprecated)] let Password { identifier, password, user, .. } = info; let user_id = if let Some(uiaa::UserIdentifier::UserIdOrLocalpart(user_id)) = identifier { diff --git a/src/api/client/sync/v3.rs b/src/api/client/sync/v3.rs index 157fb8cd..e8c96d40 100644 --- a/src/api/client/sync/v3.rs +++ b/src/api/client/sync/v3.rs @@ -525,7 +525,6 @@ async fn process_presence_updates( full = %full_state, ), )] -#[allow(clippy::too_many_arguments)] async fn handle_left_room( services: &Services, since: u64, @@ -744,7 +743,7 @@ async fn load_left_room( room_id = ?room_id, ), )] -#[allow(clippy::too_many_arguments)] +#[expect(clippy::too_many_arguments)] async fn load_joined_room( services: &Services, sender_user: &UserId, @@ -1163,7 +1162,7 @@ async fn load_joined_room( cs = %current_shortstatehash, ) )] -#[allow(clippy::too_many_arguments)] +#[expect(clippy::too_many_arguments)] async fn calculate_state_changes<'a>( services: &Services, sender_user: &UserId, diff --git a/src/api/client/sync/v5/filter.rs b/src/api/client/sync/v5/filter.rs index 2e7bf36e..73746e08 100644 --- a/src/api/client/sync/v5/filter.rs +++ b/src/api/client/sync/v5/filter.rs @@ -21,7 +21,7 @@ pub(super) async fn filter_room( room_id: &RoomId, membership: Option<&MembershipState>, ) -> bool { - #[allow(clippy::match_same_arms)] // helps readability + #[expect(clippy::match_same_arms)] // helps readability let match_invite = filter .is_invite .map_async(async |is_invite| match (membership, is_invite) { diff --git a/src/api/client/sync/v5/rooms.rs b/src/api/client/sync/v5/rooms.rs index 6369a4ca..9f9065a0 100644 --- a/src/api/client/sync/v5/rooms.rs +++ b/src/api/client/sync/v5/rooms.rs @@ -73,7 +73,6 @@ pub(super) async fn handle( skip_all, fields(room_id, roomsince) )] -#[allow(clippy::too_many_arguments)] async fn handle_room( SyncInfo { services, sender_user, .. }: SyncInfo<'_>, conn: &Connection, @@ -360,7 +359,6 @@ async fn handle_room( } #[tracing::instrument(name = "heroes", level = "trace", skip_all)] -#[allow(clippy::type_complexity)] async fn calculate_heroes( services: &Services, sender_user: &UserId, diff --git a/src/api/mod.rs b/src/api/mod.rs index 4ee50b4e..8ef23717 100644 --- a/src/api/mod.rs +++ b/src/api/mod.rs @@ -1,5 +1,5 @@ #![type_length_limit = "262144"] //TODO: REDUCE ME -#![allow(clippy::toplevel_ref_arg)] +#![expect(clippy::toplevel_ref_arg)] pub mod client; pub mod router; diff --git a/src/api/router/args.rs b/src/api/router/args.rs index f5f7b052..ea4cbc8c 100644 --- a/src/api/router/args.rs +++ b/src/api/router/args.rs @@ -153,7 +153,7 @@ fn into_http_request(request: &Request, body: Bytes) -> hyper::Request { .expect("http request body") } -#[allow(clippy::needless_pass_by_value)] +#[expect(clippy::needless_pass_by_value)] fn take_body( services: &Services, request: &mut Request, diff --git a/src/api/router/handler.rs b/src/api/router/handler.rs index b6acee8b..18fdeb26 100644 --- a/src/api/router/handler.rs +++ b/src/api/router/handler.rs @@ -35,6 +35,7 @@ impl RouterExt for Router { macro_rules! ruma_handler { ( $($tx:ident),* $(,)? ) => { + #[allow(clippy::allow_attributes)] #[allow(non_snake_case)] impl RumaHandler<($($tx,)* Ruma,)> for Fun where diff --git a/src/api/server/send_join.rs b/src/api/server/send_join.rs index 517534c1..7e34dd1a 100644 --- a/src/api/server/send_join.rs +++ b/src/api/server/send_join.rs @@ -1,4 +1,4 @@ -#![allow(deprecated)] +#![expect(deprecated)] use std::borrow::Borrow; diff --git a/src/api/server/send_leave.rs b/src/api/server/send_leave.rs index ca0dbc67..5812230f 100644 --- a/src/api/server/send_leave.rs +++ b/src/api/server/send_leave.rs @@ -1,4 +1,4 @@ -#![allow(deprecated)] +#![expect(deprecated)] use axum::extract::State; use futures::FutureExt; diff --git a/src/core/benches/state_res.rs b/src/core/benches/state_res.rs index f94a57a4..0a9bcbca 100644 --- a/src/core/benches/state_res.rs +++ b/src/core/benches/state_res.rs @@ -197,7 +197,7 @@ fn resolve_deeper_event_set(c: &mut Criterion) { /////////////////////////////////////////////////////////////////////*/ struct TestStore(HashMap); -#[allow(unused)] +#[expect(unused)] impl TestStore { fn get_event(&self, room_id: &RoomId, event_id: &EventId) -> Result { self.0 @@ -278,7 +278,7 @@ impl TestStore { } impl TestStore { - #[allow(clippy::type_complexity)] + #[expect(clippy::type_complexity)] fn set_up( &mut self, ) -> (StateMap, StateMap, StateMap) { @@ -463,7 +463,7 @@ where } // all graphs start with these input events -#[allow(non_snake_case)] +#[expect(non_snake_case)] fn INITIAL_EVENTS() -> HashMap { vec![ to_pdu_event::<&EventId>( @@ -545,7 +545,7 @@ fn INITIAL_EVENTS() -> HashMap { } // all graphs start with these input events -#[allow(non_snake_case)] +#[expect(non_snake_case)] fn BAN_STATE_SET() -> HashMap { vec![ to_pdu_event( diff --git a/src/core/config/check.rs b/src/core/config/check.rs index c9df4f8e..0866c40f 100644 --- a/src/core/config/check.rs +++ b/src/core/config/check.rs @@ -22,7 +22,6 @@ pub fn reload(old: &Config, new: &Config) -> Result { Ok(()) } -#[allow(clippy::cognitive_complexity)] pub fn check(config: &Config) -> Result { if cfg!(debug_assertions) { warn!("Note: tuwunel was built without optimisations (i.e. debug build)"); diff --git a/src/core/config/manager.rs b/src/core/config/manager.rs index 395475ac..2e367545 100644 --- a/src/core/config/manager.rs +++ b/src/core/config/manager.rs @@ -107,7 +107,7 @@ fn load(&self, handle: &mut [Option>]) -> &'static Arc { skip_all, fields(%index, ?config) )] -#[allow(clippy::transmute_ptr_to_ptr)] +#[expect(clippy::transmute_ptr_to_ptr)] fn load_miss( handle: &mut [Option>], index: usize, diff --git a/src/core/config/mod.rs b/src/core/config/mod.rs index b1205d48..c21efe22 100644 --- a/src/core/config/mod.rs +++ b/src/core/config/mod.rs @@ -33,8 +33,8 @@ use crate::{ }; /// All the config options for tuwunel. -#[allow(clippy::struct_excessive_bools)] -#[allow(rustdoc::broken_intra_doc_links, rustdoc::bare_urls)] +#[expect(clippy::struct_excessive_bools)] +#[expect(rustdoc::broken_intra_doc_links, rustdoc::bare_urls)] #[derive(Clone, Debug, Deserialize)] #[config_example_generator( filename = "tuwunel-example.toml", @@ -97,7 +97,7 @@ pub struct Config { #[serde(default = "default_new_user_displayname_suffix")] 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. /// /// If you are using Docker or a container NAT networking setup, this must @@ -821,7 +821,7 @@ pub struct Config { #[serde(default)] 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 /// (notary trusted key servers). /// @@ -1007,7 +1007,7 @@ pub struct Config { #[serde(default)] pub turn_password: String, - #[allow(clippy::doc_link_with_quotes)] + #[expect(clippy::doc_link_with_quotes)] /// Vector list of TURN URIs/servers to use. /// /// Replace "example.turn.uri" with your TURN domain, such as the coturn @@ -1045,7 +1045,7 @@ pub struct Config { #[serde(default = "default_turn_ttl")] 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 /// registered users join. The rooms specified must be rooms that you have /// joined at least once on the server, and must be public. @@ -1624,7 +1624,7 @@ pub struct Config { #[serde(default, with = "serde_regex")] 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 /// do not want tuwunel to send outbound requests to. Defaults to /// RFC1918, unroutable, loopback, multicast, and testnet addresses for @@ -1842,7 +1842,7 @@ pub struct Config { #[serde(default)] 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. /// /// This option can also be configured with the `--execute` tuwunel @@ -2229,7 +2229,7 @@ pub struct Config { pub identity_provider: HashSet, #[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 catchall: BTreeMap, } @@ -2252,7 +2252,7 @@ pub struct TlsConfig { 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)] #[config_example_generator( filename = "tuwunel-example.toml", @@ -2317,7 +2317,7 @@ pub struct WellKnownConfig { } #[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( filename = "tuwunel-example.toml", section = "global.blurhashing" @@ -3129,13 +3129,13 @@ fn default_rocksdb_compression_algo() -> String { /// Default RocksDB compression level is 32767, which is internally read by /// RocksDB as the default magic number and translated to the library's default /// compression level as they all differ. See their `kDefaultCompressionLevel`. -#[allow(clippy::doc_markdown)] +#[expect(clippy::doc_markdown)] fn default_rocksdb_compression_level() -> i32 { 32767 } /// Default RocksDB compression level is 32767, which is internally read by /// RocksDB as the default magic number and translated to the library's default /// 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_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() } -#[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_u32(val: u32) -> u32 { diff --git a/src/core/config/proxy.rs b/src/core/config/proxy.rs index b773207c..96652863 100644 --- a/src/core/config/proxy.rs +++ b/src/core/config/proxy.rs @@ -127,7 +127,7 @@ impl WildCardedDomain { impl std::str::FromStr for WildCardedDomain { type Err = std::convert::Infallible; - #[allow(clippy::string_slice)] + #[expect(clippy::string_slice)] fn from_str(s: &str) -> Result { // maybe do some domain validation? Ok(if s.starts_with("*.") { diff --git a/src/core/debug.rs b/src/core/debug.rs index 976781cf..ebe823ba 100644 --- a/src/core/debug.rs +++ b/src/core/debug.rs @@ -1,5 +1,3 @@ -#![allow(clippy::disallowed_macros)] - use std::{any::Any, env, panic, sync::LazyLock}; use tracing::Level; @@ -73,7 +71,6 @@ fn set_panic_trap() { #[cold] #[inline(never)] -#[allow(deprecated_in_future)] pub fn panic_handler(info: &panic::PanicHookInfo<'_>, next: &dyn Fn(&panic::PanicHookInfo<'_>)) { trap(); next(info); diff --git a/src/core/error/mod.rs b/src/core/error/mod.rs index fd97e00f..4314cab9 100644 --- a/src/core/error/mod.rs +++ b/src/core/error/mod.rs @@ -239,7 +239,7 @@ impl From> for Error { fn from(e: PoisonError) -> Self { Self::Poison(e.to_string().into()) } } -#[allow(clippy::fallible_impl_from)] +#[expect(clippy::fallible_impl_from)] impl From for Error { #[cold] #[inline(never)] @@ -257,5 +257,5 @@ pub fn infallible(_e: &Infallible) { /// Convenience functor for fundamental Error::sanitized_message(); see member. #[inline] #[must_use] -#[allow(clippy::needless_pass_by_value)] +#[expect(clippy::needless_pass_by_value)] pub fn sanitized_message(e: Error) -> String { e.sanitized_message() } diff --git a/src/core/log/mod.rs b/src/core/log/mod.rs index e406d8d3..75aefe5e 100644 --- a/src/core/log/mod.rs +++ b/src/core/log/mod.rs @@ -1,5 +1,3 @@ -#![allow(clippy::disallowed_macros)] - pub mod capture; pub mod color; pub mod console; diff --git a/src/core/matrix/pdu/count.rs b/src/core/matrix/pdu/count.rs index fb64d267..b40d614a 100644 --- a/src/core/matrix/pdu/count.rs +++ b/src/core/matrix/pdu/count.rs @@ -1,4 +1,4 @@ -#![allow( +#![expect( clippy::cast_possible_wrap, clippy::cast_sign_loss, clippy::as_conversions diff --git a/src/core/matrix/state_res/events/create.rs b/src/core/matrix/state_res/events/create.rs index 6791ac97..c09340b7 100644 --- a/src/core/matrix/state_res/events/create.rs +++ b/src/core/matrix/state_res/events/create.rs @@ -22,11 +22,9 @@ impl RoomCreateEvent { pub fn new(event: E) -> Self { Self(event) } /// The version of the room. - #[allow(dead_code)] pub fn room_version(&self) -> Result { #[derive(Deserialize)] struct RoomCreateContentRoomVersion { - #[allow(dead_code)] room_version: Option, } diff --git a/src/core/matrix/state_res/resolve/mainline_sort.rs b/src/core/matrix/state_res/resolve/mainline_sort.rs index 5372ec91..03561700 100644 --- a/src/core/matrix/state_res/resolve/mainline_sort.rs +++ b/src/core/matrix/state_res/resolve/mainline_sort.rs @@ -146,7 +146,7 @@ where Ok(0) } -#[allow(clippy::redundant_closure)] +#[expect(clippy::redundant_closure)] #[tracing::instrument(level = "trace", skip_all)] async fn get_power_levels_auth_event( event: &Pdu, diff --git a/src/core/matrix/state_res/resolve/tests.rs b/src/core/matrix/state_res/resolve/tests.rs index 794a6ce7..58fedb1e 100644 --- a/src/core/matrix/state_res/resolve/tests.rs +++ b/src/core/matrix/state_res/resolve/tests.rs @@ -652,7 +652,7 @@ async fn join_rule_with_auth_chain() { do_check(&join_rule.values().cloned().collect::>(), edges, expected_state_ids).await; } -#[allow(non_snake_case)] +#[expect(non_snake_case)] fn BAN_STATE_SET() -> HashMap { vec![ to_pdu_event( @@ -697,7 +697,7 @@ fn BAN_STATE_SET() -> HashMap { .collect() } -#[allow(non_snake_case)] +#[expect(non_snake_case)] fn JOIN_RULE() -> HashMap { vec![ to_pdu_event( @@ -726,7 +726,7 @@ fn JOIN_RULE() -> HashMap { macro_rules! state_set { ($($kind:expr => $key:expr => $id:expr),* $(,)?) => {{ - #[allow(unused_mut)] + #[expect(unused_mut)] let mut x = StateMap::new(); $( x.insert(($kind, $key.into()), $id); diff --git a/src/core/matrix/state_res/resolve/topological_sort.rs b/src/core/matrix/state_res/resolve/topological_sort.rs index 1599e060..eaf747de 100644 --- a/src/core/matrix/state_res/resolve/topological_sort.rs +++ b/src/core/matrix/state_res/resolve/topological_sort.rs @@ -75,7 +75,7 @@ impl PartialOrd for TieBreaker<'_> { graph = graph.len(), ) )] -#[allow(clippy::implicit_hasher)] +#[expect(clippy::implicit_hasher)] pub async fn topological_sort( graph: &HashMap>, query: &Query, diff --git a/src/core/matrix/state_res/test_utils.rs b/src/core/matrix/state_res/test_utils.rs index b9a4697d..0f96cf80 100644 --- a/src/core/matrix/state_res/test_utils.rs +++ b/src/core/matrix/state_res/test_utils.rs @@ -248,7 +248,7 @@ pub(super) async fn do_check( assert_eq!(expected_state, end_state); } -#[allow(clippy::exhaustive_structs)] +#[expect(clippy::exhaustive_structs)] pub(super) struct TestStore(pub(super) HashMap); impl TestStore { @@ -286,7 +286,7 @@ impl TestStore { } // A StateStore implementation for testing -#[allow(clippy::type_complexity)] +#[expect(clippy::type_complexity)] impl TestStore { pub(super) fn set_up( &mut self, @@ -646,7 +646,7 @@ pub(super) fn room_create_hydra_pdu_event( } // all graphs start with these input events -#[allow(non_snake_case)] +#[expect(non_snake_case)] pub(super) fn INITIAL_EVENTS() -> HashMap { vec![ to_pdu_event::<&EventId>( @@ -729,7 +729,7 @@ pub(super) fn INITIAL_EVENTS() -> HashMap { /// Batch of initial events to use for incoming events from room version /// `org.matrix.hydra.11` onwards. -#[allow(non_snake_case)] +#[expect(non_snake_case)] pub(super) fn INITIAL_HYDRA_EVENTS() -> HashMap { vec![ room_create_hydra_pdu_event( @@ -807,7 +807,7 @@ pub(super) fn INITIAL_HYDRA_EVENTS() -> HashMap { } // all graphs start with these input events -#[allow(non_snake_case)] +#[expect(non_snake_case)] pub(super) fn INITIAL_EVENTS_CREATE_ROOM() -> HashMap { vec![to_pdu_event::<&EventId>( "CREATE", @@ -823,7 +823,7 @@ pub(super) fn INITIAL_EVENTS_CREATE_ROOM() -> HashMap { .collect() } -#[allow(non_snake_case)] +#[expect(non_snake_case)] pub(super) fn INITIAL_EDGES() -> Vec { vec!["START", "IMC", "IMB", "IJR", "IPOWER", "IMA", "CREATE"] .into_iter() diff --git a/src/core/mods/canary.rs b/src/core/mods/canary.rs index 6095608c..f4f3760c 100644 --- a/src/core/mods/canary.rs +++ b/src/core/mods/canary.rs @@ -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 /// place. A call to prepare() must be made prior to Module::unload() and making /// this call. -#[allow(dead_code)] +#[expect(dead_code)] pub(crate) fn check() -> bool { STATIC_DTORS.load(ORDERING) == 0 } diff --git a/src/core/utils/bool.rs b/src/core/utils/bool.rs index 4943ef25..f5094a29 100644 --- a/src/core/utils/bool.rs +++ b/src/core/utils/bool.rs @@ -28,7 +28,7 @@ pub trait BoolExt { fn into_option(self) -> Option<()>; - #[allow(clippy::result_unit_err)] + #[expect(clippy::result_unit_err)] fn into_result(self) -> Result<(), ()>; #[must_use] diff --git a/src/core/utils/debug.rs b/src/core/utils/debug.rs index 7ecd1374..f61982c1 100644 --- a/src/core/utils/debug.rs +++ b/src/core/utils/debug.rs @@ -60,7 +60,7 @@ impl fmt::Debug for TruncatedSlice<'_, T> { } impl fmt::Debug for TruncatedStr<'_> { - #[allow(clippy::string_slice)] + #[expect(clippy::string_slice)] fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { if self.inner.len() <= self.max_len { write!(f, "{:?}", self.inner) diff --git a/src/core/utils/future/bool_ext.rs b/src/core/utils/future/bool_ext.rs index 3bae174f..2dd66815 100644 --- a/src/core/utils/future/bool_ext.rs +++ b/src/core/utils/future/bool_ext.rs @@ -1,5 +1,5 @@ //! 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; diff --git a/src/core/utils/future/option_ext.rs b/src/core/utils/future/option_ext.rs index d20986ed..2e6da123 100644 --- a/src/core/utils/future/option_ext.rs +++ b/src/core/utils/future/option_ext.rs @@ -1,4 +1,4 @@ -#![allow(clippy::wrong_self_convention)] +#![expect(clippy::wrong_self_convention)] use futures::{Future, FutureExt, future::OptionFuture}; diff --git a/src/core/utils/future/ready_bool_ext.rs b/src/core/utils/future/ready_bool_ext.rs index 251a5c9a..d983fd3a 100644 --- a/src/core/utils/future/ready_bool_ext.rs +++ b/src/core/utils/future/ready_bool_ext.rs @@ -1,4 +1,4 @@ -#![allow(clippy::wrong_self_convention)] +#![expect(clippy::wrong_self_convention)] use futures::Future; diff --git a/src/core/utils/future/try_ext_ext.rs b/src/core/utils/future/try_ext_ext.rs index b2114e56..2aef9b18 100644 --- a/src/core/utils/future/try_ext_ext.rs +++ b/src/core/utils/future/try_ext_ext.rs @@ -1,8 +1,8 @@ //! 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 // 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; @@ -22,7 +22,7 @@ where where Self: Sized; - #[allow(clippy::wrong_self_convention)] + #[expect(clippy::wrong_self_convention)] fn is_ok( self, ) -> MapOkOrElse bool, impl FnOnce(Self::Error) -> bool> diff --git a/src/core/utils/math.rs b/src/core/utils/math.rs index 0b8f4633..0ae07777 100644 --- a/src/core/utils/math.rs +++ b/src/core/utils/math.rs @@ -42,7 +42,7 @@ macro_rules! expected { #[collapse_debuginfo(yes)] macro_rules! validated { ($($input:tt)+) => { - //#[allow(clippy::arithmetic_side_effects)] { + //#[expect(clippy::arithmetic_side_effects)] { //Some($($input)*) // .ok_or_else(|| $crate::err!(Arithmetic("this error should never been seen"))) //} @@ -62,7 +62,6 @@ macro_rules! validated { } #[inline] -#[allow(clippy::as_conversions)] pub fn usize_from_f64(val: f64) -> Result { if val < 0.0 { return Err!(Arithmetic("Converting negative float to unsigned integer")); @@ -92,7 +91,7 @@ pub fn ruma_from_usize(val: usize) -> ruma::UInt { #[inline] #[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 } #[inline] diff --git a/src/core/utils/result/is_err_or.rs b/src/core/utils/result/is_err_or.rs index 1d0e143c..c0929225 100644 --- a/src/core/utils/result/is_err_or.rs +++ b/src/core/utils/result/is_err_or.rs @@ -1,4 +1,4 @@ -#![allow(clippy::wrong_self_convention)] +#![expect(clippy::wrong_self_convention)] use super::Result; diff --git a/src/core/utils/stream/ready.rs b/src/core/utils/stream/ready.rs index 5baa094e..0a2b6056 100644 --- a/src/core/utils/stream/ready.rs +++ b/src/core/utils/stream/ready.rs @@ -1,5 +1,5 @@ //! Synchronous combinator extensions to futures::Stream -#![allow(clippy::type_complexity)] +#![expect(clippy::type_complexity)] use futures::{ future::{FutureExt, Ready, ready}, @@ -198,7 +198,7 @@ where } #[inline] - #[allow(clippy::unit_arg)] + #[expect(clippy::unit_arg)] fn ready_for_each( self, mut f: F, diff --git a/src/core/utils/stream/try_ready.rs b/src/core/utils/stream/try_ready.rs index 53183ec8..39849fe5 100644 --- a/src/core/utils/stream/try_ready.rs +++ b/src/core/utils/stream/try_ready.rs @@ -1,5 +1,5 @@ //! Synchronous combinator extensions to futures::TryStream -#![allow(clippy::type_complexity)] +#![expect(clippy::type_complexity)] use futures::{ future::{Ready, ready}, diff --git a/src/core/utils/stream/try_tools.rs b/src/core/utils/stream/try_tools.rs index 417806fc..9888d792 100644 --- a/src/core/utils/stream/try_tools.rs +++ b/src/core/utils/stream/try_tools.rs @@ -1,5 +1,5 @@ //! TryStreamTools for futures::TryStream -#![allow(clippy::type_complexity)] +#![expect(clippy::type_complexity)] use futures::{TryStream, TryStreamExt, future, future::Ready, stream::TryTakeWhile}; diff --git a/src/core/utils/string.rs b/src/core/utils/string.rs index d35ced66..680e70a1 100644 --- a/src/core/utils/string.rs +++ b/src/core/utils/string.rs @@ -65,7 +65,7 @@ pub fn camel_to_snake_string(s: &str) -> String { } #[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(output: &mut O, input: I) -> Result where I: std::io::Read, @@ -95,7 +95,7 @@ where /// common_prefix(&input) == "con"; /// ``` #[must_use] -#[allow(clippy::string_slice)] +#[expect(clippy::string_slice)] pub fn common_prefix>(choice: &[T]) -> &str { choice.first().map_or(EMPTY, move |best| { choice @@ -114,7 +114,7 @@ pub fn common_prefix>(choice: &[T]) -> &str { #[inline] #[must_use] -#[allow(clippy::arithmetic_side_effects)] +#[expect(clippy::arithmetic_side_effects)] pub fn truncate_deterministic(str: &str, range: Option>) -> &str { let range = range.unwrap_or(0..str.len()); let len = str diff --git a/src/core/utils/string/unquoted.rs b/src/core/utils/string/unquoted.rs index 88fa011f..5b902f2d 100644 --- a/src/core/utils/string/unquoted.rs +++ b/src/core/utils/string/unquoted.rs @@ -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 // by wrapping in a tuple-struct. - #[allow(clippy::transmute_ptr_to_ptr)] + #[expect(clippy::transmute_ptr_to_ptr)] unsafe { std::mem::transmute(s) } diff --git a/src/core/utils/sys/storage.rs b/src/core/utils/sys/storage.rs index 36b57e60..7aa938ca 100644 --- a/src/core/utils/sys/storage.rs +++ b/src/core/utils/sys/storage.rs @@ -179,7 +179,7 @@ pub fn name_from_path(path: &Path) -> Result { } /// Get the (major, minor) of the block device on which Path is mounted. -#[allow( +#[expect( clippy::useless_conversion, clippy::unnecessary_fallible_conversions )] diff --git a/src/core/utils/tests.rs b/src/core/utils/tests.rs index 8858feff..4479d08b 100644 --- a/src/core/utils/tests.rs +++ b/src/core/utils/tests.rs @@ -1,4 +1,4 @@ -#![allow(clippy::disallowed_methods)] +#![expect(clippy::disallowed_methods)] use crate::utils; @@ -109,7 +109,7 @@ async fn mutex_map_contend() { } #[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() { use utils::set::intersection; @@ -139,7 +139,7 @@ fn set_intersection_none() { } #[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() { use utils::set::intersection; @@ -167,7 +167,7 @@ fn set_intersection_all() { } #[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() { use utils::set::intersection; @@ -189,7 +189,7 @@ fn set_intersection_some() { } #[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() { use utils::set::intersection_sorted; @@ -211,7 +211,7 @@ fn set_intersection_sorted_some() { } #[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() { use utils::set::intersection_sorted; diff --git a/src/core/utils/time.rs b/src/core/utils/time.rs index 099513dc..dd9844c2 100644 --- a/src/core/utils/time.rs +++ b/src/core/utils/time.rs @@ -6,7 +6,7 @@ use crate::{Result, err}; #[inline] #[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 } #[inline] @@ -87,7 +87,7 @@ pub fn format(ts: SystemTime, str: &str) -> String { } #[must_use] -#[allow( +#[expect( clippy::as_conversions, clippy::cast_possible_truncation, 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 /// rational remainder left over. #[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) { use Unit::*; diff --git a/src/database/engine/cf_opts.rs b/src/database/engine/cf_opts.rs index b997e912..416d5e28 100644 --- a/src/database/engine/cf_opts.rs +++ b/src/database/engine/cf_opts.rs @@ -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) } -#[allow( +#[expect( clippy::as_conversions, clippy::cast_sign_loss, clippy::cast_possible_truncation diff --git a/src/database/pool/configure.rs b/src/database/pool/configure.rs index b47f618b..fb7b0d4e 100644 --- a/src/database/pool/configure.rs +++ b/src/database/pool/configure.rs @@ -255,7 +255,7 @@ pub(super) fn configure(server: &Arc) -> (Vec, Vec, Vec, num_queues: usize, diff --git a/src/database/ser.rs b/src/database/ser.rs index 98abf578..b3d801d8 100644 --- a/src/database/ser.rs +++ b/src/database/ser.rs @@ -183,7 +183,6 @@ impl ser::Serializer for &mut Serializer<'_, W> { unhandled!("serialize Struct Variant not implemented") } - #[allow(clippy::needless_borrows_for_generic_args)] // buggy fn serialize_newtype_struct(self, name: &'static str, value: &T) -> Result where T: Serialize + ?Sized, diff --git a/src/database/tests.rs b/src/database/tests.rs index df56b84e..b289aeab 100644 --- a/src/database/tests.rs +++ b/src/database/tests.rs @@ -1,4 +1,4 @@ -#![allow(clippy::needless_borrows_for_generic_args)] +#![expect(clippy::needless_borrows_for_generic_args)] use std::fmt::Debug; diff --git a/src/macros/admin.rs b/src/macros/admin.rs index c8c55c60..4e84996d 100644 --- a/src/macros/admin.rs +++ b/src/macros/admin.rs @@ -12,7 +12,7 @@ use crate::{ pub(super) fn command(mut item: ItemFn, _args: &[Meta]) -> Result { let attr: Vec = parse_quote! { #[tuwunel_macros::implement(crate::Context, params = "<'_>")] - #[allow(clippy::unused_async)] + #[expect(clippy::unused_async)] }; item.attrs.extend(attr); @@ -34,13 +34,13 @@ pub(super) fn command_dispatch(item: ItemEnum, args: &[Meta]) -> Result ) -> Result { use #name::*; - #[allow(non_snake_case)] + #[expect(non_snake_case)] match command { #( #arm )* } diff --git a/src/macros/cargo.rs b/src/macros/cargo.rs index 64b08bd8..c2a2a5a4 100644 --- a/src/macros/cargo.rs +++ b/src/macros/cargo.rs @@ -19,7 +19,6 @@ pub(super) fn manifest(item: ItemConst, args: &[Meta]) -> Result { Ok(ret.into()) } -#[allow(clippy::option_env_unwrap)] fn manifest_path(member: Option<&str>) -> Result { let Some(path) = option_env!("CARGO_MANIFEST_DIR") else { return Err(Error::new( diff --git a/src/macros/config.rs b/src/macros/config.rs index ad9e7fd2..368cbb36 100644 --- a/src/macros/config.rs +++ b/src/macros/config.rs @@ -17,7 +17,7 @@ const UNDOCUMENTED: &str = "# This item is undocumented. Please contribute docum 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 { let write = is_cargo_build() && !is_cargo_test(); let additional = generate_example(&input, args, write)?; diff --git a/src/macros/mod.rs b/src/macros/mod.rs index b5c5b67d..97417fb7 100644 --- a/src/macros/mod.rs +++ b/src/macros/mod.rs @@ -1,5 +1,3 @@ -#![allow(clippy::disallowed_macros)] - mod admin; mod cargo; mod config; diff --git a/src/main/logging.rs b/src/main/logging.rs index d365ee2a..33f9b179 100644 --- a/src/main/logging.rs +++ b/src/main/logging.rs @@ -17,7 +17,6 @@ pub(crate) type TracingFlameGuard = #[cfg(not(feature = "perf_measurements"))] pub(crate) type TracingFlameGuard = Option<()>; -#[allow(clippy::redundant_clone)] pub(crate) fn init(config: &Config) -> Result<(TracingFlameGuard, Logging)> { let reload_handles = LogLevelReloadHandles::default(); 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_attr( - not(feature = "perf_measurements"), - allow(clippy::let_unit_value) - )] let flame_guard = None; let subscriber = Arc::new(subscriber); diff --git a/src/router/layers.rs b/src/router/layers.rs index 22cb5e7c..9e61e66d 100644 --- a/src/router/layers.rs +++ b/src/router/layers.rs @@ -192,7 +192,7 @@ fn body_limit_layer(server: &Server) -> DefaultBodyLimit { } #[tracing::instrument(name = "panic", level = "error", skip_all)] -#[allow(clippy::needless_pass_by_value)] +#[expect(clippy::needless_pass_by_value)] fn catch_panic( err: Box, services: Arc, diff --git a/src/router/request.rs b/src/router/request.rs index 42112cbe..b0bb4605 100644 --- a/src/router/request.rs +++ b/src/router/request.rs @@ -73,7 +73,6 @@ pub(crate) async fn handle( skip_all, ret(level = "trace"), )] -#[allow(unused_variables)] async fn execute( // we made a safety contract that Services will not go out of scope // during the request; this ensures a reference is accounted for at diff --git a/src/service/account_data/mod.rs b/src/service/account_data/mod.rs index 0ed592a2..17697e87 100644 --- a/src/service/account_data/mod.rs +++ b/src/service/account_data/mod.rs @@ -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, diff --git a/src/service/admin/execute.rs b/src/service/admin/execute.rs index c7d977f2..b8aacd30 100644 --- a/src/service/admin/execute.rs +++ b/src/service/admin/execute.rs @@ -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; diff --git a/src/service/appservice/mod.rs b/src/service/appservice/mod.rs index 7d5bc4a6..20972fef 100644 --- a/src/service/appservice/mod.rs +++ b/src/service/appservice/mod.rs @@ -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 diff --git a/src/service/manager.rs b/src/service/manager.rs index cda97d19..c5c9b911 100644 --- a/src/service/manager.rs +++ b/src/service/manager.rs @@ -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<'_>, diff --git a/src/service/media/preview.rs b/src/service/media/preview.rs index dff13fd1..06c0be96 100644 --- a/src/service/media/preview.rs +++ b/src/service/media/preview.rs @@ -165,7 +165,7 @@ pub async fn download_image(&self, url: &str) -> Result { #[cfg(not(feature = "url_preview"))] #[implement(Service)] -#[allow(clippy::unused_async)] +#[expect(clippy::unused_async)] pub async fn download_image(&self, _url: &str) -> Result { Err!(FeatureDisabled("url_preview")) } @@ -215,7 +215,7 @@ async fn download_html(&self, url: &str) -> Result { #[cfg(not(feature = "url_preview"))] #[implement(Service)] -#[allow(clippy::unused_async)] +#[expect(clippy::unused_async)] async fn download_html(&self, _url: &str) -> Result { Err!(FeatureDisabled("url_preview")) } diff --git a/src/service/media/remote.rs b/src/service/media/remote.rs index acd81872..529b6240 100644 --- a/src/service/media/remote.rs +++ b/src/service/media/remote.rs @@ -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<'_>, diff --git a/src/service/media/thumbnail.rs b/src/service/media/thumbnail.rs index c485ee8a..c4810208 100644 --- a/src/service/media/thumbnail.rs +++ b/src/service/media/thumbnail.rs @@ -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<'_>, diff --git a/src/service/membership/join.rs b/src/service/membership/join.rs index 71dd3aa0..bac3eaf0 100644 --- a/src/service/membership/join.rs +++ b/src/service/membership/join.rs @@ -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, diff --git a/src/service/mod.rs b/src/service/mod.rs index c296b769..e89a56a5 100644 --- a/src/service/mod.rs +++ b/src/service/mod.rs @@ -1,6 +1,6 @@ #![recursion_limit = "256"] #![type_length_limit = "98304"] -#![allow(refining_impl_trait)] +#![expect(refining_impl_trait)] mod manager; mod migrations; diff --git a/src/service/presence/aggregate.rs b/src/service/presence/aggregate.rs index cdb0f74a..e1bb1b5c 100644 --- a/src/service/presence/aggregate.rs +++ b/src/service/presence/aggregate.rs @@ -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, diff --git a/src/service/presence/mod.rs b/src/service/presence/mod.rs index bbc9d8e4..fd6aa2ec 100644 --- a/src/service/presence/mod.rs +++ b/src/service/presence/mod.rs @@ -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; } diff --git a/src/service/presence/pipeline.rs b/src/service/presence/pipeline.rs index 8e0f8153..b7a529b9 100644 --- a/src/service/presence/pipeline.rs +++ b/src/service/presence/pipeline.rs @@ -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, diff --git a/src/service/resolver/dns.rs b/src/service/resolver/dns.rs index f6e20abe..d36fd386 100644 --- a/src/service/resolver/dns.rs +++ b/src/service/resolver/dns.rs @@ -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, mut opts: ResolverOpts) -> ResolverOpts { let config = &server.config; diff --git a/src/service/resolver/fed.rs b/src/service/resolver/fed.rs index 55fb0d16..0cf9552e 100644 --- a/src/service/resolver/fed.rs +++ b/src/service/resolver/fed.rs @@ -68,7 +68,7 @@ impl FedDest { } #[inline] - #[allow(clippy::string_slice)] + #[expect(clippy::string_slice)] pub(crate) fn port(&self) -> Option { match &self { | Self::Literal(addr) => Some(addr.port()), diff --git a/src/service/resolver/mod.rs b/src/service/resolver/mod.rs index 0980a21b..31bea5f9 100644 --- a/src/service/resolver/mod.rs +++ b/src/service/resolver/mod.rs @@ -26,11 +26,6 @@ type Resolving = MutexMap; #[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> { let cache = Cache::new(args); Ok(Arc::new(Self { diff --git a/src/service/rooms/event_handler/fetch_prev.rs b/src/service/rooms/event_handler/fetch_prev.rs index 11cc6db3..5b744d5b 100644 --- a/src/service/rooms/event_handler/fetch_prev.rs +++ b/src/service/rooms/event_handler/fetch_prev.rs @@ -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, diff --git a/src/service/rooms/event_handler/handle_prev_pdu.rs b/src/service/rooms/event_handler/handle_prev_pdu.rs index 041630dc..35b0a24d 100644 --- a/src/service/rooms/event_handler/handle_prev_pdu.rs +++ b/src/service/rooms/event_handler/handle_prev_pdu.rs @@ -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, diff --git a/src/service/rooms/spaces/mod.rs b/src/service/rooms/spaces/mod.rs index 9140eb5b..b0160157 100644 --- a/src/service/rooms/spaces/mod.rs +++ b/src/service/rooms/spaces/mod.rs @@ -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, diff --git a/src/service/rooms/state/mod.rs b/src/service/rooms/state/mod.rs index d42b1f29..19bac9b3 100644 --- a/src/service/rooms/state/mod.rs +++ b/src/service/rooms/state/mod.rs @@ -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, diff --git a/src/service/rooms/state_cache/update.rs b/src/service/rooms/state_cache/update.rs index 7a73a262..a91167bd 100644 --- a/src/service/rooms/state_cache/update.rs +++ b/src/service/rooms/state_cache/update.rs @@ -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 diff --git a/src/service/sending/mod.rs b/src/service/sending/mod.rs index 3e9e5e6e..cd1aeeac 100644 --- a/src/service/sending/mod.rs +++ b/src/service/sending/mod.rs @@ -41,7 +41,7 @@ struct Msg { queue_id: Vec, } -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] #[derive(Clone, Debug, PartialEq, Eq, Hash)] pub enum SendingEvent { Pdu(RawPduId), // pduid diff --git a/src/service/sending/sender.rs b/src/service/sending/sender.rs index 081015a2..8b13c2d6 100644 --- a/src/service/sending/sender.rs +++ b/src/service/sending/sender.rs @@ -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, diff --git a/src/service/uiaa/mod.rs b/src/service/uiaa/mod.rs index 4968d8c9..20a28f20 100644 --- a/src/service/uiaa/mod.rs +++ b/src/service/uiaa/mod.rs @@ -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, diff --git a/src/service/users/mod.rs b/src/service/users/mod.rs index 85a22c3a..9e9982d4 100644 --- a/src/service/users/mod.rs +++ b/src/service/users/mod.rs @@ -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> { 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")) }