Skip to content

Commit

Permalink
rust: use "map_or" instead of "if let"
Browse files Browse the repository at this point in the history
Co-authored-by: Vincenzo Palazzo <[email protected]>
Signed-off-by: Vincenzo Palazzo <[email protected]>
  • Loading branch information
daywalker90 and vincenzopalazzo committed Dec 16, 2023
1 parent 09c1cfd commit 56d42ea
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions cln-rpc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,7 @@ 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()
f.as_ref().map_or(true, |value| value.is_empty())
}

#[cfg(test)]
Expand Down

0 comments on commit 56d42ea

Please sign in to comment.