Skip to content

Commit 74f6e16

Browse files
Merge branch 'trunk' into docs/update-specs
2 parents d5a2b1f + 75b2928 commit 74f6e16

14 files changed

+46
-74
lines changed

.github/workflows/cifuzz.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
},
2828
{
2929
"name": "Upload Crash",
30-
"uses": "actions/upload-artifact@v3",
30+
"uses": "actions/upload-artifact@v4",
3131
"if": "failure() && steps.build.outcome == 'success'",
3232
"with": {
3333
"name": "artifacts",

.github/workflows/cross_platform.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,8 @@
114114
# "mips64-unknown-linux-muslabi64",
115115
# "mips64el-unknown-linux-muslabi64",
116116
# "mipsel-unknown-linux-musl",
117-
"sparc64-unknown-linux-gnu",
117+
# Could not link to `getrandom`
118+
# "sparc64-unknown-linux-gnu",
118119
# BLOCKEDTODO(https://github.com/cross-rs/cross/issues/975): currently broken
119120
# "sparcv9-sun-solaris",
120121
"thumbv7neon-linux-androideabi",

.github/workflows/rust.yml

+2-41
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ fi",
140140
"uses": "actions-rs/toolchain@v1",
141141
"with": {
142142
"profile": "minimal",
143-
"toolchain": "stable",
143+
"toolchain": "1.85.0",
144144
"override": true,
145145
"components": "rustfmt, clippy"
146146
},
@@ -176,7 +176,7 @@ fi",
176176
"uses": "actions-rs/toolchain@v1",
177177
"with": {
178178
"profile": "minimal",
179-
"toolchain": "stable",
179+
"toolchain": "1.85.0",
180180
"override": true,
181181
},
182182
"name": "Install Rust stable"
@@ -190,45 +190,6 @@ fi",
190190
"name": "Run compatibility tests"
191191
}
192192
]
193-
},
194-
"coverage": {
195-
"name": "Code Coverage",
196-
"runs-on": "ubuntu-latest",
197-
"steps": [
198-
{
199-
"uses": "actions/checkout@v4",
200-
"name": "Checkout"
201-
},
202-
{
203-
"uses": "actions-rs/toolchain@v1",
204-
"with": {
205-
"profile": "minimal",
206-
"toolchain": "nightly",
207-
"override": true
208-
},
209-
"name": "Install Rust nightly"
210-
},
211-
{
212-
"name": "Run cargo-tarpaulin",
213-
"uses": "actions-rs/[email protected]",
214-
"with": {
215-
"version": "0.19.1",
216-
"args": "--all --all-features"
217-
}
218-
},
219-
{
220-
"name": "Upload to codecov.io",
221-
"uses": "codecov/codecov-action@v3"
222-
},
223-
{
224-
"name": "Archive code coverage results",
225-
"uses": "actions/upload-artifact@v3",
226-
"with": {
227-
"name": "code-coverage-report",
228-
"path": "cobertura.xml"
229-
}
230-
}
231-
]
232193
}
233194
}
234195
}

src/de/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ pub trait BorrowDecoder<'de>: Decoder {
215215
fn borrow_reader(&mut self) -> &mut Self::BR;
216216
}
217217

218-
impl<'a, T> Decoder for &'a mut T
218+
impl<T> Decoder for &mut T
219219
where
220220
T: Decoder,
221221
{
@@ -242,7 +242,7 @@ where
242242
}
243243
}
244244

245-
impl<'a, 'de, T> BorrowDecoder<'de> for &'a mut T
245+
impl<'de, T> BorrowDecoder<'de> for &mut T
246246
where
247247
T: BorrowDecoder<'de>,
248248
{

src/enc/impls.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -329,20 +329,20 @@ fn encode_utf8(writer: &mut impl Writer, c: char) -> Result<(), EncodeError> {
329329
writer.write(&[c as u8])
330330
} else if code < MAX_TWO_B {
331331
let mut buf = [0u8; 2];
332-
buf[0] = (code >> 6 & 0x1F) as u8 | TAG_TWO_B;
332+
buf[0] = ((code >> 6) & 0x1F) as u8 | TAG_TWO_B;
333333
buf[1] = (code & 0x3F) as u8 | TAG_CONT;
334334
writer.write(&buf)
335335
} else if code < MAX_THREE_B {
336336
let mut buf = [0u8; 3];
337-
buf[0] = (code >> 12 & 0x0F) as u8 | TAG_THREE_B;
338-
buf[1] = (code >> 6 & 0x3F) as u8 | TAG_CONT;
337+
buf[0] = ((code >> 12) & 0x0F) as u8 | TAG_THREE_B;
338+
buf[1] = ((code >> 6) & 0x3F) as u8 | TAG_CONT;
339339
buf[2] = (code & 0x3F) as u8 | TAG_CONT;
340340
writer.write(&buf)
341341
} else {
342342
let mut buf = [0u8; 4];
343-
buf[0] = (code >> 18 & 0x07) as u8 | TAG_FOUR_B;
344-
buf[1] = (code >> 12 & 0x3F) as u8 | TAG_CONT;
345-
buf[2] = (code >> 6 & 0x3F) as u8 | TAG_CONT;
343+
buf[0] = ((code >> 18) & 0x07) as u8 | TAG_FOUR_B;
344+
buf[1] = ((code >> 12) & 0x3F) as u8 | TAG_CONT;
345+
buf[2] = ((code >> 6) & 0x3F) as u8 | TAG_CONT;
346346
buf[3] = (code & 0x3F) as u8 | TAG_CONT;
347347
writer.write(&buf)
348348
}
@@ -481,7 +481,7 @@ where
481481
}
482482
}
483483

484-
impl<'a, T> Encode for &'a T
484+
impl<T> Encode for &T
485485
where
486486
T: Encode + ?Sized,
487487
{

src/enc/mod.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ pub use self::encoder::EncoderImpl;
4747
/// ```
4848
///
4949
/// From here you can add/remove fields, or add custom logic.
50-
5150
pub trait Encode {
5251
/// Encode a given type.
5352
fn encode<E: Encoder>(&self, encoder: &mut E) -> Result<(), EncodeError>;
@@ -68,7 +67,7 @@ pub trait Encoder: Sealed {
6867
fn config(&self) -> &Self::C;
6968
}
7069

71-
impl<'a, T> Encoder for &'a mut T
70+
impl<T> Encoder for &mut T
7271
where
7372
T: Encoder,
7473
{

src/enc/write.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ impl<'storage> SliceWriter<'storage> {
5252
}
5353
}
5454

55-
impl<'storage> Writer for SliceWriter<'storage> {
55+
impl Writer for SliceWriter<'_> {
5656
#[inline(always)]
5757
fn write(&mut self, bytes: &[u8]) -> Result<(), EncodeError> {
5858
if bytes.len() > self.slice.len() {

src/features/impl_alloc.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,7 @@ where
397397
}
398398
}
399399

400-
impl<'cow, T> Decode for Cow<'cow, T>
400+
impl<T> Decode for Cow<'_, T>
401401
where
402402
T: ToOwned + ?Sized,
403403
<T as ToOwned>::Owned: Decode,
@@ -418,7 +418,7 @@ where
418418
}
419419
}
420420

421-
impl<'cow, T> Encode for Cow<'cow, T>
421+
impl<T> Encode for Cow<'_, T>
422422
where
423423
T: ToOwned + ?Sized,
424424
for<'a> &'a T: Encode,

src/features/impl_std.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ impl<'a, W: std::io::Write> IoWriter<'a, W> {
114114
}
115115
}
116116

117-
impl<'storage, W: std::io::Write> Writer for IoWriter<'storage, W> {
117+
impl<W: std::io::Write> Writer for IoWriter<'_, W> {
118118
#[inline(always)]
119119
fn write(&mut self, bytes: &[u8]) -> Result<(), EncodeError> {
120120
self.writer
@@ -128,7 +128,7 @@ impl<'storage, W: std::io::Write> Writer for IoWriter<'storage, W> {
128128
}
129129
}
130130

131-
impl<'a> Encode for &'a CStr {
131+
impl Encode for &CStr {
132132
fn encode<E: Encoder>(&self, encoder: &mut E) -> Result<(), EncodeError> {
133133
self.to_bytes().encode(encoder)
134134
}

src/features/serde/de_borrowed.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ pub(super) struct SerdeDecoder<'a, 'de, DE: BorrowDecoder<'de>> {
6969
pub(super) pd: PhantomData<&'de ()>,
7070
}
7171

72-
impl<'a, 'de, DE: BorrowDecoder<'de>> Deserializer<'de> for SerdeDecoder<'a, 'de, DE> {
72+
impl<'de, DE: BorrowDecoder<'de>> Deserializer<'de> for SerdeDecoder<'_, 'de, DE> {
7373
type Error = DecodeError;
7474

7575
fn deserialize_any<V>(self, _: V) -> Result<V::Value, Self::Error>
@@ -433,7 +433,7 @@ impl<'a, 'de, DE: BorrowDecoder<'de>> Deserializer<'de> for SerdeDecoder<'a, 'de
433433
}
434434
}
435435

436-
impl<'de, 'a, DE: BorrowDecoder<'de>> EnumAccess<'de> for SerdeDecoder<'a, 'de, DE> {
436+
impl<'de, DE: BorrowDecoder<'de>> EnumAccess<'de> for SerdeDecoder<'_, 'de, DE> {
437437
type Error = DecodeError;
438438
type Variant = Self;
439439

@@ -447,7 +447,7 @@ impl<'de, 'a, DE: BorrowDecoder<'de>> EnumAccess<'de> for SerdeDecoder<'a, 'de,
447447
}
448448
}
449449

450-
impl<'de, 'a, DE: BorrowDecoder<'de>> VariantAccess<'de> for SerdeDecoder<'a, 'de, DE> {
450+
impl<'de, DE: BorrowDecoder<'de>> VariantAccess<'de> for SerdeDecoder<'_, 'de, DE> {
451451
type Error = DecodeError;
452452

453453
fn unit_variant(self) -> Result<(), Self::Error> {

src/features/serde/de_owned.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ pub(crate) struct SerdeDecoder<'a, DE: Decoder> {
6262
pub(crate) de: &'a mut DE,
6363
}
6464

65-
impl<'a, 'de, DE: Decoder> Deserializer<'de> for SerdeDecoder<'a, DE> {
65+
impl<'de, DE: Decoder> Deserializer<'de> for SerdeDecoder<'_, DE> {
6666
type Error = DecodeError;
6767

6868
fn deserialize_any<V>(self, _: V) -> Result<V::Value, Self::Error>
@@ -438,7 +438,7 @@ impl<'a, 'de, DE: Decoder> Deserializer<'de> for SerdeDecoder<'a, DE> {
438438
}
439439
}
440440

441-
impl<'de, 'a, DE: Decoder> EnumAccess<'de> for SerdeDecoder<'a, DE> {
441+
impl<'de, DE: Decoder> EnumAccess<'de> for SerdeDecoder<'_, DE> {
442442
type Error = DecodeError;
443443
type Variant = Self;
444444

@@ -452,7 +452,7 @@ impl<'de, 'a, DE: Decoder> EnumAccess<'de> for SerdeDecoder<'a, DE> {
452452
}
453453
}
454454

455-
impl<'de, 'a, DE: Decoder> VariantAccess<'de> for SerdeDecoder<'a, DE> {
455+
impl<'de, DE: Decoder> VariantAccess<'de> for SerdeDecoder<'_, DE> {
456456
type Error = DecodeError;
457457

458458
fn unit_variant(self) -> Result<(), Self::Error> {

src/features/serde/mod.rs

+11
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,19 @@
5252
//!
5353
//! **Using any of the above attributes can and will cause issues with bincode and will result in lost data**. Consider using bincode's own derive macro instead.
5454
//!
55+
//! # Why move away from serde?
56+
//!
57+
//! Serde is a great library, but it has some issues that makes us want to be decoupled from serde:
58+
//! - The issues documented above with attributes.
59+
//! - Serde has chosen to not have a MSRV ([source](https://github.com/serde-rs/serde/pull/2257)). We think MSRV is important, bincode 1 still compiles with rust 1.18.
60+
//! - Before serde we had rustc-serializer. Serde has more than replaced rustc-serializer, but we can imagine a future where serde is replaced by something else.
61+
//! - We believe that less dependencies is better, and that you should be able to choose your own dependencies. If you disable all features, bincode 2 only has 1 dependency. ([`unty`], a micro crate we manage ourselves)
62+
//!
63+
//! **note:** just because we're making serde an optional dependency, it does not mean we're dropping support for serde. Serde will still be fully supported, we're just giving you the option to not use it.
64+
//!
5565
//! [Decode]: ../de/trait.Decode.html
5666
//! [Encode]: ../enc/trait.Encode.html
67+
//! [`unty`]: https://crates.io/crates/unty
5768
5869
mod de_borrowed;
5970
mod de_owned;

src/features/serde/ser.rs

+8-8
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ pub(super) struct SerdeEncoder<'a, ENC: Encoder> {
7979
pub(super) enc: &'a mut ENC,
8080
}
8181

82-
impl<'a, ENC> Serializer for SerdeEncoder<'a, ENC>
82+
impl<ENC> Serializer for SerdeEncoder<'_, ENC>
8383
where
8484
ENC: Encoder,
8585
{
@@ -286,7 +286,7 @@ where
286286

287287
type Compound<'a, ENC> = SerdeEncoder<'a, ENC>;
288288

289-
impl<'a, ENC: Encoder> SerializeSeq for Compound<'a, ENC> {
289+
impl<ENC: Encoder> SerializeSeq for Compound<'_, ENC> {
290290
type Ok = ();
291291
type Error = EncodeError;
292292

@@ -302,7 +302,7 @@ impl<'a, ENC: Encoder> SerializeSeq for Compound<'a, ENC> {
302302
}
303303
}
304304

305-
impl<'a, ENC: Encoder> SerializeTuple for Compound<'a, ENC> {
305+
impl<ENC: Encoder> SerializeTuple for Compound<'_, ENC> {
306306
type Ok = ();
307307
type Error = EncodeError;
308308

@@ -318,7 +318,7 @@ impl<'a, ENC: Encoder> SerializeTuple for Compound<'a, ENC> {
318318
}
319319
}
320320

321-
impl<'a, ENC: Encoder> SerializeTupleStruct for Compound<'a, ENC> {
321+
impl<ENC: Encoder> SerializeTupleStruct for Compound<'_, ENC> {
322322
type Ok = ();
323323
type Error = EncodeError;
324324

@@ -334,7 +334,7 @@ impl<'a, ENC: Encoder> SerializeTupleStruct for Compound<'a, ENC> {
334334
}
335335
}
336336

337-
impl<'a, ENC: Encoder> SerializeTupleVariant for Compound<'a, ENC> {
337+
impl<ENC: Encoder> SerializeTupleVariant for Compound<'_, ENC> {
338338
type Ok = ();
339339
type Error = EncodeError;
340340

@@ -350,7 +350,7 @@ impl<'a, ENC: Encoder> SerializeTupleVariant for Compound<'a, ENC> {
350350
}
351351
}
352352

353-
impl<'a, ENC: Encoder> SerializeMap for Compound<'a, ENC> {
353+
impl<ENC: Encoder> SerializeMap for Compound<'_, ENC> {
354354
type Ok = ();
355355
type Error = EncodeError;
356356

@@ -373,7 +373,7 @@ impl<'a, ENC: Encoder> SerializeMap for Compound<'a, ENC> {
373373
}
374374
}
375375

376-
impl<'a, ENC: Encoder> SerializeStruct for Compound<'a, ENC> {
376+
impl<ENC: Encoder> SerializeStruct for Compound<'_, ENC> {
377377
type Ok = ();
378378
type Error = EncodeError;
379379

@@ -389,7 +389,7 @@ impl<'a, ENC: Encoder> SerializeStruct for Compound<'a, ENC> {
389389
}
390390
}
391391

392-
impl<'a, ENC: Encoder> SerializeStructVariant for Compound<'a, ENC> {
392+
impl<ENC: Encoder> SerializeStructVariant for Compound<'_, ENC> {
393393
type Ok = ();
394394
type Error = EncodeError;
395395

src/utils.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
pub trait Sealed {}
22

3-
impl<'a, T> Sealed for &'a mut T where T: Sealed {}
3+
impl<T> Sealed for &mut T where T: Sealed {}

0 commit comments

Comments
 (0)