mirror of
https://github.com/faas-rs/faasd-in-rust.git
synced 2025-06-18 12:06:35 +00:00
fix(fmt & dep): clippy & hakari
This commit is contained in:
@ -6,4 +6,5 @@ edition = "2024"
|
||||
# authors.workspace = true
|
||||
|
||||
[dependencies]
|
||||
serde_json = "1.0"
|
||||
serde_json = "1.0"
|
||||
my-workspace-hack = { version = "0.1", path = "../my-workspace-hack" }
|
@ -104,14 +104,12 @@ pub fn create_cni_network(cid: String, ns: String) -> Result<(String, String), E
|
||||
};
|
||||
if let Some(ips) = json.get("ips").and_then(|ips| ips.as_array()) {
|
||||
if let Some(first_ip) = ips
|
||||
.get(0)
|
||||
.first()
|
||||
.and_then(|ip| ip.get("address"))
|
||||
.and_then(|addr| addr.as_str())
|
||||
{
|
||||
ip = first_ip.to_string();
|
||||
} else {
|
||||
}
|
||||
} else {
|
||||
}
|
||||
}
|
||||
Err(e) => {
|
||||
@ -142,14 +140,11 @@ pub fn delete_cni_network(ns: &str, cid: &str) {
|
||||
}
|
||||
|
||||
fn dir_exists(dirname: &Path) -> bool {
|
||||
path_exists(dirname).map_or(false, |info| info.is_dir())
|
||||
path_exists(dirname).is_some_and(|info| info.is_dir())
|
||||
}
|
||||
|
||||
fn path_exists(path: &Path) -> Option<fs::Metadata> {
|
||||
match fs::metadata(path) {
|
||||
Ok(metadata) => Some(metadata),
|
||||
Err(_) => None,
|
||||
}
|
||||
fs::metadata(path).ok()
|
||||
}
|
||||
|
||||
#[allow(unused)]
|
||||
|
Reference in New Issue
Block a user