refactor: constify version args slice

This commit is contained in:
Harsh Shandilya 2022-02-17 13:14:48 +05:30
parent 952afdcec3
commit 6119968d6d
No known key found for this signature in database
GPG key ID: 366D7BBAD1031E80

View file

@ -13,6 +13,8 @@ use log::{debug, error};
use crate::config::{Act, Match, Replacements};
const VERSION_ARGS: [&str; 3] = ["version", "-v", "--version"];
fn main() -> Result<()> {
pretty_env_logger::init();
let config_path = get_config_path()?;
@ -26,9 +28,8 @@ fn main() -> Result<()> {
fn check_for_version_arg() -> bool {
let args: Vec<String> = std::env::args().collect();
let version_args = vec!["version", "-v", "--version"];
for arg in args {
if version_args.contains(&arg.deref()) {
if VERSION_ARGS.contains(&arg.deref()) {
print_version();
return true;
}