public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Maximiliano Sandoval <m.sandoval@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [pbs-devel] [PATCH backup 2/3] network: lexer: Simplify KEYWORDS declaration
Date: Tue, 13 Feb 2024 10:03:14 +0100	[thread overview]
Message-ID: <20240213090314.111162-2-m.sandoval@proxmox.com> (raw)
In-Reply-To: <20240213090314.111162-1-m.sandoval@proxmox.com>

Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
---
 pbs-config/src/network/lexer.rs | 51 +++++++++++++++++----------------
 1 file changed, 26 insertions(+), 25 deletions(-)

diff --git a/pbs-config/src/network/lexer.rs b/pbs-config/src/network/lexer.rs
index 2ab5eb5a..c684338b 100644
--- a/pbs-config/src/network/lexer.rs
+++ b/pbs-config/src/network/lexer.rs
@@ -32,31 +32,32 @@ pub enum Token {
 }
 
 static KEYWORDS: Lazy<HashMap<&'static str, Token>> = Lazy::new(|| {
-    let mut map = HashMap::new();
-    map.insert("address", Token::Address);
-    map.insert("auto", Token::Auto);
-    map.insert("dhcp", Token::DHCP);
-    map.insert("gateway", Token::Gateway);
-    map.insert("inet", Token::Inet);
-    map.insert("inet6", Token::Inet6);
-    map.insert("iface", Token::Iface);
-    map.insert("loopback", Token::Loopback);
-    map.insert("manual", Token::Manual);
-    map.insert("netmask", Token::Netmask);
-    map.insert("static", Token::Static);
-    map.insert("mtu", Token::MTU);
-    map.insert("bridge-ports", Token::BridgePorts);
-    map.insert("bridge_ports", Token::BridgePorts);
-    map.insert("bridge-vlan-aware", Token::BridgeVlanAware);
-    map.insert("bridge_vlan_aware", Token::BridgeVlanAware);
-    map.insert("bond-slaves", Token::BondSlaves);
-    map.insert("bond_slaves", Token::BondSlaves);
-    map.insert("bond-mode", Token::BondMode);
-    map.insert("bond-primary", Token::BondPrimary);
-    map.insert("bond_primary", Token::BondPrimary);
-    map.insert("bond_xmit_hash_policy", Token::BondXmitHashPolicy);
-    map.insert("bond-xmit-hash-policy", Token::BondXmitHashPolicy);
-    map
+    [
+        ("address", Token::Address),
+        ("auto", Token::Auto),
+        ("dhcp", Token::DHCP),
+        ("gateway", Token::Gateway),
+        ("inet", Token::Inet),
+        ("inet6", Token::Inet6),
+        ("iface", Token::Iface),
+        ("loopback", Token::Loopback),
+        ("manual", Token::Manual),
+        ("netmask", Token::Netmask),
+        ("static", Token::Static),
+        ("mtu", Token::MTU),
+        ("bridge-ports", Token::BridgePorts),
+        ("bridge_ports", Token::BridgePorts),
+        ("bridge-vlan-aware", Token::BridgeVlanAware),
+        ("bridge_vlan_aware", Token::BridgeVlanAware),
+        ("bond-slaves", Token::BondSlaves),
+        ("bond_slaves", Token::BondSlaves),
+        ("bond-mode", Token::BondMode),
+        ("bond-primary", Token::BondPrimary),
+        ("bond_primary", Token::BondPrimary),
+        ("bond_xmit_hash_policy", Token::BondXmitHashPolicy),
+        ("bond-xmit-hash-policy", Token::BondXmitHashPolicy),
+    ]
+    .into()
 });
 
 pub struct Lexer<R> {
-- 
2.39.2





      reply	other threads:[~2024-02-13  9:03 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-13  9:03 [pbs-devel] [PATCH backup 1/3] config: Remove lazy_static dependency Maximiliano Sandoval
2024-02-13  9:03 ` Maximiliano Sandoval [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240213090314.111162-2-m.sandoval@proxmox.com \
    --to=m.sandoval@proxmox.com \
    --cc=pbs-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal