diff --git a/src/uucore/src/lib/mods/error.rs b/src/uucore/src/lib/mods/error.rs index e564c7bb5..f0f62569d 100644 --- a/src/uucore/src/lib/mods/error.rs +++ b/src/uucore/src/lib/mods/error.rs @@ -396,7 +396,7 @@ impl Display for UIoError { fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), std::fmt::Error> { use std::io::ErrorKind::*; - let mut message; + let message; let message = if self.inner.raw_os_error().is_some() { // These are errors that come directly from the OS. // We want to normalize their messages across systems, @@ -424,7 +424,6 @@ impl Display for UIoError { // (https://github.com/rust-lang/rust/issues/86442) // are stabilized, we should add them to the match statement. message = strip_errno(&self.inner); - capitalize(&mut message); &message } } @@ -435,7 +434,6 @@ impl Display for UIoError { // a file that was not found. // There are also errors with entirely custom messages. message = self.inner.to_string(); - capitalize(&mut message); &message }; if let Some(ctx) = &self.context { @@ -446,13 +444,6 @@ impl Display for UIoError { } } -/// Capitalize the first character of an ASCII string. -fn capitalize(text: &mut str) { - if let Some(first) = text.get_mut(..1) { - first.make_ascii_uppercase(); - } -} - /// Strip the trailing " (os error XX)" from io error strings. pub fn strip_errno(err: &std::io::Error) -> String { let mut msg = err.to_string(); diff --git a/tests/by-util/test_cp.rs b/tests/by-util/test_cp.rs index fa5845eac..5289489ea 100644 --- a/tests/by-util/test_cp.rs +++ b/tests/by-util/test_cp.rs @@ -2724,7 +2724,7 @@ fn test_copy_dir_preserve_permissions_inaccessible_file() { ucmd.args(&["-p", "-R", "d1", "d2"]) .fails() .code_is(1) - .stderr_only("cp: cannot open 'd1/f' for reading: Permission denied\n"); + .stderr_only("cp: cannot open 'd1/f' for reading: permission denied\n"); assert!(at.dir_exists("d2")); assert!(!at.file_exists("d2/f"));