Use multispan_sugg

This commit is contained in:
sinkuu
2017-02-21 18:44:31 +09:00
parent 627d24c80f
commit 3516d45d7c
5 changed files with 18 additions and 22 deletions

View File

@@ -573,10 +573,10 @@ pub fn span_lint_and_then<'a, 'tcx: 'a, T: LintContext<'tcx>, F>(
///
/// Note: in the JSON format (used by `compiletest_rs`), the help message will appear once per
/// replacement. In human-readable format though, it only appears once before the whole suggestion.
pub fn multispan_sugg(db: &mut DiagnosticBuilder, help_msg: String, sugg: &[(Span, &str)]) {
pub fn multispan_sugg(db: &mut DiagnosticBuilder, help_msg: String, sugg: Vec<(Span, String)>) {
let sugg = rustc_errors::RenderSpan::Suggestion(rustc_errors::CodeSuggestion {
msp: MultiSpan::from_spans(sugg.iter().map(|&(span, _)| span).collect()),
substitutes: sugg.iter().map(|&(_, subs)| subs.to_owned()).collect(),
substitutes: sugg.into_iter().map(|(_, subs)| subs).collect(),
});
let sub = rustc_errors::SubDiagnostic {