Skip to content

Commit ee26f02

Browse files
bors[bot]James Munns
andcommitted
Merge #63
63: Make the schema field optional r=Emilgardis a=jamesmunns Some devices that have created fake SVDs, such as for the MSP430, may not have schemas listed. This fixes the error seen with https://travis-ci.org/rust-embedded/svd2rust/jobs/456451847, See also rust-embedded/svd2rust#256 (comment) Co-authored-by: James Munns <[email protected]>
2 parents 6aa4fdc + 9cc400a commit ee26f02

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/svd/device.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ use svd::peripheral::Peripheral;
1818
#[derive(Clone, Debug)]
1919
pub struct Device {
2020
pub name: String,
21-
schema_version: String,
21+
schema_version: Option<String>,
2222
pub version: Option<String>,
2323
pub description: Option<String>,
2424
pub address_unit_bits: Option<u32>,
@@ -40,8 +40,7 @@ impl Parse for Device {
4040
name: tree.get_child_text("name")?,
4141
schema_version: tree.attributes
4242
.get("schemaVersion")
43-
.unwrap()
44-
.clone(),
43+
.map(|s| s.clone()),
4544
cpu: parse::optional::<Cpu>("cpu", tree)?,
4645
version: tree.get_child_text_opt("version")?,
4746
description: tree.get_child_text_opt("description")?,

0 commit comments

Comments
 (0)