From bb0a3680ec6cb15c5e35643cd54a82ee551e7027 Mon Sep 17 00:00:00 2001 From: Mattias Wallin Date: Sun, 1 Sep 2024 13:13:14 +0200 Subject: [PATCH] Avoid allocation in `ChainItemKind::is_tup_field_access` --- src/chains.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/chains.rs b/src/chains.rs index a3f70055425..f7331ea9722 100644 --- a/src/chains.rs +++ b/src/chains.rs @@ -209,7 +209,7 @@ impl ChainItemKind { fn is_tup_field_access(expr: &ast::Expr) -> bool { match expr.kind { ast::ExprKind::Field(_, ref field) => { - field.name.to_string().chars().all(|c| c.is_digit(10)) + field.name.as_str().chars().all(|c| c.is_digit(10)) } _ => false, }