From a37091c784a729c74db1695eeb9fb1a53d82e937 Mon Sep 17 00:00:00 2001 From: Andrey Zgarbul Date: Wed, 22 Jan 2025 19:06:48 +0300 Subject: [PATCH] Do not derive DimElement --- svd-rs/CHANGELOG.md | 2 +- svd-rs/src/derive_from.rs | 18 +++++------------- 2 files changed, 6 insertions(+), 14 deletions(-) diff --git a/svd-rs/CHANGELOG.md b/svd-rs/CHANGELOG.md index c8af63fd..33d4f76f 100644 --- a/svd-rs/CHANGELOG.md +++ b/svd-rs/CHANGELOG.md @@ -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 @@ -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 - diff --git a/svd-rs/src/derive_from.rs b/svd-rs/src/derive_from.rs index 13b8437f..eaa60742 100644 --- a/svd-rs/src/derive_from.rs +++ b/svd-rs/src/derive_from.rs @@ -112,19 +112,11 @@ 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()) - } + use std::ops::Deref; + let info = self.deref().derive_from(other.deref()); + match self { + Self::Single(_) => Self::Single(info), + Self::Array(_, dim) => Self::Array(info, dim.clone()), } } }