Skip to content

Commit 301eef1

Browse files
burrbullEmilgardis
authored andcommitted
cleanup
1 parent 9584b22 commit 301eef1

File tree

6 files changed

+536
-1036
lines changed

6 files changed

+536
-1036
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,4 +73,4 @@ features = ["full","extra-traits"]
7373
[workspace]
7474
members = ["ci/svd2rust-regress"]
7575
default-members = ["."]
76-
exclude = ["output"]
76+
exclude = ["output"]

ci/svd2rust-regress/src/diff.rs

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -158,16 +158,15 @@ impl Diffing {
158158
.collect::<Vec<_>>();
159159
if tests.len() != 1 {
160160
let error = anyhow::anyhow!("diff requires exactly one test case");
161-
if tests.is_empty() {
162-
return Err(error.context("matched no tests"));
163-
} else if tests.len() > 10 {
164-
return Err(error.context(format!("matched multiple ({}) tests", tests.len())));
165-
}
166-
return Err(error.context(format!(
167-
"matched multiple ({}) tests\n{:?}",
168-
tests.len(),
169-
tests.iter().map(|t| t.name()).collect::<Vec<_>>()
170-
)));
161+
let len = tests.len();
162+
return Err(match len {
163+
0 => error.context("matched no tests"),
164+
10.. => error.context(format!("matched multiple ({len}) tests")),
165+
_ => error.context(format!(
166+
"matched multiple ({len}) tests\n{:?}",
167+
tests.iter().map(|t| t.name()).collect::<Vec<_>>()
168+
)),
169+
});
171170
}
172171

173172
let baseline = tests[0]

ci/svd2rust-regress/src/svd_test.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -245,9 +245,10 @@ impl TestCase {
245245
true,
246246
"svd2rust",
247247
Some(&lib_rs_file).filter(|_| {
248-
(self.arch != Target::CortexM)
249-
&& (self.arch != Target::Msp430)
250-
&& (self.arch != Target::XtensaLX)
248+
!matches!(
249+
self.arch,
250+
Target::CortexM | Target::Msp430 | Target::XtensaLX
251+
)
251252
}),
252253
Some(&svd2rust_err_file),
253254
&[],

ci/svd2rust-regress/src/tests.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ impl std::fmt::Display for Manufacturer {
5555
}
5656

5757
#[derive(Debug, serde::Serialize, serde::Deserialize)]
58+
#[serde(rename_all = "kebab-case")]
5859
pub enum RunWhen {
5960
Always,
6061
NotShort,
@@ -68,6 +69,7 @@ pub struct TestCase {
6869
pub arch: Target,
6970
pub mfgr: Manufacturer,
7071
pub chip: String,
72+
#[serde(default, skip_serializing_if = "Option::is_none")]
7173
svd_url: Option<String>,
7274
pub should_pass: bool,
7375
run_when: RunWhen,

0 commit comments

Comments
 (0)