Skip to content

Commit

Permalink
style(ast_tools): do not use ref in matches
Browse files Browse the repository at this point in the history
  • Loading branch information
overlookmotel committed Oct 19, 2024
1 parent 2423655 commit a2611e1
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion tasks/ast_tools/src/derives/estree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ fn serialize_struct(def: &StructDef) -> TokenStream {
let type_tag = get_type_tag(def);

let mut fields = vec![];
if let Some(ref ty) = type_tag {
if let Some(ty) = &type_tag {
fields.push(quote! { map.serialize_entry("type", #ty)?; });
}
for field in &def.fields {
Expand Down
4 changes: 2 additions & 2 deletions tasks/ast_tools/src/passes/linker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ impl Pass for Linker {
.meta
.inherits
.drain(..)
.map(|it| match it {
Inherit::Unlinked(ref sup) => {
.map(|it| match &it {
Inherit::Unlinked(sup) => {
let linkee = ctx
.find(&Cow::Owned(sup.to_string()))
.normalize_with(format!("Unknown type {sup:?}"))?;
Expand Down
4 changes: 2 additions & 2 deletions tasks/ast_tools/src/schema/serialize.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ pub fn enum_variant_name(var: &VariantDef, enm: &EnumDef) -> String {
}

pub fn get_type_tag(def: &StructDef) -> Option<String> {
match def.markers.estree {
match &def.markers.estree {
Some(ESTreeStructAttribute::NoType) => None,
Some(ESTreeStructAttribute::Type(ref type_name)) => Some(type_name.clone()),
Some(ESTreeStructAttribute::Type(type_name)) => Some(type_name.clone()),
Some(ESTreeStructAttribute::CustomSerialize) | None => {
let has_type_field =
def.fields.iter().any(|f| matches!(f.name.as_deref(), Some("type")));
Expand Down

0 comments on commit a2611e1

Please sign in to comment.