Skip to content

Commit

Permalink
fix unwrap
Browse files Browse the repository at this point in the history
  • Loading branch information
sam0x17 committed Aug 9, 2024
1 parent 567696f commit 7aa4dc8
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions support/linting/src/require_freeze_struct.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,7 @@ struct EncodeDecodeVisitor {

impl<'ast> Visit<'ast> for EncodeDecodeVisitor {
fn visit_item_struct(&mut self, node: &'ast ItemStruct) {
let has_encode_decode = node
.attrs
.iter()
.any(is_derive_encode_or_decode);
let has_encode_decode = node.attrs.iter().any(is_derive_encode_or_decode);
let has_freeze_struct = node.attrs.iter().any(is_freeze_struct);

if has_encode_decode && !has_freeze_struct {
Expand Down Expand Up @@ -78,7 +75,7 @@ mod tests {
use super::*;

fn lint_struct(input: &str) -> Result<()> {
let item_struct: ItemStruct = syn::parse_str(input).unwrap();
let item_struct: ItemStruct = syn::parse_str(input).expect("should only use on a struct");
let mut visitor = EncodeDecodeVisitor::default();
visitor.visit_item_struct(&item_struct);
if visitor.errors.is_empty() {
Expand Down

0 comments on commit 7aa4dc8

Please sign in to comment.