feat: Box the Command::Server variant as clippy recommends
This variant is now much larger than the other variants because of all the CLI options on `server`. If we don't box this, the total size of the enum depends on the size of the server config. This seems like a good suggestion to me.pull/24376/head
parent
02d981451d
commit
bc6bcb423d
|
@ -196,13 +196,13 @@ Possible values (case insensitive):
|
|||
/// - user set environment variables
|
||||
/// - .env file contents
|
||||
/// - pre-configured default values
|
||||
pub fn load_config() -> Config {
|
||||
pub fn load_config() -> Box<Config> {
|
||||
// Load the Config struct - this pulls in any envs set by the user or
|
||||
// sourced above, and applies any defaults.
|
||||
//
|
||||
|
||||
//let args = std::env::args().filter(|arg| arg != "server");
|
||||
Config::from_iter(strip_server(std::env::args()).iter())
|
||||
Box::new(Config::from_iter(strip_server(std::env::args()).iter()))
|
||||
}
|
||||
|
||||
fn parse_socket_addr(s: &str) -> std::io::Result<SocketAddr> {
|
||||
|
|
|
@ -86,7 +86,7 @@ pub type Result<T, E = Error> = std::result::Result<T, E>;
|
|||
///
|
||||
/// The logging_level passed in is the global setting (e.g. if -v or
|
||||
/// -vv was passed in before 'server')
|
||||
pub async fn main(logging_level: LoggingLevel, config: Option<Config>) -> Result<()> {
|
||||
pub async fn main(logging_level: LoggingLevel, config: Option<Box<Config>>) -> Result<()> {
|
||||
// load config from environment if no command line
|
||||
let config = config.unwrap_or_else(load_config);
|
||||
|
||||
|
@ -114,7 +114,7 @@ pub async fn main(logging_level: LoggingLevel, config: Option<Config>) -> Result
|
|||
}
|
||||
}
|
||||
|
||||
let object_store = ObjectStore::try_from(&config)?;
|
||||
let object_store = ObjectStore::try_from(&*config)?;
|
||||
let object_storage = Arc::new(object_store);
|
||||
|
||||
let connection_manager = ConnectionManager {};
|
||||
|
|
|
@ -110,7 +110,8 @@ enum Command {
|
|||
},
|
||||
Database(commands::database::Config),
|
||||
Stats(commands::stats::Config),
|
||||
Server(commands::server::Config),
|
||||
// Clippy recommended boxing this variant because it's much larger than the others
|
||||
Server(Box<commands::server::Config>),
|
||||
Writer(commands::writer::Config),
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue