[tests] Lint: collapse nested ifs, format panic message
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user