Rollup merge of #128806 - estebank:color-config, r=jieyouxu
Split `ColorConfig` off of `HumanReadableErrorType` The previous setup tied two unrelated things together. Splitting these two is a better model. Identified by https://github.com/rust-lang/rust/pull/126597/files#r1667800754
This commit is contained in:
@@ -43,19 +43,14 @@ const DEFAULT_COLUMN_WIDTH: usize = 140;
|
||||
/// Describes the way the content of the `rendered` field of the json output is generated
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
||||
pub enum HumanReadableErrorType {
|
||||
Default(ColorConfig),
|
||||
AnnotateSnippet(ColorConfig),
|
||||
Short(ColorConfig),
|
||||
Default,
|
||||
AnnotateSnippet,
|
||||
Short,
|
||||
}
|
||||
|
||||
impl HumanReadableErrorType {
|
||||
/// Returns a (`short`, `color`) tuple
|
||||
pub fn unzip(self) -> (bool, ColorConfig) {
|
||||
match self {
|
||||
HumanReadableErrorType::Default(cc) => (false, cc),
|
||||
HumanReadableErrorType::Short(cc) => (true, cc),
|
||||
HumanReadableErrorType::AnnotateSnippet(cc) => (false, cc),
|
||||
}
|
||||
pub fn short(&self) -> bool {
|
||||
*self == HumanReadableErrorType::Short
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user