Clippy fixes

This commit is contained in:
mdecimus
2025-08-18 11:44:58 +01:00
parent d6531be012
commit e10aa551eb
102 changed files with 1336 additions and 1411 deletions

View File

@@ -504,33 +504,31 @@ impl AssertResult for Vec<String> {
}
fn into_response_code(self) -> String {
if let Some((_, code)) = self.last().unwrap().split_once('[') {
if let Some((code, _)) = code.split_once(']') {
return code.to_string();
}
if let Some((_, code)) = self.last().unwrap().split_once('[')
&& let Some((code, _)) = code.split_once(']')
{
return code.to_string();
}
panic!("No response code found in {:?}", self.last().unwrap());
}
fn into_append_uid(self) -> String {
if let Some((_, code)) = self.last().unwrap().split_once("[APPENDUID ") {
if let Some((code, _)) = code.split_once(']') {
if let Some((_, uid)) = code.split_once(' ') {
return uid.to_string();
}
}
if let Some((_, code)) = self.last().unwrap().split_once("[APPENDUID ")
&& let Some((code, _)) = code.split_once(']')
&& let Some((_, uid)) = code.split_once(' ')
{
return uid.to_string();
}
panic!("No APPENDUID found in {:?}", self.last().unwrap());
}
fn into_copy_uid(self) -> String {
for line in &self {
if let Some((_, code)) = line.split_once("[COPYUID ") {
if let Some((code, _)) = code.split_once(']') {
if let Some((_, uid)) = code.rsplit_once(' ') {
return uid.to_string();
}
}
if let Some((_, code)) = line.split_once("[COPYUID ")
&& let Some((code, _)) = code.split_once(']')
&& let Some((_, uid)) = code.rsplit_once(' ')
{
return uid.to_string();
}
}
panic!("No COPYUID found in {:?}", self);

View File

@@ -72,10 +72,10 @@ impl AssertConfig for utils::config::Config {
pub fn enable_logging() {
use common::config::telemetry::Telemetry;
if let Ok(level) = std::env::var("LOG") {
if !Collector::is_enabled() {
Telemetry::test_tracer(level.parse().expect("Invalid log level"));
}
if let Ok(level) = std::env::var("LOG")
&& !Collector::is_enabled()
{
Telemetry::test_tracer(level.parse().expect("Invalid log level"));
}
}

View File

@@ -772,7 +772,7 @@ impl ParseConfigValue for Policy {
fn html_tokens() {
for (input, expected) in [
(
concat!("<html>hello<br/>world<br/></html>"),
"<html>hello<br/>world<br/></html>",
vec![
HtmlToken::StartTag {
name: 1819112552,
@@ -799,7 +799,7 @@ fn html_tokens() {
],
),
(
concat!("<html>using &lt;><br/></html>"),
"<html>using &lt;><br/></html>",
vec![
HtmlToken::StartTag {
name: 1819112552,
@@ -818,7 +818,7 @@ fn html_tokens() {
],
),
(
concat!("test <not br/>tag<br />"),
"test <not br/>tag<br />",
vec![
HtmlToken::Text {
text: "test".to_compact_string(),
@@ -839,7 +839,7 @@ fn html_tokens() {
],
),
(
concat!("<>< ><tag\n/>>hello world< br \n />"),
"<>< ><tag\n/>>hello world< br \n />",
vec![
HtmlToken::StartTag {
name: 6775156,

View File

@@ -200,10 +200,11 @@ fn next_event_after(message: &Message, queue: Option<QueueName>, instant: u64) -
{
next_event = rcpt.notify.due.into();
}
if let Some(expires) = rcpt.expiration_time(message.created) {
if expires > instant && next_event.as_ref().is_none_or(|ne| expires.lt(ne)) {
next_event = expires.into();
}
if let Some(expires) = rcpt.expiration_time(message.created)
&& expires > instant
&& next_event.as_ref().is_none_or(|ne| expires.lt(ne))
{
next_event = expires.into();
}
}
}