Revert 1.95.0 clippy lints

Let's do these in a separate PR.
This commit is contained in:
Andrew Morgan
2026-05-13 10:58:26 +02:00
parent 8bea3fde66
commit 9841b24a0c
23 changed files with 79 additions and 77 deletions
+1 -1
View File
@@ -100,7 +100,7 @@ impl AppState {
if let Err(e) = metadata_cache
.warm_up_and_run(
&http_client,
std::time::Duration::from_mins(15),
std::time::Duration::from_secs(60 * 15),
&mut repo,
)
.await
+1 -1
View File
@@ -203,7 +203,7 @@ impl Options {
// Activity is flushed every minute
let activity_tracker = ActivityTracker::new(
PgRepositoryFactory::new(pool.clone()).boxed(),
Duration::from_mins(1),
Duration::from_secs(60),
shutdown.task_tracker(),
shutdown.soft_shutdown_token(),
);
+1 -1
View File
@@ -83,7 +83,7 @@ impl LifecycleManager {
let sigterm = tokio::signal::unix::signal(SignalKind::terminate())?;
let sigint = tokio::signal::unix::signal(SignalKind::interrupt())?;
let sighup = tokio::signal::unix::signal(SignalKind::hangup())?;
let timeout = Duration::from_mins(1);
let timeout = Duration::from_secs(60);
let task_tracker = TaskTracker::new();
notify(&[sd_notify::NotifyState::MainPid(std::process::id())]);
+2 -2
View File
@@ -258,12 +258,12 @@ pub fn build_router(
// Cache 404s for 5 minutes
CacheControl::new()
.with_public()
.with_max_age(Duration::from_mins(5))
.with_max_age(Duration::from_secs(5 * 60))
} else {
// Cache assets for 1 year
CacheControl::new()
.with_public()
.with_max_age(Duration::from_hours(8760))
.with_max_age(Duration::from_secs(365 * 24 * 60 * 60))
.with_immutable()
};
res.headers_mut().typed_insert(cache_control);
+1 -1
View File
@@ -441,7 +441,7 @@ pub async fn load_policy_factory_dynamic_data_continuously(
load_policy_factory_dynamic_data(&policy_factory, &*repository_factory).await?;
task_tracker.spawn(async move {
let mut interval = tokio::time::interval(Duration::from_mins(1));
let mut interval = tokio::time::interval(Duration::from_secs(60));
loop {
tokio::select! {
+2 -2
View File
@@ -29,12 +29,12 @@ fn default_connect_timeout() -> Duration {
#[allow(clippy::unnecessary_wraps)]
fn default_idle_timeout() -> Option<Duration> {
Some(Duration::from_mins(10))
Some(Duration::from_secs(10 * 60))
}
#[allow(clippy::unnecessary_wraps)]
fn default_max_lifetime() -> Option<Duration> {
Some(Duration::from_mins(30))
Some(Duration::from_secs(30 * 60))
}
impl Default for DatabaseConfig {
+3 -3
View File
@@ -191,7 +191,7 @@ where
CONTENT_LANGUAGE,
CONTENT_TYPE,
])
.max_age(Duration::from_hours(1)),
.max_age(Duration::from_secs(60 * 60)),
)
}
@@ -255,7 +255,7 @@ where
// Swagger will send this header, so we have to allow it to avoid CORS errors
HeaderName::from_static("x-requested-with"),
])
.max_age(Duration::from_hours(1)),
.max_age(Duration::from_secs(60 * 60)),
)
}
@@ -326,7 +326,7 @@ where
CONTENT_TYPE,
HeaderName::from_static("x-requested-with"),
])
.max_age(Duration::from_hours(1)),
.max_age(Duration::from_secs(60 * 60)),
);
Router::new().merge(human_router).merge(api_router)
+1 -1
View File
@@ -145,7 +145,7 @@ impl Limiter {
let this = self.clone();
tokio::spawn(async move {
// Run the task every minute
let mut interval = tokio::time::interval(Duration::from_mins(1));
let mut interval = tokio::time::interval(Duration::from_secs(60));
interval.set_missed_tick_behavior(tokio::time::MissedTickBehavior::Skip);
loop {
+1 -1
View File
@@ -241,7 +241,7 @@ impl TestState {
let activity_tracker = ActivityTracker::new(
PgRepositoryFactory::new(pool.clone()).boxed(),
std::time::Duration::from_mins(1),
std::time::Duration::from_secs(60),
&task_tracker,
shutdown_token.child_token(),
);
@@ -134,10 +134,14 @@ fn b64encode(bytes: &[u8]) -> String {
fn tlvdecode(bytes: &[u8]) -> Result<HashMap<Value, Value>, Error> {
let mut iter = bytes.iter().copied();
let mut ret = HashMap::new();
// TODO: this loop assumes the tag and the length are both single bytes, which
// is not always the case with protobufs. We should properly decode varints
// here.
while let Some(tag) = iter.next() {
loop {
// TODO: this assumes the tag and the length are both single bytes, which is not
// always the case with protobufs. We should properly decode varints
// here.
let Some(tag) = iter.next() else {
break;
};
let len = iter
.next()
.ok_or_else(|| Error::new(ErrorKind::InvalidOperation, "Invalid ILV encoding"))?;
+1 -1
View File
@@ -102,7 +102,7 @@ pub fn client() -> reqwest::Client {
.dns_resolver(Arc::new(TracingResolver::new()))
.use_preconfigured_tls(tls_config)
.user_agent(USER_AGENT)
.timeout(Duration::from_mins(1))
.timeout(Duration::from_secs(60))
.connect_timeout(Duration::from_secs(30))
.build()
.expect("failed to create HTTP client")
+2 -2
View File
@@ -542,7 +542,7 @@ impl HomeserverConnection for SynapseConnection {
.post(&format!("_synapse/admin/v1/deactivate/{encoded_mxid}"))
.json(&SynapseDeactivateUserRequest { erase })
// Deactivation can take a while, so we set a longer timeout
.timeout(Duration::from_mins(5))
.timeout(Duration::from_secs(60 * 5))
.send_traced()
.await
.context("Failed to deactivate user in Synapse")?;
@@ -591,7 +591,7 @@ impl HomeserverConnection for SynapseConnection {
match response.status() {
StatusCode::CREATED | StatusCode::OK => Ok(()),
code => bail!("Unexpected HTTP code while reactivating user in Synapse: {code}"),
code => bail!("Unexpected HTTP code while reactivating user in Synapse: {code}",),
}
}
+3 -1
View File
@@ -165,7 +165,9 @@ impl Scope {
/// Whether this `Scope` contains the given value.
#[must_use]
pub fn contains(&self, token: &str) -> bool {
ScopeToken::from_str(token).is_ok_and(|token| self.0.contains(&token))
ScopeToken::from_str(token)
.map(|token| self.0.contains(&token))
.unwrap_or(false)
}
/// Inserts the given token in this `Scope`.
@@ -135,34 +135,30 @@ fn pass_full_authorization_url() {
fn is_valid_token_endpoint_request(req: &Request) -> bool {
let body = form_urlencoded::parse(&req.body).collect::<HashMap<_, _>>();
if body
.get("client_id")
.as_ref()
.is_none_or(|s| *s != CLIENT_ID)
{
if body.get("client_id").filter(|s| *s == CLIENT_ID).is_none() {
println!("Missing or wrong client ID");
return false;
}
if body
.get("grant_type")
.as_ref()
.is_none_or(|s| *s != "authorization_code")
.filter(|s| *s == "authorization_code")
.is_none()
{
println!("Missing or wrong grant type");
return false;
}
if body
.get("code")
.as_ref()
.is_none_or(|s| *s != AUTHORIZATION_CODE)
.filter(|s| *s == AUTHORIZATION_CODE)
.is_none()
{
println!("Missing or wrong authorization code");
return false;
}
if body
.get("redirect_uri")
.as_ref()
.is_none_or(|s| *s != REDIRECT_URI)
.filter(|s| *s == REDIRECT_URI)
.is_none()
{
println!("Missing or wrong redirect URI");
return false;
@@ -170,8 +166,8 @@ fn is_valid_token_endpoint_request(req: &Request) -> bool {
if body
.get("code_verifier")
.as_ref()
.is_none_or(|s| *s != CODE_VERIFIER)
.filter(|s| *s == CODE_VERIFIER)
.is_none()
{
println!("Missing or wrong code verifier");
return false;
@@ -36,32 +36,32 @@ async fn pass_access_token_with_client_credentials() {
if query_pairs
.get("grant_type")
.as_ref()
.is_none_or(|s| *s != "client_credentials")
.filter(|s| *s == "client_credentials")
.is_none()
{
println!("Wrong or missing grant type");
return false;
}
if query_pairs
.get("scope")
.as_ref()
.is_none_or(|s| *s != "profile")
.filter(|s| *s == "profile")
.is_none()
{
println!("Wrong or missing scope");
return false;
}
if query_pairs
.get("client_id")
.as_ref()
.is_none_or(|s| *s != CLIENT_ID)
.filter(|s| *s == CLIENT_ID)
.is_none()
{
println!("Wrong or missing client ID");
return false;
}
if query_pairs
.get("client_secret")
.as_ref()
.is_none_or(|s| *s != CLIENT_SECRET)
.filter(|s| *s == CLIENT_SECRET)
.is_none()
{
println!("Wrong or missing client secret");
return false;
@@ -32,24 +32,24 @@ async fn pass_refresh_access_token() {
if query_pairs
.get("grant_type")
.as_ref()
.is_none_or(|s| *s != "refresh_token")
.filter(|s| *s == "refresh_token")
.is_none()
{
println!("Wrong or missing grant type");
return false;
}
if query_pairs
.get("refresh_token")
.as_ref()
.is_none_or(|s| *s != REFRESH_TOKEN)
.filter(|s| *s == REFRESH_TOKEN)
.is_none()
{
println!("Wrong or missing refresh token");
return false;
}
if query_pairs
.get("client_id")
.as_ref()
.is_none_or(|s| *s != CLIENT_ID)
.filter(|s| *s == CLIENT_ID)
.is_none()
{
println!("Wrong or missing client ID");
return false;
@@ -41,8 +41,8 @@ async fn pass_none() {
if query_pairs
.get("client_id")
.as_ref()
.is_none_or(|s| *s != CLIENT_ID)
.filter(|s| *s == CLIENT_ID)
.is_none()
{
println!("Wrong or missing client ID");
return false;
@@ -132,16 +132,16 @@ async fn pass_client_secret_post() {
if query_pairs
.get("client_id")
.as_ref()
.is_none_or(|s| *s != CLIENT_ID)
.filter(|s| *s == CLIENT_ID)
.is_none()
{
println!("Wrong or missing client ID");
return false;
}
if query_pairs
.get("client_secret")
.as_ref()
.is_none_or(|s| *s != CLIENT_SECRET)
.filter(|s| *s == CLIENT_SECRET)
.is_none()
{
println!("Wrong or missing client secret");
return false;
@@ -194,8 +194,8 @@ async fn pass_client_secret_jwt() {
}
if query_pairs
.get("client_assertion_type")
.as_ref()
.is_none_or(|s| *s != "urn:ietf:params:oauth:client-assertion-type:jwt-bearer")
.filter(|s| *s == "urn:ietf:params:oauth:client-assertion-type:jwt-bearer")
.is_none()
{
println!("Wrong or missing client assertion type");
return false;
@@ -273,8 +273,8 @@ async fn pass_private_key_jwt() {
}
if query_pairs
.get("client_assertion_type")
.as_ref()
.is_none_or(|s| *s != "urn:ietf:params:oauth:client-assertion-type:jwt-bearer")
.filter(|s| *s == "urn:ietf:params:oauth:client-assertion-type:jwt-bearer")
.is_none()
{
println!("Wrong or missing client assertion type");
return false;
+1 -1
View File
@@ -58,7 +58,7 @@ impl RunnableJob for CleanupQueueJobsJob {
}
fn timeout(&self) -> Option<Duration> {
Some(Duration::from_mins(10))
Some(Duration::from_secs(10 * 60))
}
}
+4 -4
View File
@@ -70,7 +70,7 @@ impl RunnableJob for CleanupOAuthAuthorizationGrantsJob {
fn timeout(&self) -> Option<Duration> {
// This job runs every hour, so having it running it for 10 minutes is fine
Some(Duration::from_mins(10))
Some(Duration::from_secs(10 * 60))
}
}
@@ -123,7 +123,7 @@ impl RunnableJob for CleanupOAuthDeviceCodeGrantsJob {
fn timeout(&self) -> Option<Duration> {
// This job runs every hour, so having it running it for 10 minutes is fine
Some(Duration::from_mins(10))
Some(Duration::from_secs(10 * 60))
}
}
@@ -167,7 +167,7 @@ impl RunnableJob for CleanupUpstreamOAuthSessionsJob {
fn timeout(&self) -> Option<Duration> {
// This job runs every hour, so having it running it for 10 minutes is fine
Some(Duration::from_mins(10))
Some(Duration::from_secs(10 * 60))
}
}
@@ -211,6 +211,6 @@ impl RunnableJob for CleanupUpstreamOAuthLinksJob {
fn timeout(&self) -> Option<Duration> {
// This job runs every hour, so having it running it for 10 minutes is fine
Some(Duration::from_mins(10))
Some(Duration::from_secs(10 * 60))
}
}
+6 -6
View File
@@ -65,7 +65,7 @@ impl RunnableJob for CleanupFinishedCompatSessionsJob {
fn timeout(&self) -> Option<Duration> {
// This job runs every hour, so having it running it for 10 minutes is fine
Some(Duration::from_mins(10))
Some(Duration::from_secs(10 * 60))
}
}
@@ -113,7 +113,7 @@ impl RunnableJob for CleanupFinishedOAuth2SessionsJob {
fn timeout(&self) -> Option<Duration> {
// This job runs every hour, so having it running it for 10 minutes is fine
Some(Duration::from_mins(10))
Some(Duration::from_secs(10 * 60))
}
}
@@ -162,7 +162,7 @@ impl RunnableJob for CleanupFinishedUserSessionsJob {
fn timeout(&self) -> Option<Duration> {
// This job runs every hour, so having it running it for 10 minutes is fine
Some(Duration::from_mins(10))
Some(Duration::from_secs(10 * 60))
}
}
@@ -203,7 +203,7 @@ impl RunnableJob for CleanupInactiveOAuth2SessionIpsJob {
}
fn timeout(&self) -> Option<Duration> {
Some(Duration::from_mins(10))
Some(Duration::from_secs(10 * 60))
}
}
@@ -244,7 +244,7 @@ impl RunnableJob for CleanupInactiveCompatSessionIpsJob {
}
fn timeout(&self) -> Option<Duration> {
Some(Duration::from_mins(10))
Some(Duration::from_secs(10 * 60))
}
}
@@ -285,6 +285,6 @@ impl RunnableJob for CleanupInactiveUserSessionIpsJob {
}
fn timeout(&self) -> Option<Duration> {
Some(Duration::from_mins(10))
Some(Duration::from_secs(10 * 60))
}
}
+4 -4
View File
@@ -63,7 +63,7 @@ impl RunnableJob for CleanupRevokedOAuthAccessTokensJob {
fn timeout(&self) -> Option<Duration> {
// This job runs every hour, so having it running it for 10 minutes is fine
Some(Duration::from_mins(10))
Some(Duration::from_secs(10 * 60))
}
}
@@ -115,7 +115,7 @@ impl RunnableJob for CleanupExpiredOAuthAccessTokensJob {
}
fn timeout(&self) -> Option<Duration> {
Some(Duration::from_mins(1))
Some(Duration::from_secs(60))
}
}
@@ -162,7 +162,7 @@ impl RunnableJob for CleanupRevokedOAuthRefreshTokensJob {
fn timeout(&self) -> Option<Duration> {
// This job runs every hour, so having it running it for 10 minutes is fine
Some(Duration::from_mins(10))
Some(Duration::from_secs(10 * 60))
}
}
@@ -209,6 +209,6 @@ impl RunnableJob for CleanupConsumedOAuthRefreshTokensJob {
fn timeout(&self) -> Option<Duration> {
// This job runs every hour, so having it running it for 10 minutes is fine
Some(Duration::from_mins(10))
Some(Duration::from_secs(10 * 60))
}
}
+3 -3
View File
@@ -69,7 +69,7 @@ impl RunnableJob for CleanupUserRegistrationsJob {
fn timeout(&self) -> Option<Duration> {
// This job runs every hour, so having it running it for 10 minutes is fine
Some(Duration::from_mins(10))
Some(Duration::from_secs(10 * 60))
}
}
@@ -122,7 +122,7 @@ impl RunnableJob for CleanupUserRecoverySessionsJob {
fn timeout(&self) -> Option<Duration> {
// This job runs every hour, so having it running it for 10 minutes is fine
Some(Duration::from_mins(10))
Some(Duration::from_secs(10 * 60))
}
}
@@ -176,6 +176,6 @@ impl RunnableJob for CleanupUserEmailAuthenticationsJob {
fn timeout(&self) -> Option<Duration> {
// This job runs every hour, so having it running it for 10 minutes is fine
Some(Duration::from_mins(10))
Some(Duration::from_secs(10 * 60))
}
}
+1 -1
View File
@@ -526,7 +526,7 @@ impl Object for IncludeAsset {
// When a JSON is included at the top level (a translation), we preload it
let src = main.src(assets_base);
if tracker.mark_preloaded(&src) {
writeln!(output, r#"<link rel="preload" href="{src}" as="fetch" />"#).unwrap();
writeln!(output, r#"<link rel="preload" href="{src}" as="fetch" />"#,).unwrap();
}
}