1
Fork 0

Move finish out of the Encoder trait.

This simplifies things, but requires making `CacheEncoder` non-generic.

(This was previously merged as commit 4 in #94732 and then was reverted
in #97905 because it caused a perf regression.)
This commit is contained in:
Nicholas Nethercote 2022-06-16 16:00:25 +10:00
parent ca983054e1
commit bb02cc47c4
13 changed files with 51 additions and 111 deletions

View file

@ -2,7 +2,7 @@
use rustc_macros::{Decodable, Encodable};
use rustc_serialize::opaque::{MemDecoder, MemEncoder};
use rustc_serialize::{Decodable, Encodable, Encoder as EncoderTrait};
use rustc_serialize::{Decodable, Encodable};
use std::fmt::Debug;
#[derive(PartialEq, Clone, Debug, Encodable, Decodable)]
@ -38,7 +38,7 @@ fn check_round_trip<
Encodable::encode(value, &mut encoder);
}
let data = encoder.finish().unwrap();
let data = encoder.finish();
let mut decoder = MemDecoder::new(&data[..], 0);
for value in values {