mirror of
https://github.com/uutils/coreutils.git
synced 2026-06-10 15:48:22 -07:00
use 'char' instead of 'str' for single character patterns
This commit is contained in:
@@ -275,7 +275,7 @@ impl Pinky {
|
||||
if let Some(n) = gecos.find(',') {
|
||||
gecos.truncate(n + 1);
|
||||
}
|
||||
print!(" {:<19.19}", gecos.replace("&", &pw.name.capitalize()));
|
||||
print!(" {:<19.19}", gecos.replace('&', &pw.name.capitalize()));
|
||||
} else {
|
||||
print!(" {:19}", " ???");
|
||||
}
|
||||
@@ -339,7 +339,7 @@ impl Pinky {
|
||||
for u in &self.names {
|
||||
print!("Login name: {:<28}In real life: ", u);
|
||||
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 {
|
||||
print!("Directory: {:<29}", pw.user_dir);
|
||||
println!("Shell: {}", pw.user_shell);
|
||||
|
||||
@@ -505,7 +505,7 @@ mod tests {
|
||||
let normalized = normalize_path(path);
|
||||
assert_eq!(
|
||||
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!")
|
||||
);
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ fn test_capitalize() {
|
||||
fn test_long_format() {
|
||||
let login = "root";
|
||||
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!());
|
||||
ts.ucmd().arg("-l").arg(login).succeeds().stdout_is(format!(
|
||||
"Login name: {:<28}In real life: {}\nDirectory: {:<29}Shell: {}\n\n",
|
||||
|
||||
Reference in New Issue
Block a user