Skip to content

Commit 5716e83

Browse files
refactor: use derive(Default) on {Test,Subtest}Outcome
1 parent 1efabe6 commit 5716e83

1 file changed

Lines changed: 4 additions & 14 deletions

File tree

moz-webgpu-cts/src/wpt/metadata.rs

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1241,11 +1241,12 @@ pub(crate) const CRASH: &str = "CRASH";
12411241
pub(crate) const OK: &str = "OK";
12421242
pub(crate) const ERROR: &str = "ERROR";
12431243

1244-
#[derive(Debug, Deserialize, EnumSetType, Hash, Serialize)]
1244+
#[derive(Debug, Default, Deserialize, EnumSetType, Hash, Serialize)]
12451245
#[enumset(serialize_repr = "list")]
12461246
#[enumset(serialize_deny_unknown)]
12471247
#[serde(rename_all = "UPPERCASE")]
12481248
pub enum TestOutcome {
1249+
#[default]
12491250
Ok,
12501251
Pass,
12511252
Fail,
@@ -1255,12 +1256,6 @@ pub enum TestOutcome {
12551256
Skip,
12561257
}
12571258

1258-
impl Default for TestOutcome {
1259-
fn default() -> Self {
1260-
Self::Ok
1261-
}
1262-
}
1263-
12641259
impl Display for TestOutcome {
12651260
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
12661261
write!(
@@ -1310,23 +1305,18 @@ impl<'a> Properties<'a> for TestProps<TestOutcome> {
13101305
}
13111306
}
13121307

1313-
#[derive(Debug, Deserialize, EnumSetType, Hash, Serialize)]
1308+
#[derive(Debug, Default, Deserialize, EnumSetType, Hash, Serialize)]
13141309
#[enumset(serialize_repr = "list")]
13151310
#[enumset(serialize_deny_unknown)]
13161311
#[serde(rename_all = "UPPERCASE")]
13171312
pub enum SubtestOutcome {
1313+
#[default]
13181314
Pass,
13191315
Fail,
13201316
Timeout,
13211317
NotRun,
13221318
}
13231319

1324-
impl Default for SubtestOutcome {
1325-
fn default() -> Self {
1326-
Self::Pass
1327-
}
1328-
}
1329-
13301320
impl Display for SubtestOutcome {
13311321
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
13321322
write!(

0 commit comments

Comments
 (0)