From a2611e12df72698502a978064fc20e739898dcd1 Mon Sep 17 00:00:00 2001 From: overlookmotel Date: Sat, 19 Oct 2024 09:44:33 +0100 Subject: [PATCH] style(ast_tools): do not use `ref` in matches --- tasks/ast_tools/src/derives/estree.rs | 2 +- tasks/ast_tools/src/passes/linker.rs | 4 ++-- tasks/ast_tools/src/schema/serialize.rs | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/tasks/ast_tools/src/derives/estree.rs b/tasks/ast_tools/src/derives/estree.rs index 2ec0f915115817..76f938c6c147e9 100644 --- a/tasks/ast_tools/src/derives/estree.rs +++ b/tasks/ast_tools/src/derives/estree.rs @@ -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 { diff --git a/tasks/ast_tools/src/passes/linker.rs b/tasks/ast_tools/src/passes/linker.rs index cac898840f8425..2a2d97b964f635 100644 --- a/tasks/ast_tools/src/passes/linker.rs +++ b/tasks/ast_tools/src/passes/linker.rs @@ -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:?}"))?; diff --git a/tasks/ast_tools/src/schema/serialize.rs b/tasks/ast_tools/src/schema/serialize.rs index abd61ce7cc98ba..623402fdf04c8f 100644 --- a/tasks/ast_tools/src/schema/serialize.rs +++ b/tasks/ast_tools/src/schema/serialize.rs @@ -16,9 +16,9 @@ pub fn enum_variant_name(var: &VariantDef, enm: &EnumDef) -> String { } pub fn get_type_tag(def: &StructDef) -> Option { - 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")));