mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
Enable clippy's or_fun_call linter (#7222)
Co-authored-by: Alexey Shekhirin <a.shekhirin@gmail.com>
This commit is contained in:
@ -79,7 +79,7 @@ impl ImportCommand {
|
||||
|
||||
// add network name to data dir
|
||||
let data_dir = self.datadir.unwrap_or_chain_default(self.chain.chain);
|
||||
let config_path = self.config.clone().unwrap_or(data_dir.config_path());
|
||||
let config_path = self.config.clone().unwrap_or_else(|| data_dir.config_path());
|
||||
|
||||
let config: Config = self.load_config(config_path.clone())?;
|
||||
info!(target: "reth::cli", path = ?config_path, "Configuration loaded");
|
||||
|
||||
@ -286,14 +286,14 @@ mod tests {
|
||||
NodeCommand::try_parse_args_from(["reth", "--config", "my/path/to/reth.toml"]).unwrap();
|
||||
// always store reth.toml in the data dir, not the chain specific data dir
|
||||
let data_dir = cmd.datadir.unwrap_or_chain_default(cmd.chain.chain);
|
||||
let config_path = cmd.config.unwrap_or(data_dir.config_path());
|
||||
let config_path = cmd.config.unwrap_or_else(|| data_dir.config_path());
|
||||
assert_eq!(config_path, Path::new("my/path/to/reth.toml"));
|
||||
|
||||
let cmd = NodeCommand::try_parse_args_from(["reth"]).unwrap();
|
||||
|
||||
// always store reth.toml in the data dir, not the chain specific data dir
|
||||
let data_dir = cmd.datadir.unwrap_or_chain_default(cmd.chain.chain);
|
||||
let config_path = cmd.config.clone().unwrap_or(data_dir.config_path());
|
||||
let config_path = cmd.config.clone().unwrap_or_else(|| data_dir.config_path());
|
||||
let end = format!("reth/{}/reth.toml", SUPPORTED_CHAINS[0]);
|
||||
assert!(config_path.ends_with(end), "{:?}", cmd.config);
|
||||
}
|
||||
|
||||
@ -104,7 +104,7 @@ impl Command {
|
||||
|
||||
// add network name to data dir
|
||||
let data_dir = self.datadir.unwrap_or_chain_default(self.chain.chain);
|
||||
let config_path = self.config.clone().unwrap_or(data_dir.config_path());
|
||||
let config_path = self.config.clone().unwrap_or_else(|| data_dir.config_path());
|
||||
|
||||
let mut config: Config = confy::load_path(&config_path).unwrap_or_default();
|
||||
|
||||
|
||||
@ -126,7 +126,7 @@ impl Command {
|
||||
|
||||
// add network name to data dir
|
||||
let data_dir = self.datadir.unwrap_or_chain_default(self.chain.chain);
|
||||
let config_path = self.config.clone().unwrap_or(data_dir.config_path());
|
||||
let config_path = self.config.clone().unwrap_or_else(|| data_dir.config_path());
|
||||
|
||||
let config: Config = confy::load_path(config_path).unwrap_or_default();
|
||||
info!(target: "reth::cli", "reth {} starting stage {:?}", SHORT_VERSION, self.stage);
|
||||
|
||||
Reference in New Issue
Block a user