]> git.lizzy.rs Git - rust.git/commitdiff
fix some clippy warnings in librustc_errors
authorAndre Bogus <bogusandre@gmail.com>
Thu, 18 May 2017 23:20:48 +0000 (01:20 +0200)
committerAndre Bogus <bogusandre@gmail.com>
Thu, 18 May 2017 23:20:48 +0000 (01:20 +0200)
src/librustc_errors/diagnostic_builder.rs
src/librustc_errors/emitter.rs
src/librustc_errors/lib.rs

index fc5fd44f091f119d2be004159f2309cb5343150d..0081339a363f73f98ba35168ece1e11833540d49 100644 (file)
@@ -192,8 +192,8 @@ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
     }
 }
 
-/// Destructor bomb - a DiagnosticBuilder must be either emitted or cancelled or
-/// we emit a bug.
+/// Destructor bomb - a `DiagnosticBuilder` must be either emitted or cancelled
+/// or we emit a bug.
 impl<'a> Drop for DiagnosticBuilder<'a> {
     fn drop(&mut self) {
         if !panicking() && !self.cancelled() {
index 03f1b94b169370826395976da0c4fa9cc2f5f787..a9645f9ab7bb2305398a4ff23535cc93ee3d73c7 100644 (file)
@@ -1296,10 +1296,8 @@ fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
     }
     fn flush(&mut self) -> io::Result<()> {
         let mut stderr = io::stderr();
-        let result = (|| {
-            stderr.write_all(&self.buffer)?;
-            stderr.flush()
-        })();
+        let result = stderr.write_all(&self.buffer)
+                           .and_then(|_| stderr.flush());
         self.buffer.clear();
         result
     }
index 7a561e3a9703f82623fa80f28de306a8e9a9882b..c91dc9d87978dedb3c1011792010971c70ab0e29 100644 (file)
@@ -383,7 +383,7 @@ fn panic_if_treat_err_as_bug(&self) {
     pub fn span_fatal<S: Into<MultiSpan>>(&self, sp: S, msg: &str) -> FatalError {
         self.emit(&sp.into(), msg, Fatal);
         self.panic_if_treat_err_as_bug();
-        return FatalError;
+        FatalError
     }
     pub fn span_fatal_with_code<S: Into<MultiSpan>>(&self,
                                                     sp: S,
@@ -392,7 +392,7 @@ pub fn span_fatal_with_code<S: Into<MultiSpan>>(&self,
                                                     -> FatalError {
         self.emit_with_code(&sp.into(), msg, code, Fatal);
         self.panic_if_treat_err_as_bug();
-        return FatalError;
+        FatalError
     }
     pub fn span_err<S: Into<MultiSpan>>(&self, sp: S, msg: &str) {
         self.emit(&sp.into(), msg, Error);