rust-exa/0001-Bump-users-crate-versi...

47 lines
1.7 KiB
Diff
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

From 058b4a57bdb1e25cbdacc0fbd1eefc09bc5f1e95 Mon Sep 17 00:00:00 2001
From: Benjamin Sago <ogham@bsago.me>
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 were at it. Fixes #442
---
src/output/render/groups.rs | 4 ++--
src/output/render/users.rs | 2 +-
4 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/src/output/render/groups.rs b/src/output/render/groups.rs
index 6504e889..a3a25e70 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(&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())
}
}
diff --git a/src/output/render/users.rs b/src/output/render/users.rs
index 75ff4c6f..d7edefac 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<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(),
};