derive Default trait for compiletest::common::Config

This commit is contained in:
ozkanonur 2023-05-20 14:40:46 +03:00
parent c36b2092bb
commit 6a347322a9
2 changed files with 11 additions and 3 deletions

View File

@ -16,19 +16,21 @@ pub enum ShouldPanic {
} }
/// Whether should console output be colored or not /// Whether should console output be colored or not
#[derive(Copy, Clone, Debug)] #[derive(Copy, Clone, Default, Debug)]
pub enum ColorConfig { pub enum ColorConfig {
#[default]
AutoColor, AutoColor,
AlwaysColor, AlwaysColor,
NeverColor, NeverColor,
} }
/// Format of the test results output /// Format of the test results output
#[derive(Copy, Clone, Debug, PartialEq, Eq)] #[derive(Copy, Clone, Debug, Default, PartialEq, Eq)]
pub enum OutputFormat { pub enum OutputFormat {
/// Verbose output /// Verbose output
Pretty, Pretty,
/// Quiet output /// Quiet output
#[default]
Terse, Terse,
/// JSON output /// JSON output
Json, Json,

View File

@ -69,6 +69,12 @@ pub enum Mode {
} }
} }
impl Default for Mode {
fn default() -> Self {
Mode::Ui
}
}
impl Mode { impl Mode {
pub fn disambiguator(self) -> &'static str { pub fn disambiguator(self) -> &'static str {
// Pretty-printing tests could run concurrently, and if they do, // Pretty-printing tests could run concurrently, and if they do,
@ -125,7 +131,7 @@ pub enum PanicStrategy {
} }
/// Configuration for compiletest /// Configuration for compiletest
#[derive(Debug, Clone)] #[derive(Debug, Default, Clone)]
pub struct Config { pub struct Config {
/// `true` to overwrite stderr/stdout files instead of complaining about changes in output. /// `true` to overwrite stderr/stdout files instead of complaining about changes in output.
pub bless: bool, pub bless: bool,