Skip to content

Commit 5ea922a

Browse files
committed
Various cleanups
1 parent 85fb054 commit 5ea922a

File tree

4 files changed

+22
-21
lines changed

4 files changed

+22
-21
lines changed

src/librustc_mir/borrow_check/conflict_errors.rs

+6-12
Original file line numberDiff line numberDiff line change
@@ -1256,23 +1256,17 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
12561256
Applicability::MachineApplicable,
12571257
);
12581258

1259-
match category {
1260-
ConstraintCategory::Return => {
1261-
err.span_note(constraint_span, "closure is returned here");
1262-
}
1263-
ConstraintCategory::OpaqueType => {
1264-
err.span_note(constraint_span, "generator is returned here");
1265-
}
1259+
let msg = match category {
1260+
ConstraintCategory::Return => "closure is returned here".to_string(),
1261+
ConstraintCategory::OpaqueType => "generator is returned here".to_string(),
12661262
ConstraintCategory::CallArgument => {
12671263
fr_name.highlight_region_name(&mut err);
1268-
err.span_note(
1269-
constraint_span,
1270-
&format!("function requires argument type to outlive `{}`", fr_name),
1271-
);
1264+
format!("function requires argument type to outlive `{}`", fr_name)
12721265
}
12731266
_ => bug!("report_escaping_closure_capture called with unexpected constraint \
12741267
category: `{:?}`", category),
1275-
}
1268+
};
1269+
err.span_note(constraint_span, &msg);
12761270
err
12771271
}
12781272

src/librustc_parse/parser/item.rs

+11-6
Original file line numberDiff line numberDiff line change
@@ -490,9 +490,12 @@ impl<'a> Parser<'a> {
490490
}
491491

492492
/// Parses a macro invocation inside a `trait`, `impl` or `extern` block.
493-
fn parse_assoc_macro_invoc(&mut self, item_kind: &str, vis: Option<&Visibility>,
494-
at_end: &mut bool) -> PResult<'a, Option<Mac>>
495-
{
493+
fn parse_assoc_macro_invoc(
494+
&mut self,
495+
item_kind: &str,
496+
vis: Option<&Visibility>,
497+
at_end: &mut bool,
498+
) -> PResult<'a, Option<Mac>> {
496499
if self.token.is_path_start() &&
497500
!(self.is_async_fn() && self.token.span.rust_2015()) {
498501
let prev_span = self.prev_span;
@@ -531,9 +534,11 @@ impl<'a> Parser<'a> {
531534
}
532535
}
533536

534-
fn missing_assoc_item_kind_err(&self, item_type: &str, prev_span: Span)
535-
-> DiagnosticBuilder<'a>
536-
{
537+
fn missing_assoc_item_kind_err(
538+
&self,
539+
item_type: &str,
540+
prev_span: Span,
541+
) -> DiagnosticBuilder<'a> {
537542
let expected_kinds = if item_type == "extern" {
538543
"missing `fn`, `type`, or `static`"
539544
} else {

src/librustc_resolve/resolve_imports.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -1160,8 +1160,10 @@ impl<'a, 'b> ImportResolver<'a, 'b> {
11601160
.emit();
11611161
} else {
11621162
let msg = format!("`{}` is private, and cannot be re-exported", ident);
1163-
let note_msg =
1164-
format!("consider marking `{}` as `pub` in the imported module", ident);
1163+
let note_msg = format!(
1164+
"consider marking `{}` as `pub` in the imported module",
1165+
ident,
1166+
);
11651167
struct_span_err!(self.r.session, directive.span, E0364, "{}", &msg)
11661168
.span_note(directive.span, &note_msg)
11671169
.emit();

src/libsyntax_ext/proc_macro_harness.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ impl<'a> Visitor<'a> for CollectProcMacros<'a> {
270270
};
271271

272272
self.handler.struct_span_err(attr.span, &msg)
273-
.span_note(prev_attr.span, "previous attribute here")
273+
.span_label(prev_attr.span, "previous attribute here")
274274
.emit();
275275

276276
return;

0 commit comments

Comments
 (0)