]> git.lizzy.rs Git - rust.git/blobdiff - src/librustc_passes/ast_validation.rs
Remove need for &format!(...) or &&"" dances in `span_label` calls
[rust.git] / src / librustc_passes / ast_validation.rs
index 8c45a6669453354fdfcbe5b9202502f2f9a7d545..d7fee7f3110f4cdb90e197f16dcfcab5fc0f0b63 100644 (file)
@@ -55,7 +55,7 @@ fn invalid_visibility(&self, vis: &Visibility, span: Span, note: Option<&str>) {
                                            E0449,
                                            "unnecessary visibility qualifier");
             if vis == &Visibility::Public {
-                err.span_label(span, &format!("`pub` not needed here"));
+                err.span_label(span, "`pub` not needed here");
             }
             if let Some(note) = note {
                 err.note(note);
@@ -80,7 +80,7 @@ fn check_trait_fn_not_const(&self, constness: Spanned<Constness>) {
             Constness::Const => {
                 struct_span_err!(self.session, constness.span, E0379,
                                  "trait fns cannot be declared const")
-                    .span_label(constness.span, &format!("trait fns cannot be const"))
+                    .span_label(constness.span, "trait fns cannot be const")
                     .emit();
             }
             _ => {}
@@ -272,7 +272,7 @@ fn visit_foreign_item(&mut self, fi: &'a ForeignItem) {
                                                    E0130,
                                                    "patterns aren't allowed in foreign function \
                                                     declarations");
-                    err.span_label(span, &format!("pattern not allowed in foreign function"));
+                    err.span_label(span, "pattern not allowed in foreign function");
                     if is_recent {
                         err.span_note(span,
                                       "this is a recent error, see issue #35203 for more details");