[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);
|
||||
}
|
||||
|
||||
@@ -97,7 +97,10 @@ pub fn require_binary(name: &str) -> Option<PathBuf> {
|
||||
None
|
||||
}
|
||||
None => {
|
||||
let var = format!("IANITOR_{}_BIN", name.to_ascii_uppercase().replace('-', "_"));
|
||||
let var = format!(
|
||||
"IANITOR_{}_BIN",
|
||||
name.to_ascii_uppercase().replace('-', "_")
|
||||
);
|
||||
panic!(
|
||||
"`{name}` is needed for this test but was not found on PATH (or ${var}). \
|
||||
In WSL: nix profile add nixpkgs#{name}. Set IANITOR_ALLOW_SKIP=1 to skip instead."
|
||||
|
||||
Reference in New Issue
Block a user