Skip to content

Commit

Permalink
Fix attributes.
Browse files Browse the repository at this point in the history
  • Loading branch information
finnbear committed Sep 20, 2024
1 parent a31ad47 commit 02b07ec
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/serde/de.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,13 +111,13 @@ struct DecoderWrapper<'a, 'de> {

macro_rules! specify {
($self:ident, $variant:ident) => {{
#[rustfmt::skip]
match &mut $self.decoder {
// Check if it's already the correct decoder. This results in 1 branch in the hot path.
SerdeDecoder::$variant(_) => (),
_ => {
// Either create the correct decoder if unspecified or diverge via panic/error.
#[cold]
#[rustfmt::skip]
fn cold<'de>(decoder: &mut SerdeDecoder<'de>, input: &mut &'de [u8]) -> Result<()> {
let &mut SerdeDecoder::Unspecified { length } = decoder else {
type_changed!()
Expand All @@ -128,6 +128,7 @@ macro_rules! specify {
cold(&mut *$self.decoder, &mut *$self.input)?;
}
}
#[rustfmt::skip]
let SerdeDecoder::$variant(d) = &mut *$self.decoder else {
// Safety: `cold` gets called when decoder isn't the correct decoder. `cold` either
// errors or sets lazy to the correct decoder.
Expand Down

0 comments on commit 02b07ec

Please sign in to comment.