Skip to content

Commit 91f7976

Browse files
committed
non_exhaustive
1 parent dccc18a commit 91f7976

14 files changed

+14
-53
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
continue-on-error: ${{ matrix.experimental || false }}
1313
strategy:
1414
matrix:
15-
rust: [ 1.36.0, stable ]
15+
rust: [ 1.40.0, stable ]
1616
include:
1717
# Test nightly but don't fail the build.
1818
- rust: nightly

.github/workflows/clippy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
- uses: actions-rs/toolchain@v1
1313
with:
1414
profile: minimal
15-
toolchain: 1.36.0
15+
toolchain: stable
1616
override: true
1717
components: clippy
1818
- uses: actions-rs/clippy-check@v1

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ This project is developed and maintained by the [Tools team][team].
1313

1414
## Minimum Supported Rust Version (MSRV)
1515

16-
This crate is guaranteed to compile on stable Rust 1.36.0 and up. It *might*
16+
This crate is guaranteed to compile on stable Rust 1.40.0 and up. It *might*
1717
compile with older versions but that may change in any new patch release.
1818

1919
## License

src/error.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use once_cell::sync::Lazy;
99
use regex::Regex;
1010
use xmltree::Element;
1111

12-
#[allow(clippy::large_enum_variant)]
12+
#[allow(clippy::large_enum_variant, clippy::upper_case_acronyms)]
1313
#[derive(Clone, Debug, PartialEq, Eq, thiserror::Error)]
1414
pub enum SVDError {
1515
#[error("Unknown endianness `{0}`")]

src/svd/clusterinfo.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ use crate::svd::{registercluster::RegisterCluster, registerproperties::RegisterP
1111

1212
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
1313
#[derive(Clone, Debug, PartialEq)]
14+
#[non_exhaustive]
1415
pub struct ClusterInfo {
1516
/// String to identify the cluster.
1617
/// Cluster names are required to be unique within the scope of a peripheral
@@ -38,10 +39,6 @@ pub struct ClusterInfo {
3839
pub default_register_properties: RegisterProperties,
3940

4041
pub children: Vec<RegisterCluster>,
41-
42-
// Reserve the right to add more fields to this struct
43-
#[cfg_attr(feature = "serde", serde(skip))]
44-
_extensible: (),
4542
}
4643

4744
#[derive(Clone, Debug, Default, PartialEq)]
@@ -99,7 +96,6 @@ impl ClusterInfoBuilder {
9996
children: self
10097
.children
10198
.ok_or_else(|| BuildError::Uninitialized("children".to_string()))?,
102-
_extensible: (),
10399
})
104100
.validate()
105101
}

src/svd/cpu.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ use crate::types::Parse;
1212

1313
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
1414
#[derive(Clone, Debug, PartialEq)]
15+
#[non_exhaustive]
1516
pub struct Cpu {
1617
pub name: String,
1718

@@ -32,10 +33,6 @@ pub struct Cpu {
3233

3334
/// Indicate whether the processor implements a vendor-specific System Tick Timer
3435
pub has_vendor_systick: bool,
35-
36-
// Reserve the right to add more fields to this struct
37-
#[cfg_attr(feature = "serde", serde(skip))]
38-
_extensible: (),
3936
}
4037

4138
#[derive(Clone, Debug, Default, PartialEq)]
@@ -101,7 +98,6 @@ impl CpuBuilder {
10198
has_vendor_systick: self
10299
.has_vendor_systick
103100
.ok_or_else(|| BuildError::Uninitialized("has_vendor_systick".to_string()))?,
104-
_extensible: (),
105101
})
106102
.validate()
107103
}

src/svd/device.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ use crate::svd::{cpu::Cpu, peripheral::Peripheral, registerproperties::RegisterP
1515

1616
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
1717
#[derive(Clone, Debug, PartialEq)]
18+
#[non_exhaustive]
1819
pub struct Device {
1920
/// The string identifies the device or device series. Device names are required to be unique
2021
pub name: String,
@@ -53,10 +54,6 @@ pub struct Device {
5354
pub peripherals: Vec<Peripheral>,
5455

5556
pub default_register_properties: RegisterProperties,
56-
57-
// Reserve the right to add more fields to this struct
58-
#[cfg_attr(feature = "serde", serde(skip))]
59-
_extensible: (),
6057
}
6158

6259
#[derive(Clone, Debug, Default)]
@@ -124,7 +121,6 @@ impl DeviceBuilder {
124121
.peripherals
125122
.ok_or_else(|| BuildError::Uninitialized("peripherals".to_string()))?,
126123
default_register_properties: self.default_register_properties,
127-
_extensible: (),
128124
})
129125
.validate()
130126
}

src/svd/dimelement.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ use crate::error::*;
1010

1111
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
1212
#[derive(Clone, Debug, PartialEq)]
13+
#[non_exhaustive]
1314
pub struct DimElement {
1415
/// Defines the number of elements in an array or list
1516
pub dim: u32,
@@ -22,10 +23,6 @@ pub struct DimElement {
2223
#[cfg_attr(feature = "serde", serde(default))]
2324
#[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
2425
pub dim_index: Option<Vec<String>>,
25-
26-
// Reserve the right to add more fields to this struct
27-
#[cfg_attr(feature = "serde", serde(skip))]
28-
_extensible: (),
2926
}
3027

3128
#[derive(Clone, Debug, Default, PartialEq)]
@@ -57,7 +54,6 @@ impl DimElementBuilder {
5754
.dim_increment
5855
.ok_or_else(|| BuildError::Uninitialized("dim_increment".to_string()))?,
5956
dim_index: self.dim_index,
60-
_extensible: (),
6157
})
6258
}
6359
}

src/svd/enumeratedvalue.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ use crate::types::Parse;
1111

1212
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
1313
#[derive(Clone, Debug, PartialEq)]
14+
#[non_exhaustive]
1415
pub struct EnumeratedValue {
1516
/// String describing the semantics of the value. Can be displayed instead of the value
1617
pub name: String,
@@ -29,10 +30,6 @@ pub struct EnumeratedValue {
2930
#[cfg_attr(feature = "serde", serde(default))]
3031
#[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
3132
pub is_default: Option<bool>,
32-
33-
// Reserve the right to add more fields to this struct
34-
#[cfg_attr(feature = "serde", serde(skip))]
35-
_extensible: (),
3633
}
3734

3835
#[derive(Clone, Debug, PartialEq, Eq, thiserror::Error)]
@@ -77,7 +74,6 @@ impl EnumeratedValueBuilder {
7774
description: self.description,
7875
value: self.value,
7976
is_default: self.is_default,
80-
_extensible: (),
8177
})
8278
.validate()
8379
}

src/svd/enumeratedvalues.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ use crate::types::Parse;
1313

1414
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
1515
#[derive(Clone, Debug, PartialEq)]
16+
#[non_exhaustive]
1617
pub struct EnumeratedValues {
1718
/// Identifier for the whole enumeration section
1819
#[cfg_attr(feature = "serde", serde(default))]
@@ -30,10 +31,6 @@ pub struct EnumeratedValues {
3031
pub derived_from: Option<String>,
3132

3233
pub values: Vec<EnumeratedValue>,
33-
34-
// Reserve the right to add more fields to this struct
35-
#[cfg_attr(feature = "serde", serde(skip))]
36-
_extensible: (),
3734
}
3835

3936
#[derive(Clone, Debug, PartialEq, Eq, thiserror::Error)]
@@ -73,7 +70,6 @@ impl EnumeratedValuesBuilder {
7370
usage: self.usage,
7471
derived_from: self.derived_from,
7572
values: self.values.unwrap_or_default(),
76-
_extensible: (),
7773
})
7874
.validate()
7975
}

src/svd/fieldinfo.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ use crate::svd::{
1717

1818
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
1919
#[derive(Clone, Debug, PartialEq)]
20+
#[non_exhaustive]
2021
pub struct FieldInfo {
2122
/// Name string used to identify the field.
2223
/// Field names must be unique within a register
@@ -52,10 +53,6 @@ pub struct FieldInfo {
5253
#[cfg_attr(feature = "serde", serde(default))]
5354
#[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
5455
pub modified_write_values: Option<ModifiedWriteValues>,
55-
56-
// Reserve the right to add more fields to this struct
57-
#[cfg_attr(feature = "serde", serde(skip))]
58-
_extensible: (),
5956
}
6057

6158
#[derive(Clone, Debug, Default, PartialEq)]
@@ -117,7 +114,6 @@ impl FieldInfoBuilder {
117114
enumerated_values: self.enumerated_values.unwrap_or_default(),
118115
write_constraint: self.write_constraint,
119116
modified_write_values: self.modified_write_values,
120-
_extensible: (),
121117
})
122118
.validate()
123119
}

src/svd/peripheral.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ use crate::svd::{
1818

1919
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
2020
#[derive(Clone, Debug, PartialEq)]
21+
#[non_exhaustive]
2122
pub struct Peripheral {
2223
/// The string identifies the peripheral. Peripheral names are required to be unique for a device
2324
pub name: String,
@@ -65,10 +66,6 @@ pub struct Peripheral {
6566
#[cfg_attr(feature = "serde", serde(default))]
6667
#[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
6768
pub derived_from: Option<String>,
68-
69-
// Reserve the right to add more fields to this struct
70-
#[cfg_attr(feature = "serde", serde(skip))]
71-
_extensible: (),
7269
}
7370

7471
#[derive(Clone, Debug, Default, PartialEq)]
@@ -148,7 +145,6 @@ impl PeripheralBuilder {
148145
default_register_properties: self.default_register_properties,
149146
registers: self.registers,
150147
derived_from: self.derived_from,
151-
_extensible: (),
152148
})
153149
.validate()
154150
}

src/svd/registerinfo.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ use crate::svd::{
1717

1818
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
1919
#[derive(Clone, Debug, PartialEq)]
20+
#[non_exhaustive]
2021
pub struct RegisterInfo {
2122
/// String to identify the register.
2223
/// Register names are required to be unique within the scope of a peripheral
@@ -76,10 +77,6 @@ pub struct RegisterInfo {
7677
#[cfg_attr(feature = "serde", serde(default))]
7778
#[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
7879
pub modified_write_values: Option<ModifiedWriteValues>,
79-
80-
// Reserve the right to add more fields to this struct
81-
#[cfg_attr(feature = "serde", serde(skip))]
82-
_extensible: (),
8380
}
8481

8582
#[derive(Clone, Debug, Default, PartialEq)]
@@ -172,7 +169,6 @@ impl RegisterInfoBuilder {
172169
fields: self.fields,
173170
write_constraint: self.write_constraint,
174171
modified_write_values: self.modified_write_values,
175-
_extensible: (),
176172
})
177173
.validate()
178174
}

src/svd/registerproperties.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ use crate::svd::access::Access;
1313
/// Register default properties
1414
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
1515
#[derive(Clone, Copy, Debug, Default, PartialEq)]
16+
#[non_exhaustive]
1617
pub struct RegisterProperties {
1718
/// Default bit-width of any register
1819
#[cfg_attr(feature = "serde", serde(default))]
@@ -33,10 +34,6 @@ pub struct RegisterProperties {
3334
#[cfg_attr(feature = "serde", serde(default))]
3435
#[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
3536
pub access: Option<Access>,
36-
37-
// Reserve the right to add more fields to this struct
38-
#[cfg_attr(feature = "serde", serde(skip))]
39-
_extensible: (),
4037
}
4138

4239
impl Parse for RegisterProperties {

0 commit comments

Comments
 (0)