Quellcode durchsuchen

Bump users crate version

And remove an unnecessary allocation while we’re at it. Fixes #442
Benjamin Sago vor 7 Jahren
Ursprung
Commit
058b4a57bd
4 geänderte Dateien mit 7 neuen und 7 gelöschten Zeilen
  1. 3 3
      Cargo.lock
  2. 1 1
      Cargo.toml
  3. 2 2
      src/output/render/groups.rs
  4. 1 1
      src/output/render/users.rs

+ 3 - 3
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"

+ 1 - 1
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]

+ 2 - 2
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(&current_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())
     }
 }
 

+ 1 - 1
src/output/render/users.rs

@@ -9,7 +9,7 @@ use output::cell::TextCell;
 impl f::User {
     pub fn render<C: Colours, U: Users>(&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(),
         };