Skip to content

Commit a78fd04

Browse files
committed
Use map/map_mut for array to slice conversion methods
1 parent fb7e6a5 commit a78fd04

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

src/lib.rs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -544,10 +544,7 @@ where
544544
/// assert_eq!(dst, [1, 2]);
545545
/// ```
546546
pub fn as_slice(&self) -> Volatile<&[T], A> {
547-
Volatile {
548-
reference: &*self.reference,
549-
access: self.access,
550-
}
547+
self.map(|array| &*array)
551548
}
552549

553550
/// Converts a mutable array reference to a mutable slice.
@@ -576,10 +573,7 @@ where
576573
where
577574
R: DerefMut,
578575
{
579-
Volatile {
580-
reference: &mut *self.reference,
581-
access: self.access,
582-
}
576+
self.map_mut(|array| &mut *array)
583577
}
584578
}
585579

0 commit comments

Comments
 (0)