1
Fork 0

Fix style according to review comments.

This commit is contained in:
Vitaly _Vi Shukela 2018-09-17 02:40:44 +03:00
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,7 +1338,8 @@ impl<'a, 'tcx> BorrowckCtxt<'a, 'tcx> {
&cmt_path_or_string,
capture_span,
Origin::Ast)
.span_suggestion_with_applicability(err.span,
.span_suggestion_with_applicability(
err.span,
&format!("to force the closure to take ownership of {} \
(and any other referenced variables), \
use the `move` keyword",

View file

@ -309,7 +309,7 @@ impl Diagnostic {
self.multipart_suggestion_with_applicability(
msg,
suggestion,
Applicability::Unspecified
Applicability::Unspecified,
)
}

View file

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

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,