File tree 2 files changed +8
-6
lines changed
2 files changed +8
-6
lines changed Original file line number Diff line number Diff line change 98
98
#![ warn( clippy:: expect_used) ]
99
99
#![ allow( clippy:: missing_const_for_fn) ]
100
100
#![ 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) ) ]
102
103
#![ cfg_attr( not( feature = "bytes" ) , forbid( unsafe_code) ) ]
103
104
104
105
mod blob_cache;
Original file line number Diff line number Diff line change @@ -47,15 +47,16 @@ impl Slice {
47
47
// SAFETY: we just allocated `len` bytes, and `read_exact` will fail if
48
48
// it doesn't fill the buffer, subsequently dropping the uninitialized
49
49
// BytesMut object
50
+ #[ allow( unsafe_code) ]
50
51
unsafe {
51
52
builder. set_len ( len) ;
52
53
}
53
54
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
59
60
reader. read_exact ( & mut builder) ?;
60
61
61
62
Ok ( Self ( builder. freeze ( ) ) )
You can’t perform that action at this time.
0 commit comments