Compare commits

...

3 Commits

Author SHA1 Message Date
Astro 0aaae85873 clippy --fix 2023-06-05 22:42:44 +02:00
Astro e27d772c3b Cargo.lock: cargo update --aggressive 2023-06-05 22:19:36 +02:00
Astro b04887ac6d flake.lock: Update
Flake lock file updates:

• Updated input 'naersk':
    'github:nix-community/naersk/d998160d6a076cfe8f9741e56aeec7e267e3e114' (2022-12-15)
  → 'github:nix-community/naersk/88cd22380154a2c36799fe8098888f0f59861a15' (2023-03-23)
• Updated input 'nixpkgs':
    'github:NixOS/nixpkgs/fbcb61bd7eb19914cbd88789c3586a63ff46b72b' (2022-12-16)
  → 'github:NixOS/nixpkgs/31cd1b4afbaf0b1e81272ee9c31d1ab606503aed' (2023-06-05)
• Updated input 'utils':
    'github:numtide/flake-utils/5aed5285a952e0b949eb3ba02c12fa4fcfef535f' (2022-11-02)
  → 'github:numtide/flake-utils/a1720a10a6cfe8234c0e93907ffe81be440f4cef' (2023-05-31)
• Added input 'utils/systems':
    'github:nix-systems/default/da67096a3b9bf56a91d16901293e51ba5b49a27e' (2023-04-09)
2023-06-05 22:00:34 +02:00
5 changed files with 466 additions and 391 deletions

802
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -7,11 +7,11 @@
]
},
"locked": {
"lastModified": 1671096816,
"narHash": "sha256-ezQCsNgmpUHdZANDCILm3RvtO1xH8uujk/+EqNvzIOg=",
"lastModified": 1679567394,
"narHash": "sha256-ZvLuzPeARDLiQUt6zSZFGOs+HZmE+3g4QURc8mkBsfM=",
"owner": "nix-community",
"repo": "naersk",
"rev": "d998160d6a076cfe8f9741e56aeec7e267e3e114",
"rev": "88cd22380154a2c36799fe8098888f0f59861a15",
"type": "github"
},
"original": {
@ -23,11 +23,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1671190014,
"narHash": "sha256-NW385LW4Nj53Hbv3LXr458s4NL2/wcARC8rzK7vSWkw=",
"lastModified": 1685938391,
"narHash": "sha256-96Jw6TbWDLSopt5jqCW8w1Fc1cjQyZlhfBnJ3OZGpME=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "fbcb61bd7eb19914cbd88789c3586a63ff46b72b",
"rev": "31cd1b4afbaf0b1e81272ee9c31d1ab606503aed",
"type": "github"
},
"original": {
@ -44,13 +44,31 @@
"utils": "utils"
}
},
"utils": {
"systems": {
"locked": {
"lastModified": 1667395993,
"narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=",
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1685518550,
"narHash": "sha256-o2d0KcvaXzTrPRIo0kOLV0/QXHhDQ5DTi+OxcjO8xqY=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f",
"rev": "a1720a10a6cfe8234c0e93907ffe81be440f4cef",
"type": "github"
},
"original": {

View File

@ -27,11 +27,6 @@
''cargo clippy --all --all-features --tests -- \
-D clippy::pedantic \
-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''
];
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 {
let muc_jid: FullJid = match FullJid::from_str(&muc_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 handle = Handle {
@ -36,7 +36,7 @@ pub async fn run(jid: String, password: String, muc_jid: String) -> Handle {
loop {
match client.next().await {
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()));
client.send(packet).await
.unwrap();
@ -56,13 +56,13 @@ pub async fn run(jid: String, password: String, muc_jid: String) -> Handle {
Ok(presence) => {
if presence.from == Some(Jid::Full(muc_jid.clone())) {
if presence.type_ == PresenceType::Error {
println!("Failed to enter MUC {:?}", muc_jid);
println!("Failed to enter MUC {muc_jid:?}");
} 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())

View File

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