Skip to content

Commit a37091c

Browse files
committed
Do not derive DimElement
1 parent 909a68b commit a37091c

File tree

2 files changed

+6
-14
lines changed

2 files changed

+6
-14
lines changed

svd-rs/CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
77

88
## Unreleased
99

10+
- Do not derive `DimElement`
1011
- Revert the `riscv` elements, as well as the `unstable-riscv` feature.
1112

1213
## [v0.14.9] - 2024-08-20
@@ -143,4 +144,3 @@ Previous versions in common [changelog](../CHANGELOG.md).
143144
[v0.11.2]: https://github.com/rust-embedded/svd/compare/svd-rs-v0.11.1...svd-rs-v0.11.2
144145
[v0.11.1]: https://github.com/rust-embedded/svd/compare/v0.11.0...svd-rs-v0.11.1
145146
[v0.11.0]: https://github.com/rust-embedded/svd/compare/v0.10.2...v0.11.0
146-

svd-rs/src/derive_from.rs

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -112,19 +112,11 @@ where
112112
T: DeriveFrom,
113113
{
114114
fn derive_from(&self, other: &Self) -> Self {
115-
match (self, other) {
116-
(Self::Single(info), Self::Single(other_info)) => {
117-
Self::Single(info.derive_from(other_info))
118-
}
119-
(Self::Single(info), Self::Array(other_info, other_dim)) => {
120-
let mut dim = other_dim.clone();
121-
dim.dim_name = None;
122-
Self::Array(info.derive_from(other_info), dim)
123-
}
124-
(Self::Array(info, dim), Self::Single(other_info))
125-
| (Self::Array(info, dim), Self::Array(other_info, _)) => {
126-
Self::Array(info.derive_from(other_info), dim.clone())
127-
}
115+
use std::ops::Deref;
116+
let info = self.deref().derive_from(other.deref());
117+
match self {
118+
Self::Single(_) => Self::Single(info),
119+
Self::Array(_, dim) => Self::Array(info, dim.clone()),
128120
}
129121
}
130122
}

0 commit comments

Comments
 (0)