mirror of
https://github.com/uutils/coreutils
synced 2024-12-14 23:32:39 +00:00
Merge pull request #5004 from sylvestre/case
Remove the auto capitalization of error message
This commit is contained in:
commit
d1aefc2cc8
2 changed files with 2 additions and 11 deletions
|
@ -396,7 +396,7 @@ impl Display for UIoError {
|
||||||
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), std::fmt::Error> {
|
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), std::fmt::Error> {
|
||||||
use std::io::ErrorKind::*;
|
use std::io::ErrorKind::*;
|
||||||
|
|
||||||
let mut message;
|
let message;
|
||||||
let message = if self.inner.raw_os_error().is_some() {
|
let message = if self.inner.raw_os_error().is_some() {
|
||||||
// These are errors that come directly from the OS.
|
// These are errors that come directly from the OS.
|
||||||
// We want to normalize their messages across systems,
|
// We want to normalize their messages across systems,
|
||||||
|
@ -424,7 +424,6 @@ impl Display for UIoError {
|
||||||
// (https://github.com/rust-lang/rust/issues/86442)
|
// (https://github.com/rust-lang/rust/issues/86442)
|
||||||
// are stabilized, we should add them to the match statement.
|
// are stabilized, we should add them to the match statement.
|
||||||
message = strip_errno(&self.inner);
|
message = strip_errno(&self.inner);
|
||||||
capitalize(&mut message);
|
|
||||||
&message
|
&message
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -435,7 +434,6 @@ impl Display for UIoError {
|
||||||
// a file that was not found.
|
// a file that was not found.
|
||||||
// There are also errors with entirely custom messages.
|
// There are also errors with entirely custom messages.
|
||||||
message = self.inner.to_string();
|
message = self.inner.to_string();
|
||||||
capitalize(&mut message);
|
|
||||||
&message
|
&message
|
||||||
};
|
};
|
||||||
if let Some(ctx) = &self.context {
|
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.
|
/// Strip the trailing " (os error XX)" from io error strings.
|
||||||
pub fn strip_errno(err: &std::io::Error) -> String {
|
pub fn strip_errno(err: &std::io::Error) -> String {
|
||||||
let mut msg = err.to_string();
|
let mut msg = err.to_string();
|
||||||
|
|
|
@ -2724,7 +2724,7 @@ fn test_copy_dir_preserve_permissions_inaccessible_file() {
|
||||||
ucmd.args(&["-p", "-R", "d1", "d2"])
|
ucmd.args(&["-p", "-R", "d1", "d2"])
|
||||||
.fails()
|
.fails()
|
||||||
.code_is(1)
|
.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.dir_exists("d2"));
|
||||||
assert!(!at.file_exists("d2/f"));
|
assert!(!at.file_exists("d2/f"));
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue