Skip to content

Commit

Permalink
fix the mutable variable warning
Browse files Browse the repository at this point in the history
  • Loading branch information
camshaft committed Aug 11, 2023
1 parent fff5e09 commit d6e6ffc
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion common/s2n-codec/src/encoder/scatter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -156,15 +156,21 @@ impl<'a> Encoder for Buffer<'a> {
}

#[inline]
#[cfg(feature = "bytes")]
fn len(&self) -> usize {
let mut len = self.inner.len();

// make sure our len includes the extra bytes if we have them
#[cfg(feature = "bytes")]
if let Some(extra) = self.extra.as_ref() {
len += extra.len();
}

len
}

#[inline]
#[cfg(not(feature = "bytes"))]
fn len(&self) -> usize {
self.inner.len()
}
}

0 comments on commit d6e6ffc

Please sign in to comment.