Skip to content
This repository was archived by the owner on Jan 6, 2023. It is now read-only.

Commit f38f3d5

Browse files
author
Luca Bruno
authored
Merge pull request #35 from lucab/ups/cargo-update-users
cargo: update users to 0.8
2 parents 9ca7ea4 + 3985ad4 commit f38f3d5

File tree

3 files changed

+36
-33
lines changed

3 files changed

+36
-33
lines changed

Cargo.lock

Lines changed: 26 additions & 26 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,16 @@ license = "Apache-2.0"
66
repository = "https://github.com/coreos/update-ssh-keys"
77
documentation = "https://docs.rs/update-ssh-keys"
88
description = "A tool for managing authorized SSH keys"
9-
version = "0.3.1-alpha.0"
9+
version = "0.4.0-alpha.0"
1010

1111
[dependencies]
12+
# Private dependencies.
1213
clap = "2.26"
13-
error-chain = { version = "0.12", default-features = false }
1414
fs2 = "0.4"
15+
# Public dependencies, exposed through library API.
16+
error-chain = { version = "0.12", default-features = false }
1517
openssh-keys = "0.3"
16-
users = "0.7"
18+
users = "0.8"
1719

1820
[[bin]]
1921
name = "update-ssh-keys"

src/main.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -140,13 +140,14 @@ fn run() -> Result<()> {
140140
}
141141

142142
fn config() -> Result<Config> {
143-
// get the default user by figuring out the current user if the current user
144-
// is root (or doesn't exist) then use core
143+
// get the default user by figuring out the current user; if the current user
144+
// is root (or doesn't exist) then use 'core'.
145145
let default_user = get_current_username().map_or("core".into(), |u| {
146-
if u == "root" {
146+
let name = u.to_string_lossy();
147+
if name == "root" {
147148
"core".into()
148149
} else {
149-
u
150+
name.into_owned()
150151
}
151152
});
152153

0 commit comments

Comments
 (0)