From 90f8c86d2388da29f17b478efe6ae276170b84f9 Mon Sep 17 00:00:00 2001 From: steviez Date: Wed, 1 Feb 2023 13:01:58 -0600 Subject: [PATCH] ledger-tool: Remove unnecessary function to parse ledger path arg (#29952) --- ledger-tool/src/ledger_path.rs | 21 ++++----------------- ledger-tool/src/main.rs | 3 +-- 2 files changed, 5 insertions(+), 19 deletions(-) diff --git a/ledger-tool/src/ledger_path.rs b/ledger-tool/src/ledger_path.rs index 34274e85c0..94c03124a4 100644 --- a/ledger-tool/src/ledger_path.rs +++ b/ledger-tool/src/ledger_path.rs @@ -1,22 +1,9 @@ -use { - clap::{value_t, ArgMatches}, - std::{ - fs, - path::{Path, PathBuf}, - process::exit, - }, +use std::{ + fs, + path::{Path, PathBuf}, + process::exit, }; -pub fn parse_ledger_path(matches: &ArgMatches<'_>, name: &str) -> PathBuf { - PathBuf::from(value_t!(matches, name, String).unwrap_or_else(|_err| { - eprintln!( - "Error: Missing --ledger argument.\n\n{}", - matches.usage() - ); - exit(1); - })) -} - // Canonicalize ledger path to avoid issues with symlink creation pub fn canonicalize_ledger_path(ledger_path: &Path) -> PathBuf { fs::canonicalize(ledger_path).unwrap_or_else(|err| { diff --git a/ledger-tool/src/main.rs b/ledger-tool/src/main.rs index b3208074c6..5b9a1cd0db 100644 --- a/ledger-tool/src/main.rs +++ b/ledger-tool/src/main.rs @@ -2312,8 +2312,7 @@ fn main() { info!("{} {}", crate_name!(), solana_version::version!()); - let ledger_path = parse_ledger_path(&matches, "ledger_path"); - + let ledger_path = PathBuf::from(value_t_or_exit!(matches, "ledger_path", String)); let snapshot_archive_path = value_t!(matches, "snapshot_archive_path", String) .ok() .map(PathBuf::from);