about summary refs log tree commit diff
path: root/src/librustc_errors
diff options
context:
space:
mode:
authorMazdak Farrokhzad <twingoow@gmail.com>2019-06-27 23:01:09 +0200
committerGitHub <noreply@github.com>2019-06-27 23:01:09 +0200
commit4aa3e27231a705e1aea4347ae78698c81438f1f4 (patch)
treeb545d4f98342098b68903c87e0bfb1795485fc40 /src/librustc_errors
parentbc335d6c16bc7bb9df1e1e2b982aa13963e8ae7c (diff)
parentad62b4203ce3f0bd4c7c348aeabca4f49d5ce075 (diff)
downloadrust-4aa3e27231a705e1aea4347ae78698c81438f1f4.tar.gz
rust-4aa3e27231a705e1aea4347ae78698c81438f1f4.zip
Rollup merge of #62131 - Xanewok:clip-some-nits, r=petrochenkov
libsyntax: Fix some Clippy warnings

When I was working on it before a lot of these popped up in the RLS so I figured I'll send a small patch fixing only the (hopefully) uncontroversial ones.

Others that could be also fixed included also [`clippy::print_with_newline`](https://rust-lang.github.io/rust-clippy/master/index.html#print_with_newline) and [`clippy::cast_lossless`](https://rust-lang.github.io/rust-clippy/master/index.html#cast_lossless). Should I add them as well?

since most of it touches libsyntax...
r? @petrochenkov
Diffstat (limited to 'src/librustc_errors')
-rw-r--r--src/librustc_errors/annotate_snippet_emitter_writer.rs2
-rw-r--r--src/librustc_errors/diagnostic.rs2
-rw-r--r--src/librustc_errors/emitter.rs4
3 files changed, 4 insertions, 4 deletions
diff --git a/src/librustc_errors/annotate_snippet_emitter_writer.rs b/src/librustc_errors/annotate_snippet_emitter_writer.rs
index 7ed2fddf72d..3641d355ef1 100644
--- a/src/librustc_errors/annotate_snippet_emitter_writer.rs
+++ b/src/librustc_errors/annotate_snippet_emitter_writer.rs
@@ -94,7 +94,7 @@ impl<'a>  DiagnosticConverter<'a> {
                     annotation_type: Self::annotation_type_for_level(self.level),
                 }),
                 footer: vec![],
-                slices: slices,
+                slices,
             })
         } else {
             // FIXME(#59346): Is it ok to return None if there's no source_map?
diff --git a/src/librustc_errors/diagnostic.rs b/src/librustc_errors/diagnostic.rs
index fc1fd960c4a..424d7c00383 100644
--- a/src/librustc_errors/diagnostic.rs
+++ b/src/librustc_errors/diagnostic.rs
@@ -388,7 +388,7 @@ impl Diagnostic {
             }],
             msg: msg.to_owned(),
             style: SuggestionStyle::CompletelyHidden,
-            applicability: applicability,
+            applicability,
         });
         self
     }
diff --git a/src/librustc_errors/emitter.rs b/src/librustc_errors/emitter.rs
index fca8298409a..a2717ab7ad8 100644
--- a/src/librustc_errors/emitter.rs
+++ b/src/librustc_errors/emitter.rs
@@ -1339,7 +1339,7 @@ impl EmitterWriter {
         }
 
         let mut dst = self.dst.writable();
-        match write!(dst, "\n") {
+        match writeln!(dst) {
             Err(e) => panic!("failed to emit error: {}", e),
             _ => {
                 match dst.flush() {
@@ -1598,7 +1598,7 @@ fn emit_to_destination(rendered_buffer: &[Vec<StyledString>],
             dst.reset()?;
         }
         if !short_message && (!lvl.is_failure_note() || pos != rendered_buffer.len() - 1) {
-            write!(dst, "\n")?;
+            writeln!(dst)?;
         }
     }
     dst.flush()?;