Skip to content

Commit

Permalink
Appease Clippy.
Browse files Browse the repository at this point in the history
  • Loading branch information
bodil committed Apr 29, 2022
1 parent 5c69ba9 commit 744c626
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions src/vector/focus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ where
if !contains(&self.target_range, &phys_index) {
self.set_focus(phys_index);
}
let mut slice: &[A] = self.get_focus();
let mut slice: &[A] = self.get_focus().as_slice();
let mut left = 0;
let mut right = 0;
if self.target_range.start < self.view.start {
Expand Down Expand Up @@ -528,10 +528,7 @@ where
/// Returns `None` if the index is out of bounds, or the replaced value
/// otherwise.
pub fn set(&mut self, index: usize, value: A) -> Option<A> {
match self.get_mut(index) {
Some(ref mut pos) => Some(replace(pos, value)),
None => None,
}
self.get_mut(index).map(|pos| replace(pos, value))
}

/// Swap the values at two given indices.
Expand Down Expand Up @@ -748,12 +745,12 @@ where
}
}

impl<'a, A> Into<Focus<'a, A>> for FocusMut<'a, A>
impl<'a, A> From<FocusMut<'a, A>> for Focus<'a, A>
where
A: Clone + 'a,
{
fn into(self) -> Focus<'a, A> {
self.unmut()
fn from(f: FocusMut<'a, A>) -> Self {
f.unmut()
}
}

Expand Down

0 comments on commit 744c626

Please sign in to comment.