diff options
| author | Nicholas Nethercote <n.nethercote@gmail.com> | 2024-02-29 09:21:02 +1100 | 
|---|---|---|
| committer | Nicholas Nethercote <n.nethercote@gmail.com> | 2024-02-29 17:50:26 +1100 | 
| commit | 2999d8dc72e9ed9e895d6a9e2d3d34f1cd4370ba (patch) | |
| tree | e58aa2af7a3384ad7d9148acf9badb400121de7b /compiler/rustc_errors/src/json.rs | |
| parent | 067d7c3d00a05989bd4b7d4b5648d61748f80848 (diff) | |
| download | rust-2999d8dc72e9ed9e895d6a9e2d3d34f1cd4370ba.tar.gz rust-2999d8dc72e9ed9e895d6a9e2d3d34f1cd4370ba.zip | |
Inline and remove `JsonEmitter::{basic,stderr}`.
They are so similar to `JsonEmitter::new` it's not worth having separate functions, it makes the code harder to read.
Diffstat (limited to 'compiler/rustc_errors/src/json.rs')
| -rw-r--r-- | compiler/rustc_errors/src/json.rs | 56 | 
1 files changed, 1 insertions, 55 deletions
| diff --git a/compiler/rustc_errors/src/json.rs b/compiler/rustc_errors/src/json.rs index ab2ed5ebaeb..e99a70c393e 100644 --- a/compiler/rustc_errors/src/json.rs +++ b/compiler/rustc_errors/src/json.rs @@ -9,7 +9,7 @@ // FIXME: spec the JSON output properly. -use rustc_span::source_map::{FilePathMapping, SourceMap}; +use rustc_span::source_map::SourceMap; use termcolor::{ColorSpec, WriteColor}; use crate::emitter::{ @@ -56,60 +56,6 @@ pub struct JsonEmitter { } impl JsonEmitter { - pub fn stderr( - registry: Option<Registry>, - source_map: Lrc<SourceMap>, - fluent_bundle: Option<Lrc<FluentBundle>>, - fallback_bundle: LazyFallbackBundle, - pretty: bool, - json_rendered: HumanReadableErrorType, - diagnostic_width: Option<usize>, - macro_backtrace: bool, - track_diagnostics: bool, - terminal_url: TerminalUrl, - ) -> JsonEmitter { - JsonEmitter { - dst: IntoDynSyncSend(Box::new(io::BufWriter::new(io::stderr()))), - registry, - sm: source_map, - fluent_bundle, - fallback_bundle, - pretty, - ui_testing: false, - ignored_directories_in_source_blocks: Vec::new(), - json_rendered, - diagnostic_width, - macro_backtrace, - track_diagnostics, - terminal_url, - } - } - - pub fn basic( - pretty: bool, - json_rendered: HumanReadableErrorType, - fluent_bundle: Option<Lrc<FluentBundle>>, - fallback_bundle: LazyFallbackBundle, - diagnostic_width: Option<usize>, - macro_backtrace: bool, - track_diagnostics: bool, - terminal_url: TerminalUrl, - ) -> JsonEmitter { - let file_path_mapping = FilePathMapping::empty(); - JsonEmitter::stderr( - None, - Lrc::new(SourceMap::new(file_path_mapping)), - fluent_bundle, - fallback_bundle, - pretty, - json_rendered, - diagnostic_width, - macro_backtrace, - track_diagnostics, - terminal_url, - ) - } - pub fn new( dst: Box<dyn Write + Send>, registry: Option<Registry>, | 
