Skip to content

Commit 10ad061

Browse files
committed
Merge remote-tracking branch 'origin/main'
2 parents d500162 + bc6fb3b commit 10ad061

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,8 @@
9898
#![warn(clippy::expect_used)]
9999
#![allow(clippy::missing_const_for_fn)]
100100
#![warn(clippy::multiple_crate_versions)]
101-
// the bytes feature uses unsafe to improve from_reader performance
101+
// the bytes feature uses unsafe to improve from_reader performance; so we need to relax this lint
102+
#![cfg_attr(feature = "bytes", deny(unsafe_code))]
102103
#![cfg_attr(not(feature = "bytes"), forbid(unsafe_code))]
103104

104105
mod blob_cache;

src/slice/slice_bytes.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,15 +47,16 @@ impl Slice {
4747
// SAFETY: we just allocated `len` bytes, and `read_exact` will fail if
4848
// it doesn't fill the buffer, subsequently dropping the uninitialized
4949
// BytesMut object
50+
#[allow(unsafe_code)]
5051
unsafe {
5152
builder.set_len(len);
5253
}
5354

54-
/// SAFETY: Normally, read_exact over an uninitialized buffer is UB,
55-
/// however we know that in lsm-tree etc. only I/O readers or cursors over Vecs are used
56-
/// so it's safe
57-
///
58-
/// The safe API is unstable: https://github.com/rust-lang/rust/issues/78485
55+
// SAFETY: Normally, read_exact over an uninitialized buffer is UB,
56+
// however we know that in lsm-tree etc. only I/O readers or cursors over Vecs are used
57+
// so it's safe
58+
//
59+
// The safe API is unstable: https://github.com/rust-lang/rust/issues/78485
5960
reader.read_exact(&mut builder)?;
6061

6162
Ok(Self(builder.freeze()))

0 commit comments

Comments
 (0)