Skip to content

Commit

Permalink
Unify nix dependency and remove unnecessary clone
Browse files Browse the repository at this point in the history
  • Loading branch information
onalante-msft committed Jan 6, 2022
1 parent dbb0bd2 commit b324ed5
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 16 deletions.
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion aziotctl/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ foreign-types-shared = "0.1"
hyper = "0.14"
hyper-openssl = "0.9"
libc = "0.2"
nix = "0.22"
nix = "0.23"
log = "0.4"
openssl = "0.10"
serde = { version = "1", features = ["derive"] }
Expand Down
2 changes: 1 addition & 1 deletion aziotctl/aziotctl-common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ edition = "2021"
anyhow = "1.0.34"
base64 = "0.13"
log = "0.4"
nix = "0.22"
nix = "0.23"
serde = { version = "1", features = ["derive"] }
serde_json = "1"
serde_with = "1"
Expand Down
18 changes: 7 additions & 11 deletions aziotctl/aziotctl-common/src/host_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ impl Default for OsInfo {
bitness: BITNESS,
};

let os_release = fs::File::open("/etc/os-release")
.or_else(|_| fs::File::open("/usr/lib/os-release"));
let os_release =
fs::File::open("/etc/os-release").or_else(|_| fs::File::open("/usr/lib/os-release"));

if let Ok(os_release) = os_release {
let os_release = io::BufReader::new(os_release);
Expand All @@ -93,17 +93,16 @@ impl Default for OsInfo {
match parse_shell_line(line) {
Some(("ID", value)) => {
result.id = Some(value.to_owned());
},
}
Some(("VERSION_ID", value)) => {
result.version_id = Some(value.to_owned());
},
}
Some(("PRETTY_NAME", value)) => {
result.pretty_name = Some(value.to_owned());
},
}
_ => (),
};
}
else {
} else {
break;
}
}
Expand Down Expand Up @@ -138,8 +137,5 @@ fn try_read_dmi(entry: &'static str) -> Option<String> {

let bytes = fs::read(path).ok()?;

Some(String::from_utf8(bytes)
.ok()?
.trim()
.to_owned())
Some(std::str::from_utf8(&bytes).ok()?.trim().to_owned())
}
2 changes: 1 addition & 1 deletion http-common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ hyper-openssl = { version = "0.9" }
hyper-proxy = { version = "0.9", features = ["openssl-tls"], default-features = false }
libc = "0.2"
log = "0.4"
nix = "0.22"
nix = "0.23"
openssl = { version = "0.10" }
openssl-sys = { version = "0.9" }
percent-encoding = "2"
Expand Down

0 comments on commit b324ed5

Please sign in to comment.