review comments
This commit is contained in:
parent
ae696f847d
commit
95c1c34fff
5 changed files with 12 additions and 6 deletions
|
@ -48,6 +48,12 @@ pub enum HumanReadableErrorType {
|
|||
Short,
|
||||
}
|
||||
|
||||
impl HumanReadableErrorType {
|
||||
pub fn short(&self) -> bool {
|
||||
*self == HumanReadableErrorType::Short
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug)]
|
||||
struct Margin {
|
||||
/// The available whitespace in the left that can be consumed when centering.
|
||||
|
|
|
@ -176,7 +176,7 @@ impl Emitter for JsonEmitter {
|
|||
}
|
||||
|
||||
fn should_show_explain(&self) -> bool {
|
||||
!matches!(self.json_rendered, HumanReadableErrorType::Short)
|
||||
!self.json_rendered.short()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -356,7 +356,7 @@ impl Diagnostic {
|
|||
|
||||
let buf = BufWriter::default();
|
||||
let mut dst: Destination = Box::new(buf.clone());
|
||||
let short = matches!(je.json_rendered, HumanReadableErrorType::Short);
|
||||
let short = je.json_rendered.short();
|
||||
match je.color_config {
|
||||
ColorConfig::Always | ColorConfig::Auto => dst = Box::new(termcolor::Ansi::new(dst)),
|
||||
ColorConfig::Never => {}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue