File tree Expand file tree Collapse file tree 1 file changed +3
-9
lines changed Expand file tree Collapse file tree 1 file changed +3
-9
lines changed Original file line number Diff line number Diff line change @@ -180,15 +180,9 @@ pub struct Peripheral {
180
180
impl Peripheral {
181
181
pub fn derive_from ( & self , other : & Peripheral ) -> Peripheral {
182
182
let mut derived = self . clone ( ) ;
183
- if derived. group_name . is_none ( ) && other. group_name . is_some ( ) {
184
- derived. group_name = other. group_name . clone ( ) ;
185
- }
186
- if derived. description . is_none ( ) && other. description . is_some ( ) {
187
- derived. description = other. description . clone ( ) ;
188
- }
189
- if derived. registers . is_none ( ) && other. registers . is_some ( ) {
190
- derived. registers = other. registers . clone ( ) ;
191
- }
183
+ derived. group_name = derived. group_name . or ( other. group_name . clone ( ) ) ;
184
+ derived. description = derived. description . or ( other. description . clone ( ) ) ;
185
+ derived. registers = derived. registers . or ( other. registers . clone ( ) ) ;
192
186
if derived. interrupt . is_empty ( ) {
193
187
derived. interrupt = other. interrupt . clone ( ) ;
194
188
}
You can’t perform that action at this time.
0 commit comments