Skip to content

Commit fc51386

Browse files
committed
fix some clippy warnings in librustc_errors
1 parent 0ed1ec9 commit fc51386

File tree

3 files changed

+6
-8
lines changed

3 files changed

+6
-8
lines changed

Diff for: src/librustc_errors/diagnostic_builder.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -192,8 +192,8 @@ impl<'a> Debug for DiagnosticBuilder<'a> {
192192
}
193193
}
194194

195-
/// Destructor bomb - a DiagnosticBuilder must be either emitted or cancelled or
196-
/// we emit a bug.
195+
/// Destructor bomb - a `DiagnosticBuilder` must be either emitted or cancelled
196+
/// or we emit a bug.
197197
impl<'a> Drop for DiagnosticBuilder<'a> {
198198
fn drop(&mut self) {
199199
if !panicking() && !self.cancelled() {

Diff for: src/librustc_errors/emitter.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -1296,10 +1296,8 @@ impl Write for BufferedWriter {
12961296
}
12971297
fn flush(&mut self) -> io::Result<()> {
12981298
let mut stderr = io::stderr();
1299-
let result = (|| {
1300-
stderr.write_all(&self.buffer)?;
1301-
stderr.flush()
1302-
})();
1299+
let result = stderr.write_all(&self.buffer)
1300+
.and_then(|_| stderr.flush());
13031301
self.buffer.clear();
13041302
result
13051303
}

Diff for: src/librustc_errors/lib.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@ impl Handler {
383383
pub fn span_fatal<S: Into<MultiSpan>>(&self, sp: S, msg: &str) -> FatalError {
384384
self.emit(&sp.into(), msg, Fatal);
385385
self.panic_if_treat_err_as_bug();
386-
return FatalError;
386+
FatalError
387387
}
388388
pub fn span_fatal_with_code<S: Into<MultiSpan>>(&self,
389389
sp: S,
@@ -392,7 +392,7 @@ impl Handler {
392392
-> FatalError {
393393
self.emit_with_code(&sp.into(), msg, code, Fatal);
394394
self.panic_if_treat_err_as_bug();
395-
return FatalError;
395+
FatalError
396396
}
397397
pub fn span_err<S: Into<MultiSpan>>(&self, sp: S, msg: &str) {
398398
self.emit(&sp.into(), msg, Error);

0 commit comments

Comments
 (0)