rust-dependencies: switch from `users` to `whoami`
`users` is unmaintained, with the maintainer apparently MIA. `whoami` is a
popular crate that does simple wrapping of platform-specific calls.
This makes the overhead from using `blackbox` lower. It used to be up 10ms
on slower hardware for both calls, now down to <1ms which is always good.
--- a/rust/Cargo.lock Mon Jun 12 23:41:28 2023 +0200
+++ b/rust/Cargo.lock Tue Jun 13 14:35:36 2023 +0200
@@ -1060,8 +1060,8 @@
"logging_timer",
"rayon",
"regex",
- "users",
"which",
+ "whoami",
]
[[package]]
@@ -1242,16 +1242,6 @@
checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b"
[[package]]
-name = "users"
-version = "0.11.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "24cc0f6d6f267b73e5a2cadf007ba8f9bc39c6a6f9666f8cf25ea809a153b032"
-dependencies = [
- "libc",
- "log",
-]
-
-[[package]]
name = "vcpkg"
version = "0.2.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -1347,6 +1337,16 @@
checksum = "1c38c045535d93ec4f0b4defec448e4291638ee608530863b1e2ba115d4fff7f"
[[package]]
+name = "web-sys"
+version = "0.3.60"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "bcda906d8be16e728fd5adc5b729afad4e444e106ab28cd1c7256e54fa61510f"
+dependencies = [
+ "js-sys",
+ "wasm-bindgen",
+]
+
+[[package]]
name = "which"
version = "4.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -1358,6 +1358,16 @@
]
[[package]]
+name = "whoami"
+version = "1.4.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2c70234412ca409cc04e864e89523cb0fc37f5e1344ebed5a3ebf4192b6b9f68"
+dependencies = [
+ "wasm-bindgen",
+ "web-sys",
+]
+
+[[package]]
name = "winapi"
version = "0.3.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
--- a/rust/rhg/Cargo.toml Mon Jun 12 23:41:28 2023 +0200
+++ b/rust/rhg/Cargo.toml Tue Jun 13 14:35:36 2023 +0200
@@ -20,6 +20,6 @@
regex = "1.7.0"
env_logger = "0.9.3"
format-bytes = "0.3.0"
-users = "0.11.0"
+whoami = "1.4"
which = "4.3.0"
rayon = "1.7.0"
--- a/rust/rhg/src/blackbox.rs Mon Jun 12 23:41:28 2023 +0200
+++ b/rust/rhg/src/blackbox.rs Tue Jun 13 14:35:36 2023 +0200
@@ -120,8 +120,7 @@
impl ConfiguredBlackbox<'_> {
fn log(&self, date_time: &DateTime, message: &[u8]) {
let date = format_bytes::Utf8(date_time.format(self.date_format));
- let user = users::get_current_username().map(get_bytes_from_os_str);
- let user = user.as_deref().unwrap_or(b"???");
+ let user = get_bytes_from_os_str(whoami::username_os());
let rev = format_bytes::Utf8(match self.repo.dirstate_parents() {
Ok(parents) if parents.p2 == hg::revlog::node::NULL_NODE => {
format!("{:x}", parents.p1)