Whitespace fix again.

This commit is contained in:
Vitaly _Vi Shukela 2018-09-17 20:13:08 +03:00
parent 15982fe369
commit d0790c490a
No known key found for this signature in database
GPG Key ID: C097221D6E03DF68
14 changed files with 109 additions and 100 deletions

View File

@ -118,8 +118,8 @@ impl<'a, 'gcx, 'tcx> NiceRegionError<'a, 'gcx, 'tcx> {
new_ty.to_string(),
Applicability::Unspecified,
)
.span_label(span, format!("lifetime `{}` required", named))
.emit();
.span_label(span, format!("lifetime `{}` required", named))
.emit();
return Some(ErrorReported);
}

View File

@ -433,11 +433,11 @@ 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,
);
span,
message,
suggestion,
Applicability::Unspecified,
);
}
}
}

View File

@ -868,19 +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,
);
}
}
_ => {
@ -1344,13 +1344,13 @@ impl<'a, 'tcx> BorrowckCtxt<'a, 'tcx> {
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::MachineApplicable,
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::MachineApplicable,
)
.emit();
self.signal_error();

View File

@ -307,9 +307,9 @@ impl Diagnostic {
suggestion: Vec<(Span, String)>,
) -> &mut Self {
self.multipart_suggestion_with_applicability(
msg,
suggestion,
Applicability::Unspecified,
msg,
suggestion,
Applicability::Unspecified,
)
}

View File

@ -142,12 +142,14 @@ impl<'a, 'hir> Visitor<'hir> for CheckLoopVisitor<'a, 'hir> {
"can only break with a value inside \
`loop` or breakable block")
.span_suggestion_with_applicability(
e.span,
&format!("instead, use `break` on its own \
without a value inside this `{}` loop",
kind.name()),
"break".to_string(),
Applicability::MaybeIncorrect,
e.span,
&format!(
"instead, use `break` on its own \
without a value inside this `{}` loop",
kind.name()
),
"break".to_string(),
Applicability::MaybeIncorrect,
)
.emit();
}

View File

@ -3300,11 +3300,11 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> {
"expecting a type here because of type ascription");
if line_sp != line_base_sp {
err.span_suggestion_short_with_applicability(
sp,
"did you mean to use `;` here instead?",
";".to_string(),
Applicability::MaybeIncorrect,
);
sp,
"did you mean to use `;` here instead?",
";".to_string(),
Applicability::MaybeIncorrect,
);
}
break;
} else if snippet.trim().len() != 0 {
@ -4829,8 +4829,12 @@ fn show_candidates(err: &mut DiagnosticBuilder,
*candidate = format!("use {};\n{}", candidate, additional_newline);
}
err.span_suggestions_with_applicability(span, &msg, path_strings,
Applicability::Unspecified);
err.span_suggestions_with_applicability(
span,
&msg,
path_strings,
Applicability::Unspecified,
);
} else {
let mut msg = msg;
msg.push(':');

View File

@ -299,11 +299,12 @@ impl<'a, 'gcx, 'tcx> CastCheck<'tcx> {
err.note("The type information given here is insufficient to check whether \
the pointer cast is valid");
if unknown_cast_to {
err.span_suggestion_short_with_applicability(self.cast_span,
"consider giving more type information",
String::new(),
Applicability::Unspecified,
);
err.span_suggestion_short_with_applicability(
self.cast_span,
"consider giving more type information",
String::new(),
Applicability::Unspecified,
);
}
err.emit();
}
@ -329,11 +330,12 @@ impl<'a, 'gcx, 'tcx> CastCheck<'tcx> {
if self.cast_ty.is_trait() {
match fcx.tcx.sess.source_map().span_to_snippet(self.cast_span) {
Ok(s) => {
err.span_suggestion_with_applicability(self.cast_span,
"try casting to a reference instead",
format!("&{}{}", mtstr, s),
Applicability::MachineApplicable,
);
err.span_suggestion_with_applicability(
self.cast_span,
"try casting to a reference instead",
format!("&{}{}", mtstr, s),
Applicability::MachineApplicable,
);
}
Err(_) => {
span_help!(err, self.cast_span, "did you mean `&{}{}`?", mtstr, tstr)
@ -350,11 +352,12 @@ impl<'a, 'gcx, 'tcx> CastCheck<'tcx> {
ty::Adt(def, ..) if def.is_box() => {
match fcx.tcx.sess.source_map().span_to_snippet(self.cast_span) {
Ok(s) => {
err.span_suggestion_with_applicability(self.cast_span,
"try casting to a `Box` instead",
format!("Box<{}>", s),
Applicability::MachineApplicable,
);
err.span_suggestion_with_applicability(
self.cast_span,
"try casting to a `Box` instead",
format!("Box<{}>", s),
Applicability::MachineApplicable,
);
}
Err(_) => span_help!(err, self.cast_span, "did you mean `Box<{}>`?", tstr),
}

View File

@ -133,10 +133,10 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
let suggestions = compatible_variants.iter()
.map(|v| format!("{}({})", v, expr_text)).collect::<Vec<_>>();
err.span_suggestions_with_applicability(
expr.span,
"try using a variant of the expected type",
suggestions,
Applicability::MaybeIncorrect,
expr.span,
"try using a variant of the expected type",
suggestions,
Applicability::MaybeIncorrect,
);
}
}

View File

@ -3349,11 +3349,11 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
let msg = format!("`{}` is a native pointer; try dereferencing it", base);
let suggestion = format!("(*{}).{}", base, field);
err.span_suggestion_with_applicability(
field.span,
&msg,
suggestion,
Applicability::MaybeIncorrect,
);
field.span,
&msg,
suggestion,
Applicability::MaybeIncorrect,
);
}
_ => {}
}
@ -4722,11 +4722,11 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
) {
if let Some((sp, msg, suggestion)) = self.check_ref(expr, found, expected) {
err.span_suggestion_with_applicability(
sp,
msg,
suggestion,
Applicability::MachineApplicable,
);
sp,
msg,
suggestion,
Applicability::MachineApplicable,
);
} else if !self.check_for_cast(err, expr, found, expected) {
let methods = self.get_conversion_methods(expr.span, expected, found);
if let Ok(expr_text) = self.sess().source_map().span_to_snippet(expr.span) {
@ -4757,11 +4757,11 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
}) .collect::<Vec<_>>();
if !suggestions.is_empty() {
err.span_suggestions_with_applicability(
expr.span,
"try using a conversion method",
suggestions,
Applicability::MaybeIncorrect,
);
expr.span,
"try using a conversion method",
suggestions,
Applicability::MaybeIncorrect,
);
}
}
}

View File

@ -445,10 +445,10 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
"`+` can't be used to concatenate two `&str` strings");
match source_map.span_to_snippet(lhs_expr.span) {
Ok(lstring) => err.span_suggestion_with_applicability(
lhs_expr.span,
msg,
format!("{}.to_owned()", lstring),
Applicability::MachineApplicable,
lhs_expr.span,
msg,
format!("{}.to_owned()", lstring),
Applicability::MachineApplicable,
),
_ => err.help(msg),
};
@ -466,12 +466,12 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
) {
(Ok(l), Ok(r), false) => {
err.multipart_suggestion_with_applicability(
msg,
vec![
(lhs_expr.span, format!("{}.to_owned()", l)),
(rhs_expr.span, format!("&{}", r)),
],
Applicability::MachineApplicable,
msg,
vec![
(lhs_expr.span, format!("{}.to_owned()", l)),
(rhs_expr.span, format!("&{}", r)),
],
Applicability::MachineApplicable,
);
}
_ => {

View File

@ -125,10 +125,10 @@ impl<'a> StripUnconfigured<'a> {
let mut err = self.sess.span_diagnostic.struct_span_err(span, msg);
if !suggestion.is_empty() {
err.span_suggestion_with_applicability(
span,
"expected syntax is",
suggestion.into(),
Applicability::MaybeIncorrect,
span,
"expected syntax is",
suggestion.into(),
Applicability::MaybeIncorrect,
);
}
err.emit();

View File

@ -189,10 +189,10 @@ fn generic_extension<'cx>(cx: &'cx mut ExtCtxt,
err.note("you might be missing a comma");
} else {
err.span_suggestion_short_with_applicability(
comma_span,
"missing comma here",
", ".to_string(),
Applicability::MachineApplicable,
comma_span,
"missing comma here",
", ".to_string(),
Applicability::MachineApplicable,
);
}
}

View File

@ -3883,11 +3883,11 @@ impl<'a> Parser<'a> {
// If the struct looks otherwise well formed, recover and continue.
if let Some(sp) = comma_sp {
err.span_suggestion_short_with_applicability(
sp,
"remove this comma",
String::new(),
Applicability::MachineApplicable,
);
sp,
"remove this comma",
String::new(),
Applicability::MachineApplicable,
);
}
err.emit();
break;

View File

@ -997,9 +997,9 @@ pub fn expand_preparsed_format_args(ecx: &mut ExtCtxt,
}
if suggestions.len() > 0 {
diag.multipart_suggestion_with_applicability(
"format specifiers use curly braces",
suggestions,
Applicability::MachineApplicable,
"format specifiers use curly braces",
suggestions,
Applicability::MachineApplicable,
);
}
}};