clippy --fix

This commit is contained in:
Astro 2023-06-05 22:42:44 +02:00
parent e27d772c3b
commit 0aaae85873
3 changed files with 6 additions and 11 deletions

View File

@ -27,11 +27,6 @@
''cargo clippy --all --all-features --tests -- \ ''cargo clippy --all --all-features --tests -- \
-D clippy::pedantic \ -D clippy::pedantic \
-D warnings \ -D warnings \
-A clippy::module-name-repetitions \
-A clippy::too-many-lines \
-A clippy::cast-possible-wrap \
-A clippy::cast-possible-truncation \
-A clippy::nonminimal_bool \
-A clippy::unused-async'' -A clippy::unused-async''
]; ];
meta.description = "Send Prometheus alerts to XMPP Multi-User Chatrooms"; meta.description = "Send Prometheus alerts to XMPP Multi-User Chatrooms";

View File

@ -24,7 +24,7 @@ impl Handle {
pub async fn run(jid: String, password: String, muc_jid: String) -> Handle { pub async fn run(jid: String, password: String, muc_jid: String) -> Handle {
let muc_jid: FullJid = match FullJid::from_str(&muc_jid) { let muc_jid: FullJid = match FullJid::from_str(&muc_jid) {
Ok(jid) => jid, Ok(jid) => jid,
Err(err) => panic!("MUC Jid invalid: {:?}", err), Err(err) => panic!("MUC Jid invalid: {err:?}"),
}; };
let (tx, mut rx) = mpsc::channel(1); let (tx, mut rx) = mpsc::channel(1);
let handle = Handle { let handle = Handle {
@ -36,7 +36,7 @@ pub async fn run(jid: String, password: String, muc_jid: String) -> Handle {
loop { loop {
match client.next().await { match client.next().await {
Some(Event::Online { .. }) => { Some(Event::Online { .. }) => {
println!("XMPP client now online at {}", jid); println!("XMPP client now online at {jid}");
let packet = Packet::Stanza(make_join_presence(muc_jid.clone())); let packet = Packet::Stanza(make_join_presence(muc_jid.clone()));
client.send(packet).await client.send(packet).await
.unwrap(); .unwrap();
@ -56,13 +56,13 @@ pub async fn run(jid: String, password: String, muc_jid: String) -> Handle {
Ok(presence) => { Ok(presence) => {
if presence.from == Some(Jid::Full(muc_jid.clone())) { if presence.from == Some(Jid::Full(muc_jid.clone())) {
if presence.type_ == PresenceType::Error { if presence.type_ == PresenceType::Error {
println!("Failed to enter MUC {:?}", muc_jid); println!("Failed to enter MUC {muc_jid:?}");
} else { } else {
println!("Entered MUC {:?}", muc_jid); println!("Entered MUC {muc_jid:?}");
} }
} }
}, },
Err(err) => println!("Received invalid presence: {:?}", err), Err(err) => println!("Received invalid presence: {err:?}"),
} }
} }
systemd::daemon::notify(false, [(systemd::daemon::STATE_WATCHDOG, "1")].iter()) systemd::daemon::notify(false, [(systemd::daemon::STATE_WATCHDOG, "1")].iter())

View File

@ -34,7 +34,7 @@ impl Payload {
jabber.send_message(message).await; jabber.send_message(message).await;
} }
Err(e) => { Err(e) => {
error_message = Some(format!("{}", e)); error_message = Some(format!("{e}"));
} }
} }