Skip to content

Commit

Permalink
Merge branch 'trunk' into feature/decode_from_slice_with_len
Browse files Browse the repository at this point in the history
  • Loading branch information
VictorKoenders authored Dec 10, 2021
2 parents d4a8533 + 1401776 commit d13d7f8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions derive/src/parse/generics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ impl Generics {
#[allow(clippy::enum_variant_names)]
enum Generic {
Lifetime(Lifetime),
Generic(SimpleGeneric),
Simple(SimpleGeneric),
Const(ConstGeneric),
}

Expand All @@ -137,7 +137,7 @@ impl Generic {
fn ident(&self) -> Ident {
match self {
Self::Lifetime(lt) => lt.ident.clone(),
Self::Generic(gen) => gen.ident.clone(),
Self::Simple(gen) => gen.ident.clone(),
Self::Const(gen) => gen.ident.clone(),
}
}
Expand All @@ -152,23 +152,23 @@ impl Generic {
fn has_constraints(&self) -> bool {
match self {
Self::Lifetime(lt) => !lt.constraint.is_empty(),
Self::Generic(gen) => !gen.constraints.is_empty(),
Self::Simple(gen) => !gen.constraints.is_empty(),
Self::Const(_) => true, // const generics always have a constraint
}
}

fn constraints(&self) -> Vec<TokenTree> {
match self {
Self::Lifetime(lt) => lt.constraint.clone(),
Self::Generic(gen) => gen.constraints.clone(),
Self::Simple(gen) => gen.constraints.clone(),
Self::Const(gen) => gen.constraints.clone(),
}
}

fn append_to_result_with_constraints(&self, builder: &mut StreamBuilder) {
match self {
Self::Lifetime(lt) => builder.lifetime(lt.ident.clone()),
Self::Generic(gen) => {
Self::Simple(gen) => {
builder.ident(gen.ident.clone());
}
Self::Const(gen) => {
Expand All @@ -191,7 +191,7 @@ impl From<Lifetime> for Generic {

impl From<SimpleGeneric> for Generic {
fn from(gen: SimpleGeneric) -> Self {
Self::Generic(gen)
Self::Simple(gen)
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/de/impl_core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ where
// SAFETY: this slice will contain only initialized objects.
unsafe {
core::ptr::drop_in_place(slice_assume_init_mut(
&mut self.array_mut.get_unchecked_mut(..self.initialized),
self.array_mut.get_unchecked_mut(..self.initialized),
));
}
}
Expand Down

0 comments on commit d13d7f8

Please sign in to comment.