[pbs-devel] [PATCH backup 2/3] network: lexer: Simplify KEYWORDS declaration
Maximiliano Sandoval
m.sandoval at proxmox.com
Tue Feb 13 10:03:14 CET 2024
Signed-off-by: Maximiliano Sandoval <m.sandoval at 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
More information about the pbs-devel
mailing list