diff --git a/src/librustc_mir/borrow_check/conflict_errors.rs b/src/librustc_mir/borrow_check/conflict_errors.rs index ebc25138a06..b78d3475a41 100644 --- a/src/librustc_mir/borrow_check/conflict_errors.rs +++ b/src/librustc_mir/borrow_check/conflict_errors.rs @@ -1256,23 +1256,17 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> { Applicability::MachineApplicable, ); - match category { - ConstraintCategory::Return => { - err.span_note(constraint_span, "closure is returned here"); - } - ConstraintCategory::OpaqueType => { - err.span_note(constraint_span, "generator is returned here"); - } + let msg = match category { + ConstraintCategory::Return => "closure is returned here".to_string(), + ConstraintCategory::OpaqueType => "generator is returned here".to_string(), ConstraintCategory::CallArgument => { fr_name.highlight_region_name(&mut err); - err.span_note( - constraint_span, - &format!("function requires argument type to outlive `{}`", fr_name), - ); + format!("function requires argument type to outlive `{}`", fr_name) } _ => bug!("report_escaping_closure_capture called with unexpected constraint \ category: `{:?}`", category), - } + }; + err.span_note(constraint_span, &msg); err } diff --git a/src/librustc_parse/parser/item.rs b/src/librustc_parse/parser/item.rs index 20b96d5cd62..199125125c6 100644 --- a/src/librustc_parse/parser/item.rs +++ b/src/librustc_parse/parser/item.rs @@ -490,9 +490,12 @@ impl<'a> Parser<'a> { } /// Parses a macro invocation inside a `trait`, `impl` or `extern` block. - fn parse_assoc_macro_invoc(&mut self, item_kind: &str, vis: Option<&Visibility>, - at_end: &mut bool) -> PResult<'a, Option> - { + fn parse_assoc_macro_invoc( + &mut self, + item_kind: &str, + vis: Option<&Visibility>, + at_end: &mut bool, + ) -> PResult<'a, Option> { if self.token.is_path_start() && !(self.is_async_fn() && self.token.span.rust_2015()) { let prev_span = self.prev_span; @@ -531,9 +534,11 @@ impl<'a> Parser<'a> { } } - fn missing_assoc_item_kind_err(&self, item_type: &str, prev_span: Span) - -> DiagnosticBuilder<'a> - { + fn missing_assoc_item_kind_err( + &self, + item_type: &str, + prev_span: Span, + ) -> DiagnosticBuilder<'a> { let expected_kinds = if item_type == "extern" { "missing `fn`, `type`, or `static`" } else { diff --git a/src/librustc_resolve/resolve_imports.rs b/src/librustc_resolve/resolve_imports.rs index 5c8e7909631..3ad53737f49 100644 --- a/src/librustc_resolve/resolve_imports.rs +++ b/src/librustc_resolve/resolve_imports.rs @@ -1160,8 +1160,10 @@ impl<'a, 'b> ImportResolver<'a, 'b> { .emit(); } else { let msg = format!("`{}` is private, and cannot be re-exported", ident); - let note_msg = - format!("consider marking `{}` as `pub` in the imported module", ident); + let note_msg = format!( + "consider marking `{}` as `pub` in the imported module", + ident, + ); struct_span_err!(self.r.session, directive.span, E0364, "{}", &msg) .span_note(directive.span, ¬e_msg) .emit(); diff --git a/src/libsyntax_ext/proc_macro_harness.rs b/src/libsyntax_ext/proc_macro_harness.rs index fbded7dc130..604400c3cc2 100644 --- a/src/libsyntax_ext/proc_macro_harness.rs +++ b/src/libsyntax_ext/proc_macro_harness.rs @@ -270,7 +270,7 @@ impl<'a> Visitor<'a> for CollectProcMacros<'a> { }; self.handler.struct_span_err(attr.span, &msg) - .span_note(prev_attr.span, "previous attribute here") + .span_label(prev_attr.span, "previous attribute here") .emit(); return;