From 058b4a57bdb1e25cbdacc0fbd1eefc09bc5f1e95 Mon Sep 17 00:00:00 2001 From: Benjamin Sago Date: Fri, 7 Dec 2018 00:59:05 +0000 Subject: [PATCH] Bump users crate version MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit And remove an unnecessary allocation while we’re at it. Fixes #442 --- Cargo.lock | 6 +++--- Cargo.toml | 2 +- src/output/render/groups.rs | 4 ++-- src/output/render/users.rs | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 8fa1906..4e26b49 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -99,7 +99,7 @@ dependencies = [ "term_grid 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", "term_size 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-width 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", - "users 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "users 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", "zoneinfo_compiled 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -404,7 +404,7 @@ dependencies = [ [[package]] name = "users" -version = "0.7.0" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", @@ -522,7 +522,7 @@ dependencies = [ "checksum unicode-width 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "bf3a113775714a22dcb774d8ea3655c53a32debae63a063acc00a91cc586245f" "checksum unreachable 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "382810877fe448991dfc7f0dd6e3ae5d58088fd0ea5e35189655f84e6814fa56" "checksum url 1.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f808aadd8cfec6ef90e4a14eb46f24511824d1ac596b9682703c87056c8678b7" -"checksum users 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "caa2760fcc10a6ae2c2a35d41c5d69827e4663f0d3889ecfb4d60b343f4139df" +"checksum users 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7fed7d0912567d35f88010c23dbaf865e9da8b5227295e8dc0f2fdd109155ab7" "checksum utf8-ranges 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "662fab6525a98beff2921d7f61a39e7d59e0b425ebc7d0d9e66d316e55124122" "checksum vcpkg 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9e0a7d8bed3178a8fb112199d466eeca9ed09a14ba8ad67718179b4fd5487d0b" "checksum void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" diff --git a/Cargo.toml b/Cargo.toml index 2a5020a..c321b62 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -42,7 +42,7 @@ scoped_threadpool = "0.1.*" term_grid = "0.1.6" term_size = "0.3.0" unicode-width = "0.1.4" -users = "0.7" +users = "0.8" zoneinfo_compiled = "0.4.7" [build-dependencies] diff --git a/src/output/render/groups.rs b/src/output/render/groups.rs index 6504e88..a3a25e7 100644 --- a/src/output/render/groups.rs +++ b/src/output/render/groups.rs @@ -19,12 +19,12 @@ impl f::Group { let current_uid = users.get_current_uid(); if let Some(current_user) = users.get_user_by_uid(current_uid) { if current_user.primary_group_id() == group.gid() - || group.members().contains(¤t_user.name().to_owned()) { + || group.members().iter().any(|u| u == current_user.name()) { style = colours.yours(); } } - TextCell::paint(style, group.name().to_owned()) + TextCell::paint(style, group.name().to_string_lossy().into()) } } diff --git a/src/output/render/users.rs b/src/output/render/users.rs index 75ff4c6..d7edefa 100644 --- a/src/output/render/users.rs +++ b/src/output/render/users.rs @@ -9,7 +9,7 @@ use output::cell::TextCell; impl f::User { pub fn render(&self, colours: &C, users: &U) -> TextCell { let user_name = match users.get_user_by_uid(self.0) { - Some(user) => user.name().to_owned(), + Some(user) => user.name().to_string_lossy().into(), None => self.0.to_string(), };