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(), new_ty.to_string(),
Applicability::Unspecified, Applicability::Unspecified,
) )
.span_label(span, format!("lifetime `{}` required", named)) .span_label(span, format!("lifetime `{}` required", named))
.emit(); .emit();
return Some(ErrorReported); return Some(ErrorReported);
} }

View file

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

View file

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

View file

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

View file

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

View file

@ -3300,11 +3300,11 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> {
"expecting a type here because of type ascription"); "expecting a type here because of type ascription");
if line_sp != line_base_sp { if line_sp != line_base_sp {
err.span_suggestion_short_with_applicability( err.span_suggestion_short_with_applicability(
sp, sp,
"did you mean to use `;` here instead?", "did you mean to use `;` here instead?",
";".to_string(), ";".to_string(),
Applicability::MaybeIncorrect, Applicability::MaybeIncorrect,
); );
} }
break; break;
} else if snippet.trim().len() != 0 { } else if snippet.trim().len() != 0 {
@ -4829,8 +4829,12 @@ fn show_candidates(err: &mut DiagnosticBuilder,
*candidate = format!("use {};\n{}", candidate, additional_newline); *candidate = format!("use {};\n{}", candidate, additional_newline);
} }
err.span_suggestions_with_applicability(span, &msg, path_strings, err.span_suggestions_with_applicability(
Applicability::Unspecified); span,
&msg,
path_strings,
Applicability::Unspecified,
);
} else { } else {
let mut msg = msg; let mut msg = msg;
msg.push(':'); 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 \ err.note("The type information given here is insufficient to check whether \
the pointer cast is valid"); the pointer cast is valid");
if unknown_cast_to { if unknown_cast_to {
err.span_suggestion_short_with_applicability(self.cast_span, err.span_suggestion_short_with_applicability(
"consider giving more type information", self.cast_span,
String::new(), "consider giving more type information",
Applicability::Unspecified, String::new(),
); Applicability::Unspecified,
);
} }
err.emit(); err.emit();
} }
@ -329,11 +330,12 @@ impl<'a, 'gcx, 'tcx> CastCheck<'tcx> {
if self.cast_ty.is_trait() { if self.cast_ty.is_trait() {
match fcx.tcx.sess.source_map().span_to_snippet(self.cast_span) { match fcx.tcx.sess.source_map().span_to_snippet(self.cast_span) {
Ok(s) => { Ok(s) => {
err.span_suggestion_with_applicability(self.cast_span, err.span_suggestion_with_applicability(
"try casting to a reference instead", self.cast_span,
format!("&{}{}", mtstr, s), "try casting to a reference instead",
Applicability::MachineApplicable, format!("&{}{}", mtstr, s),
); Applicability::MachineApplicable,
);
} }
Err(_) => { Err(_) => {
span_help!(err, self.cast_span, "did you mean `&{}{}`?", mtstr, tstr) 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() => { ty::Adt(def, ..) if def.is_box() => {
match fcx.tcx.sess.source_map().span_to_snippet(self.cast_span) { match fcx.tcx.sess.source_map().span_to_snippet(self.cast_span) {
Ok(s) => { Ok(s) => {
err.span_suggestion_with_applicability(self.cast_span, err.span_suggestion_with_applicability(
"try casting to a `Box` instead", self.cast_span,
format!("Box<{}>", s), "try casting to a `Box` instead",
Applicability::MachineApplicable, format!("Box<{}>", s),
); Applicability::MachineApplicable,
);
} }
Err(_) => span_help!(err, self.cast_span, "did you mean `Box<{}>`?", tstr), 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() let suggestions = compatible_variants.iter()
.map(|v| format!("{}({})", v, expr_text)).collect::<Vec<_>>(); .map(|v| format!("{}({})", v, expr_text)).collect::<Vec<_>>();
err.span_suggestions_with_applicability( err.span_suggestions_with_applicability(
expr.span, expr.span,
"try using a variant of the expected type", "try using a variant of the expected type",
suggestions, suggestions,
Applicability::MaybeIncorrect, 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 msg = format!("`{}` is a native pointer; try dereferencing it", base);
let suggestion = format!("(*{}).{}", base, field); let suggestion = format!("(*{}).{}", base, field);
err.span_suggestion_with_applicability( err.span_suggestion_with_applicability(
field.span, field.span,
&msg, &msg,
suggestion, suggestion,
Applicability::MaybeIncorrect, 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) { if let Some((sp, msg, suggestion)) = self.check_ref(expr, found, expected) {
err.span_suggestion_with_applicability( err.span_suggestion_with_applicability(
sp, sp,
msg, msg,
suggestion, suggestion,
Applicability::MachineApplicable, Applicability::MachineApplicable,
); );
} else if !self.check_for_cast(err, expr, found, expected) { } else if !self.check_for_cast(err, expr, found, expected) {
let methods = self.get_conversion_methods(expr.span, expected, found); let methods = self.get_conversion_methods(expr.span, expected, found);
if let Ok(expr_text) = self.sess().source_map().span_to_snippet(expr.span) { 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<_>>(); }) .collect::<Vec<_>>();
if !suggestions.is_empty() { if !suggestions.is_empty() {
err.span_suggestions_with_applicability( err.span_suggestions_with_applicability(
expr.span, expr.span,
"try using a conversion method", "try using a conversion method",
suggestions, suggestions,
Applicability::MaybeIncorrect, 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"); "`+` can't be used to concatenate two `&str` strings");
match source_map.span_to_snippet(lhs_expr.span) { match source_map.span_to_snippet(lhs_expr.span) {
Ok(lstring) => err.span_suggestion_with_applicability( Ok(lstring) => err.span_suggestion_with_applicability(
lhs_expr.span, lhs_expr.span,
msg, msg,
format!("{}.to_owned()", lstring), format!("{}.to_owned()", lstring),
Applicability::MachineApplicable, Applicability::MachineApplicable,
), ),
_ => err.help(msg), _ => err.help(msg),
}; };
@ -466,12 +466,12 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
) { ) {
(Ok(l), Ok(r), false) => { (Ok(l), Ok(r), false) => {
err.multipart_suggestion_with_applicability( err.multipart_suggestion_with_applicability(
msg, msg,
vec![ vec![
(lhs_expr.span, format!("{}.to_owned()", l)), (lhs_expr.span, format!("{}.to_owned()", l)),
(rhs_expr.span, format!("&{}", r)), (rhs_expr.span, format!("&{}", r)),
], ],
Applicability::MachineApplicable, Applicability::MachineApplicable,
); );
} }
_ => { _ => {

View file

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

View file

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

View file

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

View file

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