Skip to content

Commit

Permalink
Fix Clippy warnings (#132)
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicceboy authored Aug 2, 2023
1 parent 58a8777 commit 407886a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 11 deletions.
8 changes: 3 additions & 5 deletions macros/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -570,12 +570,10 @@ impl<'config> VariantConfig<'config> {
} else {
quote!(decoder.decode_default_with_tag(tag, #path))
}
} else if let Some(constraints) = constraints {
quote!(<_>::decode_with_tag_and_constraints(decoder, tag, #constraints))
} else {
if let Some(constraints) = constraints {
quote!(<_>::decode_with_tag_and_constraints(decoder, tag, #constraints))
} else {
quote!(<_>::decode_with_tag(decoder, tag))
}
quote!(<_>::decode_with_tag(decoder, tag))
}
} else if let Some(path) = field.default {
let path = path
Expand Down
4 changes: 1 addition & 3 deletions macros/src/enum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -341,12 +341,10 @@ impl Enum {
} else {
quote!(#crate_root::Encode::encode_with_tag(value, encoder, #variant_tag))
}
} else {
if let Some(constraints) = constraints {
} else if let Some(constraints) = constraints {
quote!(#crate_root::Encode::encode_with_constraints(value, encoder, #constraints))
} else {
quote!(#crate_root::Encode::encode(value, encoder))
}
};

quote! {
Expand Down
6 changes: 3 additions & 3 deletions src/per/enc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ impl Encoder {
return self.encode_unconstrained_length(buffer, length, None, encode_fn);
};

if matches!(constraints.extensible, None) {
if constraints.extensible.is_none() {
Error::check_length(length, &constraints.constraint)?;
} else if constraints.constraint.contains(&length) {
buffer.push(false);
Expand Down Expand Up @@ -438,7 +438,7 @@ impl Encoder {
return self.encode_unconstrained_length(buffer, length, None, encode_fn);
};

if matches!(constraints.extensible, None) {
if constraints.extensible.is_none() {
Error::check_length(length, &constraints.constraint)?;
} else if constraints.constraint.contains(&length) {
buffer.push(false);
Expand Down Expand Up @@ -625,7 +625,7 @@ impl Encoder {
self.encode_length(buffer, bytes.len(), constraints.size(), |range| {
Ok(BitString::from_slice(&bytes[range]))
})?;
return Ok(())
return Ok(());
};

let bytes = match value_range.constraint.effective_bigint_value(value.clone()) {
Expand Down

0 comments on commit 407886a

Please sign in to comment.