Make the difference between lint codes and error codes explicit

This commit is contained in:
Oliver Schneider 2017-10-27 08:21:22 +02:00
parent 88fb4c4fda
commit 6ae440e048
No known key found for this signature in database
GPG key ID: A69F8D225B3AD7D9
13 changed files with 143 additions and 69 deletions

View file

@ -23,6 +23,7 @@ use codemap::{CodeMap, FilePathMapping};
use syntax_pos::{self, MacroBacktrace, Span, SpanLabel, MultiSpan};
use errors::registry::Registry;
use errors::{DiagnosticBuilder, SubDiagnostic, RenderSpan, CodeSuggestion, CodeMapper};
use errors::DiagnosticId;
use errors::emitter::Emitter;
use std::rc::Rc;
@ -340,9 +341,12 @@ impl DiagnosticSpanLine {
}
impl DiagnosticCode {
fn map_opt_string(s: Option<String>, je: &JsonEmitter) -> Option<DiagnosticCode> {
fn map_opt_string(s: Option<DiagnosticId>, je: &JsonEmitter) -> Option<DiagnosticCode> {
s.map(|s| {
let s = match s {
DiagnosticId::Error(s) => s,
DiagnosticId::Lint(s) => s,
};
let explanation = je.registry
.as_ref()
.and_then(|registry| registry.find_description(&s));