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"
#allow_attributes = "warn" # UNSTABLE
arithmetic_side_effects = "warn"
as_conversions = "warn"
as_underscore = "warn"

View File

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

View File

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

View File

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

View File

@@ -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;

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
#[allow(clippy::result_large_err)]
#[expect(clippy::result_large_err)]
fn parse<'a>(
services: &Arc<Services>,
input: &'a CommandInput,

View File

@@ -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

View File

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

View File

@@ -1,4 +1,4 @@
#![allow(deprecated)]
#![expect(deprecated)]
use axum::extract::State;
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
// 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()

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
/// - 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<crate::State>,

View File

@@ -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",

View File

@@ -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<crate::State>,
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(
services: &Services,
sender_user: &UserId,

View File

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

View File

@@ -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,

View File

@@ -17,7 +17,7 @@ pub(super) async fn handle_login(
body: &Ruma<Request>,
info: &Password,
) -> Result<OwnedUserId> {
#[allow(deprecated)]
#[expect(deprecated)]
let Password { identifier, password, user, .. } = info;
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,
),
)]
#[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,

View File

@@ -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) {

View File

@@ -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,

View File

@@ -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;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -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)");

View File

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

View File

@@ -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<IdentityProvider>,
#[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<String, IgnoredAny>,
}
@@ -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 {

View File

@@ -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<Self, Self::Err> {
// maybe do some domain validation?
Ok(if s.starts_with("*.") {

View File

@@ -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);

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()) }
}
#[allow(clippy::fallible_impl_from)]
#[expect(clippy::fallible_impl_from)]
impl From<Infallible> 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() }

View File

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

View File

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

View File

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

View File

@@ -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<Fetch, Fut, 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;
}
#[allow(non_snake_case)]
#[expect(non_snake_case)]
fn BAN_STATE_SET() -> HashMap<OwnedEventId, PduEvent> {
vec![
to_pdu_event(
@@ -697,7 +697,7 @@ fn BAN_STATE_SET() -> HashMap<OwnedEventId, PduEvent> {
.collect()
}
#[allow(non_snake_case)]
#[expect(non_snake_case)]
fn JOIN_RULE() -> HashMap<OwnedEventId, PduEvent> {
vec![
to_pdu_event(
@@ -726,7 +726,7 @@ fn JOIN_RULE() -> HashMap<OwnedEventId, PduEvent> {
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);

View File

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

View File

@@ -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<OwnedEventId, PduEvent>);
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<OwnedEventId, PduEvent> {
vec![
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
/// `org.matrix.hydra.11` onwards.
#[allow(non_snake_case)]
#[expect(non_snake_case)]
pub(super) fn INITIAL_HYDRA_EVENTS() -> HashMap<OwnedEventId, PduEvent> {
vec![
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
#[allow(non_snake_case)]
#[expect(non_snake_case)]
pub(super) fn INITIAL_EVENTS_CREATE_ROOM() -> HashMap<OwnedEventId, PduEvent> {
vec![to_pdu_event::<&EventId>(
"CREATE",
@@ -823,7 +823,7 @@ pub(super) fn INITIAL_EVENTS_CREATE_ROOM() -> HashMap<OwnedEventId, PduEvent> {
.collect()
}
#[allow(non_snake_case)]
#[expect(non_snake_case)]
pub(super) fn INITIAL_EDGES() -> Vec<OwnedEventId> {
vec!["START", "IMC", "IMB", "IJR", "IPOWER", "IMA", "CREATE"]
.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
/// 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 }

View File

@@ -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]

View File

@@ -60,7 +60,7 @@ impl<T: fmt::Debug> 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)

View File

@@ -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;

View File

@@ -1,4 +1,4 @@
#![allow(clippy::wrong_self_convention)]
#![expect(clippy::wrong_self_convention)]
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;

View File

@@ -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<Self, impl FnOnce(Self::Ok) -> bool, impl FnOnce(Self::Error) -> bool>

View File

@@ -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<usize, Error> {
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]

View File

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

View File

@@ -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<F>(
self,
mut f: F,

View File

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

View File

@@ -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};

View File

@@ -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<I, O>(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<T: AsRef<str>>(choice: &[T]) -> &str {
choice.first().map_or(EMPTY, move |best| {
choice
@@ -114,7 +114,7 @@ pub fn common_prefix<T: AsRef<str>>(choice: &[T]) -> &str {
#[inline]
#[must_use]
#[allow(clippy::arithmetic_side_effects)]
#[expect(clippy::arithmetic_side_effects)]
pub fn truncate_deterministic(str: &str, range: Option<Range<usize>>) -> &str {
let range = range.unwrap_or(0..str.len());
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
// by wrapping in a tuple-struct.
#[allow(clippy::transmute_ptr_to_ptr)]
#[expect(clippy::transmute_ptr_to_ptr)]
unsafe {
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.
#[allow(
#[expect(
clippy::useless_conversion,
clippy::unnecessary_fallible_conversions
)]

View File

@@ -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;

View File

@@ -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::*;

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)
}
#[allow(
#[expect(
clippy::as_conversions,
clippy::cast_sign_loss,
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)
}
#[allow(clippy::as_conversions, clippy::cast_precision_loss)]
#[expect(clippy::as_conversions, clippy::cast_precision_loss)]
fn update_stream_width(
server: &Arc<Server>,
num_queues: usize,

View File

@@ -183,7 +183,6 @@ impl<W: Write> ser::Serializer for &mut Serializer<'_, W> {
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>
where
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;

View File

@@ -12,7 +12,7 @@ use crate::{
pub(super) fn command(mut item: ItemFn, _args: &[Meta]) -> Result<TokenStream> {
let attr: Vec<Attribute> = 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<TokenStr
.try_collect()?;
let switch = quote! {
#[allow(clippy::large_stack_frames)] //TODO: fixme
#[expect(clippy::large_stack_frames)] //TODO: fixme
pub(super) async fn process(
command: #name,
context: &crate::Context<'_>
) -> Result {
use #name::*;
#[allow(non_snake_case)]
#[expect(non_snake_case)]
match command {
#( #arm )*
}

View File

@@ -19,7 +19,6 @@ pub(super) fn manifest(item: ItemConst, args: &[Meta]) -> Result<TokenStream> {
Ok(ret.into())
}
#[allow(clippy::option_env_unwrap)]
fn manifest_path(member: Option<&str>) -> Result<PathBuf> {
let Some(path) = option_env!("CARGO_MANIFEST_DIR") else {
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"];
#[allow(clippy::needless_pass_by_value)]
#[expect(clippy::needless_pass_by_value)]
pub(super) fn example_generator(input: ItemStruct, args: &[Meta]) -> Result<TokenStream> {
let write = is_cargo_build() && !is_cargo_test();
let additional = generate_example(&input, args, write)?;

View File

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

View File

@@ -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);

View File

@@ -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<dyn Any + Send + 'static>,
services: Arc<Services>,

View File

@@ -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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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