From f897aad11a56eaf4d87c83b050857f2dd5367e6b Mon Sep 17 00:00:00 2001 From: Henry Schreiner Date: Thu, 2 Dec 2021 13:20:13 -0500 Subject: [PATCH] fix: avoid a warning about useless move (#678) * fix: avoid a warning about useless move * style: pre-commit.ci fixes * Update include/CLI/App.hpp Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- include/CLI/App.hpp | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/include/CLI/App.hpp b/include/CLI/App.hpp index 1ef86a62..b05c8daa 100644 --- a/include/CLI/App.hpp +++ b/include/CLI/App.hpp @@ -2252,27 +2252,24 @@ class App { /// Process callbacks and such. void _process() { - CLI::FileError fe("ne"); - bool caught_error{false}; try { // the config file might generate a FileError but that should not be processed until later in the process // to allow for help, version and other errors to generate first. _process_config_file(); + // process env shouldn't throw but no reason to process it if config generated an error _process_env(); - } catch(const CLI::FileError &fe2) { - fe = fe2; - caught_error = true; + } catch(const CLI::FileError &) { + // callbacks and help_flags can generate exceptions which should take priority + // over the config file error if one exists. + _process_callbacks(); + _process_help_flags(); + throw; } - // callbacks and help_flags can generate exceptions which should take priority over the config file error if one - // exists + _process_callbacks(); _process_help_flags(); - if(caught_error) { - throw CLI::FileError(std::move(fe)); - } - _process_requirements(); }