From fc513861b114dbe9c9c5440c72838b2623a91bb6 Mon Sep 17 00:00:00 2001 From: Andre Bogus Date: Fri, 19 May 2017 01:20:48 +0200 Subject: [PATCH] fix some clippy warnings in librustc_errors --- src/librustc_errors/diagnostic_builder.rs | 4 ++-- src/librustc_errors/emitter.rs | 6 ++---- src/librustc_errors/lib.rs | 4 ++-- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/librustc_errors/diagnostic_builder.rs b/src/librustc_errors/diagnostic_builder.rs index fc5fd44f091f1..0081339a363f7 100644 --- a/src/librustc_errors/diagnostic_builder.rs +++ b/src/librustc_errors/diagnostic_builder.rs @@ -192,8 +192,8 @@ impl<'a> Debug for DiagnosticBuilder<'a> { } } -/// 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() { diff --git a/src/librustc_errors/emitter.rs b/src/librustc_errors/emitter.rs index 03f1b94b16937..a9645f9ab7bb2 100644 --- a/src/librustc_errors/emitter.rs +++ b/src/librustc_errors/emitter.rs @@ -1296,10 +1296,8 @@ impl Write for BufferedWriter { } 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 } diff --git a/src/librustc_errors/lib.rs b/src/librustc_errors/lib.rs index 7a561e3a9703f..c91dc9d87978d 100644 --- a/src/librustc_errors/lib.rs +++ b/src/librustc_errors/lib.rs @@ -383,7 +383,7 @@ impl Handler { pub fn span_fatal>(&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>(&self, sp: S, @@ -392,7 +392,7 @@ impl Handler { -> FatalError { self.emit_with_code(&sp.into(), msg, code, Fatal); self.panic_if_treat_err_as_bug(); - return FatalError; + FatalError } pub fn span_err>(&self, sp: S, msg: &str) { self.emit(&sp.into(), msg, Error);