annotate-snippets: update to 0.10

This commit is contained in:
klensy 2023-12-30 18:11:41 +03:00
parent 5cb2e7dfc3
commit 5b153b52a2
5 changed files with 24 additions and 23 deletions

View file

@ -12,8 +12,7 @@ use crate::{
CodeSuggestion, Diagnostic, DiagnosticId, DiagnosticMessage, Emitter, FluentBundle,
LazyFallbackBundle, Level, MultiSpan, Style, SubDiagnostic,
};
use annotate_snippets::display_list::{DisplayList, FormatOptions};
use annotate_snippets::snippet::*;
use annotate_snippets::{Annotation, AnnotationType, Renderer, Slice, Snippet, SourceAnnotation};
use rustc_data_structures::sync::Lrc;
use rustc_error_messages::FluentArgs;
use rustc_span::source_map::SourceMap;
@ -190,11 +189,6 @@ impl AnnotateSnippetEmitter {
annotation_type: annotation_type_for_level(*level),
}),
footer: vec![],
opt: FormatOptions {
color: true,
anonymized_line_numbers: self.ui_testing,
margin: None,
},
slices: annotated_files
.iter()
.map(|(file_name, source, line_index, annotations)| {
@ -222,7 +216,8 @@ impl AnnotateSnippetEmitter {
// FIXME(#59346): Figure out if we can _always_ print to stderr or not.
// `emitter.rs` has the `Destination` enum that lists various possible output
// destinations.
eprintln!("{}", DisplayList::from(snippet))
let renderer = Renderer::plain().anonymized_line_numbers(self.ui_testing);
eprintln!("{}", renderer.render(snippet))
}
// FIXME(#59346): Is it ok to return None if there's no source_map?
}