Skip to content

Commit 7a5ddd9

Browse files
committed
remove arithmetic_side_effects
part of #4071
1 parent 08c3416 commit 7a5ddd9

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,6 @@ restriction = { level = "warn", priority = -2 }
113113

114114
# lints to decide on
115115

116-
arithmetic_side_effects = "allow" # TODO: consider
117116
as_conversions = "allow" # TODO: tricky
118117
cast_possible_truncation = "allow" # TODO: consider
119118
cast_precision_loss = "allow" # TODO: consider

src/rt/io.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,13 @@ impl<'data> ReadBuf<'data> {
300300
}
301301

302302
#[inline]
303+
#[allow(clippy::arithmetic_side_effects)]
303304
fn remaining(&self) -> usize {
305+
debug_assert!(
306+
self.capacity() >= self.filled,
307+
"filled must fit in capacity()"
308+
);
309+
// Cannot overflow, asserted above
304310
self.capacity() - self.filled
305311
}
306312

@@ -359,6 +365,7 @@ impl ReadBufCursor<'_> {
359365
///
360366
/// `self` must have enough remaining capacity to contain all of `src`.
361367
#[inline]
368+
#[allow(clippy::arithmetic_side_effects)]
362369
pub fn put_slice(&mut self, src: &[u8]) {
363370
assert!(
364371
self.buf.remaining() >= src.len(),

0 commit comments

Comments
 (0)