about summary refs log tree commit diff
diff options
context:
space:
mode:
authorozkanonur <work@onurozkan.dev>2023-05-20 14:40:46 +0300
committerozkanonur <work@onurozkan.dev>2023-05-20 14:40:46 +0300
commit6a347322a9dcb44967020da98c3f9e9e22f38e17 (patch)
tree9d922f3be698d22c7d13b58be37f50467aed06c7
parentc36b2092bbb88604fe5b467be56ccd870307be94 (diff)
downloadrust-6a347322a9dcb44967020da98c3f9e9e22f38e17.tar.gz
rust-6a347322a9dcb44967020da98c3f9e9e22f38e17.zip
derive `Default` trait for `compiletest::common::Config`
-rw-r--r--library/test/src/options.rs6
-rw-r--r--src/tools/compiletest/src/common.rs8
2 files changed, 11 insertions, 3 deletions
diff --git a/library/test/src/options.rs b/library/test/src/options.rs
index 75ec0b616e1..3eaad59474a 100644
--- a/library/test/src/options.rs
+++ b/library/test/src/options.rs
@@ -16,19 +16,21 @@ pub enum ShouldPanic {
 }
 
 /// Whether should console output be colored or not
-#[derive(Copy, Clone, Debug)]
+#[derive(Copy, Clone, Default, Debug)]
 pub enum ColorConfig {
+    #[default]
     AutoColor,
     AlwaysColor,
     NeverColor,
 }
 
 /// Format of the test results output
-#[derive(Copy, Clone, Debug, PartialEq, Eq)]
+#[derive(Copy, Clone, Debug, Default, PartialEq, Eq)]
 pub enum OutputFormat {
     /// Verbose output
     Pretty,
     /// Quiet output
+    #[default]
     Terse,
     /// JSON output
     Json,
diff --git a/src/tools/compiletest/src/common.rs b/src/tools/compiletest/src/common.rs
index 9059a145b43..1dd8cf04b25 100644
--- a/src/tools/compiletest/src/common.rs
+++ b/src/tools/compiletest/src/common.rs
@@ -69,6 +69,12 @@ string_enum! {
     }
 }
 
+impl Default for Mode {
+    fn default() -> Self {
+        Mode::Ui
+    }
+}
+
 impl Mode {
     pub fn disambiguator(self) -> &'static str {
         // Pretty-printing tests could run concurrently, and if they do,
@@ -125,7 +131,7 @@ pub enum PanicStrategy {
 }
 
 /// Configuration for compiletest
-#[derive(Debug, Clone)]
+#[derive(Debug, Default, Clone)]
 pub struct Config {
     /// `true` to overwrite stderr/stdout files instead of complaining about changes in output.
     pub bless: bool,