Fix style according to review comments.

This commit is contained in:
Vitaly _Vi Shukela 2018-09-17 02:40:44 +03:00
parent f395072c4d
commit 6ebb9161ea
No known key found for this signature in database
GPG Key ID: C097221D6E03DF68
6 changed files with 36 additions and 20 deletions

View File

@ -432,8 +432,12 @@ impl Session {
}
DiagnosticBuilderMethod::SpanSuggestion(suggestion) => {
let span = span_maybe.expect("span_suggestion_* needs a span");
diag_builder.span_suggestion_with_applicability(span, message, suggestion,
Applicability::Unspecified);
diag_builder.span_suggestion_with_applicability(
span,
message,
suggestion,
Applicability::Unspecified,
);
}
}
}

View File

@ -868,11 +868,19 @@ impl<'a, 'tcx> BorrowckCtxt<'a, 'tcx> {
db.note(fn_closure_msg);
} else {
db.span_suggestion_with_applicability(
sp, msg, suggestion, Applicability::Unspecified);
sp,
msg,
suggestion,
Applicability::Unspecified,
);
}
} else {
db.span_suggestion_with_applicability(
sp, msg, suggestion, Applicability::Unspecified);
sp,
msg,
suggestion,
Applicability::Unspecified,
);
}
}
_ => {
@ -1330,13 +1338,14 @@ impl<'a, 'tcx> BorrowckCtxt<'a, 'tcx> {
&cmt_path_or_string,
capture_span,
Origin::Ast)
.span_suggestion_with_applicability(err.span,
&format!("to force the closure to take ownership of {} \
(and any other referenced variables), \
use the `move` keyword",
cmt_path_or_string),
suggestion,
Applicability::Unspecified,
.span_suggestion_with_applicability(
err.span,
&format!("to force the closure to take ownership of {} \
(and any other referenced variables), \
use the `move` keyword",
cmt_path_or_string),
suggestion,
Applicability::Unspecified,
)
.emit();
self.signal_error();

View File

@ -307,10 +307,10 @@ impl Diagnostic {
suggestion: Vec<(Span, String)>,
) -> &mut Self {
self.multipart_suggestion_with_applicability(
msg,
suggestion,
Applicability::Unspecified
)
msg,
suggestion,
Applicability::Unspecified,
)
}
/// Prints out a message with multiple suggested edits of the code.

View File

@ -172,9 +172,10 @@ impl<'a> DiagnosticBuilder<'a> {
-> &mut Self);
#[deprecated(note = "Use `span_suggestion_short_with_applicability`")]
forward!(pub fn span_suggestion_short(&mut self,
sp: Span,
msg: &str,
forward!(pub fn span_suggestion_short(
&mut self,
sp: Span,
msg: &str,
suggestion: String)
-> &mut Self);

View File

@ -141,7 +141,8 @@ impl<'a, 'hir> Visitor<'hir> for CheckLoopVisitor<'a, 'hir> {
.span_label(e.span,
"can only break with a value inside \
`loop` or breakable block")
.span_suggestion_with_applicability(e.span,
.span_suggestion_with_applicability(
e.span,
&format!("instead, use `break` on its own \
without a value inside this `{}` loop",
kind.name()),

View File

@ -3299,7 +3299,8 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> {
err.span_label(base_span,
"expecting a type here because of type ascription");
if line_sp != line_base_sp {
err.span_suggestion_short_with_applicability(sp,
err.span_suggestion_short_with_applicability(
sp,
"did you mean to use `;` here instead?",
";".to_string(),
Applicability::Unspecified,