Skip to content

Commit b6ed0c0

Browse files
committed
more info.array(dim)
1 parent d40059c commit b6ed0c0

File tree

1 file changed

+12
-20
lines changed

1 file changed

+12
-20
lines changed

svd-rs/src/derive_from.rs

Lines changed: 12 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -110,17 +110,15 @@ impl DeriveFrom for FieldInfo {
110110
impl DeriveFrom for Peripheral {
111111
fn derive_from(&self, other: &Self) -> Self {
112112
match (self, other) {
113-
(Self::Single(info), Self::Single(other_info)) => {
114-
Self::Single(info.derive_from(other_info))
115-
}
113+
(Self::Single(info), Self::Single(other_info)) => info.derive_from(other_info).single(),
116114
(Self::Single(info), Self::Array(other_info, other_dim)) => {
117115
let mut dim = other_dim.clone();
118116
dim.dim_name = None;
119-
Self::Array(info.derive_from(other_info), dim)
117+
info.derive_from(other_info).array(dim)
120118
}
121119
(Self::Array(info, dim), Self::Single(other_info))
122120
| (Self::Array(info, dim), Self::Array(other_info, _)) => {
123-
Self::Array(info.derive_from(other_info), dim.clone())
121+
info.derive_from(other_info).array(dim.clone())
124122
}
125123
}
126124
}
@@ -129,17 +127,15 @@ impl DeriveFrom for Peripheral {
129127
impl DeriveFrom for Cluster {
130128
fn derive_from(&self, other: &Self) -> Self {
131129
match (self, other) {
132-
(Self::Single(info), Self::Single(other_info)) => {
133-
Self::Single(info.derive_from(other_info))
134-
}
130+
(Self::Single(info), Self::Single(other_info)) => info.derive_from(other_info).single(),
135131
(Self::Single(info), Self::Array(other_info, other_dim)) => {
136132
let mut dim = other_dim.clone();
137133
dim.dim_name = None;
138-
Self::Array(info.derive_from(other_info), dim)
134+
info.derive_from(other_info).array(dim)
139135
}
140136
(Self::Array(info, dim), Self::Single(other_info))
141137
| (Self::Array(info, dim), Self::Array(other_info, _)) => {
142-
Self::Array(info.derive_from(other_info), dim.clone())
138+
info.derive_from(other_info).array(dim.clone())
143139
}
144140
}
145141
}
@@ -148,17 +144,15 @@ impl DeriveFrom for Cluster {
148144
impl DeriveFrom for Register {
149145
fn derive_from(&self, other: &Self) -> Self {
150146
match (self, other) {
151-
(Self::Single(info), Self::Single(other_info)) => {
152-
Self::Single(info.derive_from(other_info))
153-
}
147+
(Self::Single(info), Self::Single(other_info)) => info.derive_from(other_info).single(),
154148
(Self::Single(info), Self::Array(other_info, other_dim)) => {
155149
let mut dim = other_dim.clone();
156150
dim.dim_name = None;
157-
Self::Array(info.derive_from(other_info), dim)
151+
info.derive_from(other_info).array(dim)
158152
}
159153
(Self::Array(info, dim), Self::Single(other_info))
160154
| (Self::Array(info, dim), Self::Array(other_info, _)) => {
161-
Self::Array(info.derive_from(other_info), dim.clone())
155+
info.derive_from(other_info).array(dim.clone())
162156
}
163157
}
164158
}
@@ -167,17 +161,15 @@ impl DeriveFrom for Register {
167161
impl DeriveFrom for Field {
168162
fn derive_from(&self, other: &Self) -> Self {
169163
match (self, other) {
170-
(Self::Single(info), Self::Single(other_info)) => {
171-
Self::Single(info.derive_from(other_info))
172-
}
164+
(Self::Single(info), Self::Single(other_info)) => info.derive_from(other_info).single(),
173165
(Self::Single(info), Self::Array(other_info, other_dim)) => {
174166
let mut dim = other_dim.clone();
175167
dim.dim_name = None;
176-
Self::Array(info.derive_from(other_info), dim)
168+
info.derive_from(other_info).array(dim)
177169
}
178170
(Self::Array(info, dim), Self::Single(other_info))
179171
| (Self::Array(info, dim), Self::Array(other_info, _)) => {
180-
Self::Array(info.derive_from(other_info), dim.clone())
172+
info.derive_from(other_info).array(dim.clone())
181173
}
182174
}
183175
}

0 commit comments

Comments
 (0)