Skip to content

Commit

Permalink
Do not derive DimElement
Browse files Browse the repository at this point in the history
  • Loading branch information
burrbull committed Jan 22, 2025
1 parent 909a68b commit 645d24c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 14 deletions.
2 changes: 1 addition & 1 deletion svd-rs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

## Unreleased

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

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

17 changes: 4 additions & 13 deletions svd-rs/src/derive_from.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,19 +112,10 @@ where
T: DeriveFrom,
{
fn derive_from(&self, other: &Self) -> Self {
match (self, other) {
(Self::Single(info), Self::Single(other_info)) => {
Self::Single(info.derive_from(other_info))
}
(Self::Single(info), Self::Array(other_info, other_dim)) => {
let mut dim = other_dim.clone();
dim.dim_name = None;
Self::Array(info.derive_from(other_info), dim)
}
(Self::Array(info, dim), Self::Single(other_info))
| (Self::Array(info, dim), Self::Array(other_info, _)) => {
Self::Array(info.derive_from(other_info), dim.clone())
}
let info = (*self).derive_from(*other);
match self {
Self::Single(_) => Self::Single(info),
Self::Array(_, dim) => Self::Array(info, dim),
}
}
}

0 comments on commit 645d24c

Please sign in to comment.