##// END OF EJS Templates
rhg: fix `clippy` warnings...
Antoine Cezar -
r46010:fbc373b7 default
parent child Browse files
Show More
@@ -69,7 +69,7 b' pub struct CommandError {'
69 69
70 70 impl CommandError {
71 71 /// Exist the process with the corresponding exit code.
72 pub fn exit(&self) -> () {
72 pub fn exit(&self) {
73 73 std::process::exit(self.kind.get_exit_code())
74 74 }
75 75
@@ -34,22 +34,18 b' impl Ui {'
34 34 pub fn write_stdout(&self, bytes: &[u8]) -> Result<(), UiError> {
35 35 let mut stdout = self.stdout.lock();
36 36
37 stdout
38 .write_all(bytes)
39 .or_else(|e| handle_stdout_error(e))?;
37 stdout.write_all(bytes).or_else(handle_stdout_error)?;
40 38
41 stdout.flush().or_else(|e| handle_stdout_error(e))
39 stdout.flush().or_else(handle_stdout_error)
42 40 }
43 41
44 42 /// Write bytes to stderr
45 43 pub fn write_stderr(&self, bytes: &[u8]) -> Result<(), UiError> {
46 44 let mut stderr = self.stderr.lock();
47 45
48 stderr
49 .write_all(bytes)
50 .or_else(|e| handle_stderr_error(e))?;
46 stderr.write_all(bytes).or_else(handle_stderr_error)?;
51 47
52 stderr.flush().or_else(|e| handle_stderr_error(e))
48 stderr.flush().or_else(handle_stderr_error)
53 49 }
54 50 }
55 51
@@ -66,14 +62,12 b' impl<W: Write> StdoutBuffer<W> {'
66 62
67 63 /// Write bytes to stdout buffer
68 64 pub fn write_all(&mut self, bytes: &[u8]) -> Result<(), UiError> {
69 self.buf
70 .write_all(bytes)
71 .or_else(|e| handle_stdout_error(e))
65 self.buf.write_all(bytes).or_else(handle_stdout_error)
72 66 }
73 67
74 68 /// Flush bytes to stdout
75 69 pub fn flush(&mut self) -> Result<(), UiError> {
76 self.buf.flush().or_else(|e| handle_stdout_error(e))
70 self.buf.flush().or_else(handle_stdout_error)
77 71 }
78 72 }
79 73
@@ -88,9 +82,9 b' fn handle_stdout_error(error: io::Error)'
88 82
89 83 stderr
90 84 .write_all(&[b"abort: ", error.to_string().as_bytes(), b"\n"].concat())
91 .map_err(|e| UiError::StderrError(e))?;
85 .map_err(UiError::StderrError)?;
92 86
93 stderr.flush().map_err(|e| UiError::StderrError(e))?;
87 stderr.flush().map_err(UiError::StderrError)?;
94 88
95 89 Err(UiError::StdoutError(error))
96 90 }
General Comments 0
You need to be logged in to leave comments. Login now