diff --git a/forc-plugins/forc-node/src/chain_config.rs b/forc-plugins/forc-node/src/chain_config.rs index 00d1ad185b5..c91f01032ee 100644 --- a/forc-plugins/forc-node/src/chain_config.rs +++ b/forc-plugins/forc-node/src/chain_config.rs @@ -34,15 +34,15 @@ impl Display for ChainConfig { } } } + impl From for PathBuf { fn from(value: ChainConfig) -> Self { - let user_forc_dir = user_forc_directory().join(CONFIG_FOLDER); - - match value { - ChainConfig::Local => user_forc_dir.join(LOCAL_CONFIG_FOLDER_NAME), - ChainConfig::Testnet => user_forc_dir.join(TESTNET_CONFIG_FOLDER_NAME), - ChainConfig::Ignition => user_forc_dir.join(IGNITION_CONFIG_FOLDER_NAME), - } + let folder_name = match value { + ChainConfig::Local => LOCAL_CONFIG_FOLDER_NAME, + ChainConfig::Testnet => TESTNET_CONFIG_FOLDER_NAME, + ChainConfig::Ignition => IGNITION_CONFIG_FOLDER_NAME, + }; + user_forc_directory().join(CONFIG_FOLDER).join(folder_name) } }