Skip to content

Commit

Permalink
rewrite is_none_or_empty to not use clone()
Browse files Browse the repository at this point in the history
  • Loading branch information
daywalker90 committed Nov 14, 2023
1 parent 02ca226 commit 6a50b17
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions cln-rpc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,11 @@ fn is_none_or_empty<T>(f: &Option<Vec<T>>) -> bool
where
T: Clone,
{
// TODO Find a better way to check, possibly without cloning
let f = f.clone();
f.is_none() || f.unwrap().is_empty()
if let Some(inner) = f {
inner.is_empty()
} else {
true
}
}

#[cfg(test)]
Expand Down

0 comments on commit 6a50b17

Please sign in to comment.