[tests] Lint: collapse nested ifs, format panic message

This commit is contained in:
2026-11-07 15:03:08 +01:00
parent c14fb2dea6
commit e7fa5f57ec
2 changed files with 12 additions and 9 deletions
+8 -8
View File
@@ -182,10 +182,10 @@ enum Guard {
impl Drop for Target {
fn drop(&mut self) {
if let Guard::Edge(stop) = &mut self._guard {
if let Some(s) = stop.take() {
let _ = s.send(());
}
if let Guard::Edge(stop) = &mut self._guard
&& let Some(s) = stop.take()
{
let _ = s.send(());
}
}
}
@@ -693,10 +693,10 @@ pub fn break_caddy(json: &str) -> String {
fn walk(v: &mut serde_json::Value) {
match v {
serde_json::Value::Object(m) => {
if m.get("handler").and_then(|h| h.as_str()) == Some("reverse_proxy") {
if let Some(h) = m.get_mut("headers").and_then(|h| h.as_object_mut()) {
h.remove("response");
}
if m.get("handler").and_then(|h| h.as_str()) == Some("reverse_proxy")
&& let Some(h) = m.get_mut("headers").and_then(|h| h.as_object_mut())
{
h.remove("response");
}
m.values_mut().for_each(walk);
}