@@ -389,7 +389,7 @@ where
389
389
if !contains ( & self . target_range , & phys_index) {
390
390
self . set_focus ( phys_index) ;
391
391
}
392
- let mut slice: & [ A ] = self . get_focus ( ) ;
392
+ let mut slice: & [ A ] = self . get_focus ( ) . as_slice ( ) ;
393
393
let mut left = 0 ;
394
394
let mut right = 0 ;
395
395
if self . target_range . start < self . view . start {
@@ -528,10 +528,7 @@ where
528
528
/// Returns `None` if the index is out of bounds, or the replaced value
529
529
/// otherwise.
530
530
pub fn set ( & mut self , index : usize , value : A ) -> Option < A > {
531
- match self . get_mut ( index) {
532
- Some ( ref mut pos) => Some ( replace ( pos, value) ) ,
533
- None => None ,
534
- }
531
+ self . get_mut ( index) . map ( |pos| replace ( pos, value) )
535
532
}
536
533
537
534
/// Swap the values at two given indices.
@@ -748,12 +745,12 @@ where
748
745
}
749
746
}
750
747
751
- impl < ' a , A > Into < Focus < ' a , A > > for FocusMut < ' a , A >
748
+ impl < ' a , A > From < FocusMut < ' a , A > > for Focus < ' a , A >
752
749
where
753
750
A : Clone + ' a ,
754
751
{
755
- fn into ( self ) -> Focus < ' a , A > {
756
- self . unmut ( )
752
+ fn from ( f : FocusMut < ' a , A > ) -> Self {
753
+ f . unmut ( )
757
754
}
758
755
}
759
756
0 commit comments