Construct structs with ..default() to avoid a lint

This commit is contained in:
teor 2021-01-19 06:40:15 +10:00 committed by Deirdre Connolly
parent b1d28b73fd
commit eadbea1423
2 changed files with 16 additions and 10 deletions

View File

@ -110,11 +110,12 @@ impl Config {
(path, opts)
}
/// Construct a config for an ephemeral in memory database
pub fn ephemeral() -> Self {
let mut config = Self::default();
config.ephemeral = true;
config
/// Construct a config for an ephemeral database
pub fn ephemeral() -> Config {
Config {
ephemeral: true,
..Config::default()
}
}
/// Calculate the database's share of `open_file_limit`

View File

@ -39,11 +39,16 @@ use zebrad::config::ZebradConfig;
const LAUNCH_DELAY: Duration = Duration::from_secs(3);
fn default_test_config() -> Result<ZebradConfig> {
let mut config = ZebradConfig::default();
config.state = zebra_state::Config::ephemeral();
config.network.listen_addr = "127.0.0.1:0".parse()?;
Ok(config)
let auto_port_ipv4_local = zebra_network::Config {
listen_addr: "127.0.0.1:0".parse()?,
..zebra_network::Config::default()
};
let local_ephemeral = ZebradConfig {
state: zebra_state::Config::ephemeral(),
network: auto_port_ipv4_local,
..ZebradConfig::default()
};
Ok(local_ephemeral)
}
fn persistent_test_config() -> Result<ZebradConfig> {