mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 11:37:44 +00:00
use 'char' instead of 'str' for single character patterns
This commit is contained in:
parent
5af66753af
commit
f2074140ec
3 changed files with 4 additions and 4 deletions
|
@ -275,7 +275,7 @@ impl Pinky {
|
||||||
if let Some(n) = gecos.find(',') {
|
if let Some(n) = gecos.find(',') {
|
||||||
gecos.truncate(n + 1);
|
gecos.truncate(n + 1);
|
||||||
}
|
}
|
||||||
print!(" {:<19.19}", gecos.replace("&", &pw.name.capitalize()));
|
print!(" {:<19.19}", gecos.replace('&', &pw.name.capitalize()));
|
||||||
} else {
|
} else {
|
||||||
print!(" {:19}", " ???");
|
print!(" {:19}", " ???");
|
||||||
}
|
}
|
||||||
|
@ -339,7 +339,7 @@ impl Pinky {
|
||||||
for u in &self.names {
|
for u in &self.names {
|
||||||
print!("Login name: {:<28}In real life: ", u);
|
print!("Login name: {:<28}In real life: ", u);
|
||||||
if let Ok(pw) = Passwd::locate(u.as_str()) {
|
if let Ok(pw) = Passwd::locate(u.as_str()) {
|
||||||
println!(" {}", pw.user_info.replace("&", &pw.name.capitalize()));
|
println!(" {}", pw.user_info.replace('&', &pw.name.capitalize()));
|
||||||
if self.include_home_and_shell {
|
if self.include_home_and_shell {
|
||||||
print!("Directory: {:<29}", pw.user_dir);
|
print!("Directory: {:<29}", pw.user_dir);
|
||||||
println!("Shell: {}", pw.user_shell);
|
println!("Shell: {}", pw.user_shell);
|
||||||
|
|
|
@ -505,7 +505,7 @@ mod tests {
|
||||||
let normalized = normalize_path(path);
|
let normalized = normalize_path(path);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
test.test
|
test.test
|
||||||
.replace("/", std::path::MAIN_SEPARATOR.to_string().as_str()),
|
.replace('/', std::path::MAIN_SEPARATOR.to_string().as_str()),
|
||||||
normalized.to_str().expect("Path is not valid utf-8!")
|
normalized.to_str().expect("Path is not valid utf-8!")
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,7 @@ fn test_capitalize() {
|
||||||
fn test_long_format() {
|
fn test_long_format() {
|
||||||
let login = "root";
|
let login = "root";
|
||||||
let pw: Passwd = Passwd::locate(login).unwrap();
|
let pw: Passwd = Passwd::locate(login).unwrap();
|
||||||
let real_name = pw.user_info.replace("&", &pw.name.capitalize());
|
let real_name = pw.user_info.replace('&', &pw.name.capitalize());
|
||||||
let ts = TestScenario::new(util_name!());
|
let ts = TestScenario::new(util_name!());
|
||||||
ts.ucmd().arg("-l").arg(login).succeeds().stdout_is(format!(
|
ts.ucmd().arg("-l").arg(login).succeeds().stdout_is(format!(
|
||||||
"Login name: {:<28}In real life: {}\nDirectory: {:<29}Shell: {}\n\n",
|
"Login name: {:<28}In real life: {}\nDirectory: {:<29}Shell: {}\n\n",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue