Fix clippy::trivially-copy-pass-by-ref

This commit is contained in:
Héctor Ramón Jiménez 2023-09-20 04:33:48 +02:00
parent 34f07b6027
commit 6c386e90a1
No known key found for this signature in database
GPG key ID: 7CC46565708259A7
6 changed files with 48 additions and 55 deletions

View file

@ -95,13 +95,13 @@ impl Node {
splits
}
pub(crate) fn find(&mut self, pane: &Pane) -> Option<&mut Node> {
pub(crate) fn find(&mut self, pane: Pane) -> Option<&mut Node> {
match self {
Node::Split { a, b, .. } => {
a.find(pane).or_else(move || b.find(pane))
}
Node::Pane(p) => {
if p == pane {
if *p == pane {
Some(self)
} else {
None
@ -139,12 +139,12 @@ impl Node {
f(self);
}
pub(crate) fn resize(&mut self, split: &Split, percentage: f32) -> bool {
pub(crate) fn resize(&mut self, split: Split, percentage: f32) -> bool {
match self {
Node::Split {
id, ratio, a, b, ..
} => {
if id == split {
if *id == split {
*ratio = percentage;
true
@ -158,13 +158,13 @@ impl Node {
}
}
pub(crate) fn remove(&mut self, pane: &Pane) -> Option<Pane> {
pub(crate) fn remove(&mut self, pane: Pane) -> Option<Pane> {
match self {
Node::Split { a, b, .. } => {
if a.pane() == Some(*pane) {
if a.pane() == Some(pane) {
*self = *b.clone();
Some(self.first_pane())
} else if b.pane() == Some(*pane) {
} else if b.pane() == Some(pane) {
*self = *a.clone();
Some(self.first_pane())
} else {