attr_fn_like_width to 60

note the default is documented as 70 but this was not being honored by rustfmt

Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
Jason Volk
2025-04-23 19:27:49 +00:00
parent 76509830e6
commit 5bcf3550ab
19 changed files with 190 additions and 42 deletions

View File

@@ -1,4 +1,5 @@
array_width = 80
attr_fn_like_width = 60
chain_width = 50
comment_width = 80
condense_wildcard_suffixes = true

View File

@@ -6,7 +6,11 @@ pub mod je;
#[cfg(all(not(target_env = "msvc"), feature = "jemalloc"))]
pub use je::{memory_stats, memory_usage, trim};
#[cfg(all(not(target_env = "msvc"), feature = "hardened_malloc", not(feature = "jemalloc")))]
#[cfg(all(
not(target_env = "msvc"),
feature = "hardened_malloc",
not(feature = "jemalloc")
))]
pub mod hardened;
#[cfg(all(
not(target_env = "msvc"),

View File

@@ -606,7 +606,10 @@ pub struct Config {
/// spiders.
///
/// This is inherently false if `allow_federation` is disabled
#[serde(default = "true_fn", alias = "allow_profile_lookup_federation_requests")]
#[serde(
default = "true_fn",
alias = "allow_profile_lookup_federation_requests"
)]
pub allow_inbound_profile_lookup_federation_requests: bool,
/// Allow standard users to create rooms. Appservices and admins are always
@@ -1827,7 +1830,10 @@ pub struct TlsConfig {
#[allow(rustdoc::broken_intra_doc_links, rustdoc::bare_urls)]
#[derive(Clone, Debug, Deserialize, Default)]
#[config_example_generator(filename = "tuwunel-example.toml", section = "global.well_known")]
#[config_example_generator(
filename = "tuwunel-example.toml",
section = "global.well_known"
)]
pub struct WellKnownConfig {
/// The server URL that the client well-known file will serve. This should
/// not contain a port, and should just be a valid HTTPS URL.
@@ -1853,7 +1859,10 @@ pub struct WellKnownConfig {
#[derive(Clone, Copy, Debug, Deserialize, Default)]
#[allow(rustdoc::broken_intra_doc_links, rustdoc::bare_urls)]
#[config_example_generator(filename = "tuwunel-example.toml", section = "global.blurhashing")]
#[config_example_generator(
filename = "tuwunel-example.toml",
section = "global.blurhashing"
)]
pub struct BlurhashConfig {
/// blurhashing x component, 4 is recommended by https://blurha.sh/
///

View File

@@ -1,4 +1,8 @@
#![allow(clippy::cast_possible_wrap, clippy::cast_sign_loss, clippy::as_conversions)]
#![allow(
clippy::cast_possible_wrap,
clippy::cast_sign_loss,
clippy::as_conversions
)]
use std::{cmp::Ordering, fmt, fmt::Display, str::FromStr};

View File

@@ -134,7 +134,10 @@ fn deserialize_legacy_power_levels(content: &str) -> Option<RoomPowerLevelsEvent
#[derive(Deserialize)]
pub(crate) struct PowerLevelsContentFields {
#[serde(default, deserialize_with = "vec_deserialize_v1_powerlevel_values")]
#[serde(
default,
deserialize_with = "vec_deserialize_v1_powerlevel_values"
)]
pub(crate) users: Vec<(OwnedUserId, Int)>,
#[serde(default, deserialize_with = "deserialize_v1_powerlevel")]
@@ -157,7 +160,10 @@ impl PowerLevelsContentFields {
#[derive(Deserialize)]
struct IntPowerLevelsContentFields {
#[serde(default, deserialize_with = "vec_deserialize_int_powerlevel_values")]
#[serde(
default,
deserialize_with = "vec_deserialize_int_powerlevel_values"
)]
users: Vec<(OwnedUserId, Int)>,
#[serde(default)]
@@ -227,7 +233,10 @@ pub(crate) fn deserialize_power_levels_content_invite(
#[derive(Deserialize)]
pub(crate) struct PowerLevelsContentRedact {
#[serde(default = "default_power_level", deserialize_with = "deserialize_v1_powerlevel")]
#[serde(
default = "default_power_level",
deserialize_with = "deserialize_v1_powerlevel"
)]
pub(crate) redact: Int,
}

View File

@@ -123,7 +123,10 @@ pub fn name_from_path(path: &Path) -> Result<String> {
}
/// Get the (major, minor) of the block device on which Path is mounted.
#[allow(clippy::useless_conversion, clippy::unnecessary_fallible_conversions)]
#[allow(
clippy::useless_conversion,
clippy::unnecessary_fallible_conversions
)]
fn dev_from_path(path: &Path) -> Result<(dev_t, dev_t)> {
#[cfg(target_family = "unix")]
use std::os::unix::fs::MetadataExt;

View File

@@ -57,7 +57,11 @@ pub fn format(ts: SystemTime, str: &str) -> String {
}
#[must_use]
#[allow(clippy::as_conversions, clippy::cast_possible_truncation, clippy::cast_sign_loss)]
#[allow(
clippy::as_conversions,
clippy::cast_possible_truncation,
clippy::cast_sign_loss
)]
pub fn pretty(d: Duration) -> String {
use Unit::*;

View File

@@ -183,7 +183,10 @@ impl<'a, 'de: 'a> de::Deserializer<'de> for &'a mut Deserializer<'de> {
visitor.visit_seq(self)
}
#[cfg_attr(unabridged, tracing::instrument(level = "trace", skip(self, visitor)))]
#[cfg_attr(
unabridged,
tracing::instrument(level = "trace", skip(self, visitor))
)]
fn deserialize_tuple<V>(self, _len: usize, visitor: V) -> Result<V::Value>
where
V: Visitor<'de>,
@@ -192,7 +195,10 @@ impl<'a, 'de: 'a> de::Deserializer<'de> for &'a mut Deserializer<'de> {
visitor.visit_seq(self)
}
#[cfg_attr(unabridged, tracing::instrument(level = "trace", skip(self, visitor)))]
#[cfg_attr(
unabridged,
tracing::instrument(level = "trace", skip(self, visitor))
)]
fn deserialize_tuple_struct<V>(
self,
_name: &'static str,
@@ -216,7 +222,10 @@ impl<'a, 'de: 'a> de::Deserializer<'de> for &'a mut Deserializer<'de> {
d.deserialize_map(visitor).map_err(Into::into)
}
#[cfg_attr(unabridged, tracing::instrument(level = "trace", skip(self, visitor)))]
#[cfg_attr(
unabridged,
tracing::instrument(level = "trace", skip(self, visitor))
)]
fn deserialize_struct<V>(
self,
name: &'static str,
@@ -232,7 +241,10 @@ impl<'a, 'de: 'a> de::Deserializer<'de> for &'a mut Deserializer<'de> {
.map_err(Into::into)
}
#[cfg_attr(unabridged, tracing::instrument(level = "trace", skip(self, visitor)))]
#[cfg_attr(
unabridged,
tracing::instrument(level = "trace", skip(self, visitor))
)]
fn deserialize_unit_struct<V>(self, name: &'static str, visitor: V) -> Result<V::Value>
where
V: Visitor<'de>,
@@ -246,7 +258,10 @@ impl<'a, 'de: 'a> de::Deserializer<'de> for &'a mut Deserializer<'de> {
visitor.visit_unit()
}
#[cfg_attr(unabridged, tracing::instrument(level = "trace", skip(self, visitor)))]
#[cfg_attr(
unabridged,
tracing::instrument(level = "trace", skip(self, visitor))
)]
fn deserialize_newtype_struct<V>(self, name: &'static str, visitor: V) -> Result<V::Value>
where
V: Visitor<'de>,
@@ -261,7 +276,10 @@ impl<'a, 'de: 'a> de::Deserializer<'de> for &'a mut Deserializer<'de> {
}
}
#[cfg_attr(unabridged, tracing::instrument(level = "trace", skip(self, _visitor)))]
#[cfg_attr(
unabridged,
tracing::instrument(level = "trace", skip(self, _visitor))
)]
fn deserialize_enum<V>(
self,
_name: &'static str,
@@ -436,7 +454,10 @@ impl<'a, 'de: 'a> de::Deserializer<'de> for &'a mut Deserializer<'de> {
impl<'a, 'de: 'a> de::SeqAccess<'de> for &'a mut Deserializer<'de> {
type Error = Error;
#[cfg_attr(unabridged, tracing::instrument(level = "trace", skip(self, seed)))]
#[cfg_attr(
unabridged,
tracing::instrument(level = "trace", skip(self, seed))
)]
fn next_element_seed<T>(&mut self, seed: T) -> Result<Option<T::Value>>
where
T: DeserializeSeed<'de>,
@@ -455,7 +476,10 @@ impl<'a, 'de: 'a> de::SeqAccess<'de> for &'a mut Deserializer<'de> {
impl<'a, 'de: 'a> de::MapAccess<'de> for &'a mut Deserializer<'de> {
type Error = Error;
#[cfg_attr(unabridged, tracing::instrument(level = "trace", skip(self, seed)))]
#[cfg_attr(
unabridged,
tracing::instrument(level = "trace", skip(self, seed))
)]
fn next_key_seed<K>(&mut self, seed: K) -> Result<Option<K::Value>>
where
K: DeserializeSeed<'de>,
@@ -463,7 +487,10 @@ impl<'a, 'de: 'a> de::MapAccess<'de> for &'a mut Deserializer<'de> {
seed.deserialize(&mut **self).map(Some)
}
#[cfg_attr(unabridged, tracing::instrument(level = "trace", skip(self, seed)))]
#[cfg_attr(
unabridged,
tracing::instrument(level = "trace", skip(self, seed))
)]
fn next_value_seed<V>(&mut self, seed: V) -> Result<V::Value>
where
V: DeserializeSeed<'de>,

View File

@@ -124,7 +124,12 @@ impl Engine {
#[inline]
#[must_use]
#[tracing::instrument(name = "sequence", level = "debug", skip_all, fields(sequence))]
#[tracing::instrument(
name = "sequence",
level = "debug",
skip_all,
fields(sequence)
)]
pub fn current_sequence(&self) -> u64 {
let sequence = self.db.latest_sequence_number();

View File

@@ -268,7 +268,11 @@ pub(crate) fn cache_size(config: &Config, base_size: u32, entity_size: usize) ->
cache_size_f64(config, f64::from(base_size), entity_size)
}
#[allow(clippy::as_conversions, clippy::cast_sign_loss, clippy::cast_possible_truncation)]
#[allow(
clippy::as_conversions,
clippy::cast_sign_loss,
clippy::cast_possible_truncation
)]
pub(crate) fn cache_size_f64(config: &Config, base_size: f64, entity_size: usize) -> usize {
let ents = base_size * config.cache_capacity_modifier;

View File

@@ -14,7 +14,10 @@ use crate::{
};
#[test]
#[cfg_attr(debug_assertions, should_panic(expected = "serializing string at the top-level"))]
#[cfg_attr(
debug_assertions,
should_panic(expected = "serializing string at the top-level")
)]
fn ser_str() {
let user_id: &UserId = "@user:example.com".try_into().unwrap();
let s = serialize_to_vec(&user_id).expect("failed to serialize user_id");
@@ -162,7 +165,10 @@ fn ser_json_macro() {
}
#[test]
#[cfg_attr(debug_assertions, should_panic(expected = "serializing string at the top-level"))]
#[cfg_attr(
debug_assertions,
should_panic(expected = "serializing string at the top-level")
)]
fn ser_json_raw() {
use tuwunel_core::ruma::api::client::filter::FilterDefinition;
@@ -179,7 +185,10 @@ fn ser_json_raw() {
}
#[test]
#[cfg_attr(debug_assertions, should_panic(expected = "you can skip serialization instead"))]
#[cfg_attr(
debug_assertions,
should_panic(expected = "you can skip serialization instead")
)]
fn ser_json_raw_json() {
use tuwunel_core::ruma::api::client::filter::FilterDefinition;

View File

@@ -58,15 +58,30 @@ pub(crate) struct Args {
pub(crate) worker_threads: usize,
/// Override the tokio global_queue_interval.
#[arg(long, hide(true), env = "TOKIO_GLOBAL_QUEUE_INTERVAL", default_value = "192")]
#[arg(
long,
hide(true),
env = "TOKIO_GLOBAL_QUEUE_INTERVAL",
default_value = "192"
)]
pub(crate) global_event_interval: u32,
/// Override the tokio event_interval.
#[arg(long, hide(true), env = "TOKIO_EVENT_INTERVAL", default_value = "512")]
#[arg(
long,
hide(true),
env = "TOKIO_EVENT_INTERVAL",
default_value = "512"
)]
pub(crate) kernel_event_interval: u32,
/// Override the tokio max_io_events_per_tick.
#[arg(long, hide(true), env = "TOKIO_MAX_IO_EVENTS_PER_TICK", default_value = "512")]
#[arg(
long,
hide(true),
env = "TOKIO_MAX_IO_EVENTS_PER_TICK",
default_value = "512"
)]
pub(crate) kernel_events_per_tick: usize,
/// Set the histogram bucket size, in microseconds (tokio_unstable). Default
@@ -74,11 +89,21 @@ pub(crate) struct Args {
/// with the exception of the last bucket, try increasing this value to e.g.
/// 50 or 100. Inversely, decrease to 10 etc if the histogram lacks
/// resolution.
#[arg(long, hide(true), env = "TUWUNEL_RUNTIME_HISTOGRAM_INTERVAL", default_value = "25")]
#[arg(
long,
hide(true),
env = "TUWUNEL_RUNTIME_HISTOGRAM_INTERVAL",
default_value = "25"
)]
pub(crate) worker_histogram_interval: u64,
/// Set the histogram bucket count (tokio_unstable). Default is 20.
#[arg(long, hide(true), env = "TUWUNEL_RUNTIME_HISTOGRAM_BUCKETS", default_value = "20")]
#[arg(
long,
hide(true),
env = "TUWUNEL_RUNTIME_HISTOGRAM_BUCKETS",
default_value = "20"
)]
pub(crate) worker_histogram_buckets: usize,
/// Toggles worker affinity feature.

View File

@@ -92,7 +92,10 @@ pub(crate) fn init(
};
#[cfg(not(feature = "perf_measurements"))]
#[cfg_attr(not(feature = "perf_measurements"), allow(clippy::let_unit_value))]
#[cfg_attr(
not(feature = "perf_measurements"),
allow(clippy::let_unit_value)
)]
let flame_guard = ();
let ret = (reload_handles, flame_guard, cap_state);

View File

@@ -179,7 +179,11 @@ fn base(config: &Config) -> Result<reqwest::ClientBuilder> {
}
}
#[cfg(any(target_os = "android", target_os = "fuchsia", target_os = "linux"))]
#[cfg(any(
target_os = "android",
target_os = "fuchsia",
target_os = "linux"
))]
fn builder_interface(
builder: reqwest::ClientBuilder,
config: Option<&str>,
@@ -191,7 +195,11 @@ fn builder_interface(
}
}
#[cfg(not(any(target_os = "android", target_os = "fuchsia", target_os = "linux")))]
#[cfg(not(any(
target_os = "android",
target_os = "fuchsia",
target_os = "linux"
)))]
fn builder_interface(
builder: reqwest::ClientBuilder,
config: Option<&str>,

View File

@@ -16,17 +16,35 @@ use super::Service;
#[derive(Serialize, Default)]
pub struct UrlPreviewData {
#[serde(skip_serializing_if = "Option::is_none", rename(serialize = "og:title"))]
#[serde(
skip_serializing_if = "Option::is_none",
rename(serialize = "og:title")
)]
pub title: Option<String>,
#[serde(skip_serializing_if = "Option::is_none", rename(serialize = "og:description"))]
#[serde(
skip_serializing_if = "Option::is_none",
rename(serialize = "og:description")
)]
pub description: Option<String>,
#[serde(skip_serializing_if = "Option::is_none", rename(serialize = "og:image"))]
#[serde(
skip_serializing_if = "Option::is_none",
rename(serialize = "og:image")
)]
pub image: Option<String>,
#[serde(skip_serializing_if = "Option::is_none", rename(serialize = "matrix:image:size"))]
#[serde(
skip_serializing_if = "Option::is_none",
rename(serialize = "matrix:image:size")
)]
pub image_size: Option<usize>,
#[serde(skip_serializing_if = "Option::is_none", rename(serialize = "og:image:width"))]
#[serde(
skip_serializing_if = "Option::is_none",
rename(serialize = "og:image:width")
)]
pub image_width: Option<u32>,
#[serde(skip_serializing_if = "Option::is_none", rename(serialize = "og:image:height"))]
#[serde(
skip_serializing_if = "Option::is_none",
rename(serialize = "og:image:height")
)]
pub image_height: Option<u32>,
}

View File

@@ -22,7 +22,11 @@ pub(crate) struct Hooked {
type ResolvingResult = Result<Addrs, Box<dyn std::error::Error + Send + Sync>>;
impl Resolver {
#[allow(clippy::as_conversions, clippy::cast_sign_loss, clippy::cast_possible_truncation)]
#[allow(
clippy::as_conversions,
clippy::cast_sign_loss,
clippy::cast_possible_truncation
)]
pub(super) fn build(server: &Arc<Server>, cache: Arc<Cache>) -> Result<Arc<Self>> {
let config = &server.config;
let (sys_conf, mut opts) = hickory_resolver::system_conf::read_system_conf()

View File

@@ -31,7 +31,11 @@ type NameBuf = ArrayString<256>;
#[async_trait]
impl crate::Service for Service {
#[allow(clippy::as_conversions, clippy::cast_sign_loss, clippy::cast_possible_truncation)]
#[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

@@ -519,7 +519,11 @@ impl Service {
}
/// Look for read receipts in this room
#[tracing::instrument(name = "receipts", level = "trace", skip(self, since, max_edu_count))]
#[tracing::instrument(
name = "receipts",
level = "trace",
skip(self, since, max_edu_count)
)]
async fn select_edus_receipts_room(
&self,
room_id: &RoomId,

View File

@@ -184,7 +184,10 @@ impl Service {
/// Returns an iterator over all users on this homeserver (offered for
/// compatibility)
#[allow(clippy::iter_without_into_iter, clippy::iter_not_returning_iterator)]
#[allow(
clippy::iter_without_into_iter,
clippy::iter_not_returning_iterator
)]
pub fn iter(&self) -> impl Stream<Item = OwnedUserId> + Send + '_ {
self.stream().map(ToOwned::to_owned)
}