Skip to content

Commit e6593a0

Browse files
sw17chenarxbot
authored andcommitted
fix: two instances of clippy::unnecessary_lazy_evaluations
Fix two cases where `.unwrap_or_else()` can be replaced with `.unwrap_or()` without causing other problems. Signed-off-by: John VanEnk <[email protected]>
1 parent a0455b5 commit e6593a0

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

ciborium-ll/src/enc.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ impl<W: Write> Encoder<W> {
6868
value: &[u8],
6969
segment: impl Into<Option<usize>>,
7070
) -> Result<(), W::Error> {
71-
let max = segment.into().unwrap_or_else(|| value.len());
71+
let max = segment.into().unwrap_or(value.len());
7272
let max = core::cmp::max(max, 1);
7373

7474
if max >= value.len() {
@@ -97,7 +97,7 @@ impl<W: Write> Encoder<W> {
9797
/// should not be relied upon.
9898
#[inline]
9999
pub fn text(&mut self, value: &str, segment: impl Into<Option<usize>>) -> Result<(), W::Error> {
100-
let max = segment.into().unwrap_or_else(|| value.len());
100+
let max = segment.into().unwrap_or(value.len());
101101
let max = core::cmp::max(max, 4);
102102

103103
if max >= value.len() {

0 commit comments

Comments
 (0)