From 4a43e3e7f954cb79a71ab05dde6b5345d011db83 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Mon, 28 Aug 2017 17:16:38 -0700 Subject: [PATCH] Use const --- toolsrc/src/commands_cache.cpp | 2 +- toolsrc/src/commands_depends.cpp | 2 +- toolsrc/src/commands_edit.cpp | 9 +++++---- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/toolsrc/src/commands_cache.cpp b/toolsrc/src/commands_cache.cpp index 75de78461b..fa0c62ee4c 100644 --- a/toolsrc/src/commands_cache.cpp +++ b/toolsrc/src/commands_cache.cpp @@ -15,7 +15,7 @@ namespace vcpkg::Commands::Cache { const Expected> pghs = Paragraphs::get_single_paragraph(paths.get_filesystem(), path / "CONTROL"); - if (auto p = pghs.get()) + if (const auto p = pghs.get()) { const BinaryParagraph binary_paragraph = BinaryParagraph(*p); output.push_back(binary_paragraph); diff --git a/toolsrc/src/commands_depends.cpp b/toolsrc/src/commands_depends.cpp index 49e1c6c017..ffad91226c 100644 --- a/toolsrc/src/commands_depends.cpp +++ b/toolsrc/src/commands_depends.cpp @@ -46,7 +46,7 @@ namespace vcpkg::Commands::DependInfo for (auto&& source_control_file : source_control_files) { const SourceParagraph& source_paragraph = *source_control_file->core_paragraph; - auto s = Strings::join(", ", source_paragraph.depends, [](const Dependency& d) { return d.name(); }); + const auto s = Strings::join(", ", source_paragraph.depends, [](const Dependency& d) { return d.name(); }); System::println("%s: %s", source_paragraph.name, s); } diff --git a/toolsrc/src/commands_edit.cpp b/toolsrc/src/commands_edit.cpp index 72005a4613..c0fe27fdee 100644 --- a/toolsrc/src/commands_edit.cpp +++ b/toolsrc/src/commands_edit.cpp @@ -27,7 +27,7 @@ namespace vcpkg::Commands::Edit if (env_EDITOR.empty()) { const Optional env_EDITOR_optional = System::get_environment_variable(L"EDITOR"); - if (auto e = env_EDITOR_optional.get()) + if (const auto e = env_EDITOR_optional.get()) { env_EDITOR = *e; } @@ -63,7 +63,7 @@ namespace vcpkg::Commands::Edit { const Optional code_installpath = System::get_registry_string(HKEY_LOCAL_MACHINE, keypath, L"InstallLocation"); - if (auto c = code_installpath.get()) + if (const auto c = code_installpath.get()) { auto p = fs::path(*c) / "Code.exe"; if (fs.exists(p)) @@ -91,11 +91,12 @@ namespace vcpkg::Commands::Edit { const auto buildtrees_current_dir = paths.buildtrees / port_name; - std::wstring cmdLine = Strings::wformat(LR"("%s" "%s" -n)", env_EDITOR, buildtrees_current_dir.native()); + const std::wstring cmdLine = + Strings::wformat(LR"("%s" "%s" -n)", env_EDITOR, buildtrees_current_dir.native()); Checks::exit_with_code(VCPKG_LINE_INFO, System::cmd_execute(cmdLine)); } - std::wstring cmdLine = Strings::wformat( + const std::wstring cmdLine = Strings::wformat( LR"("%s" "%s" "%s" -n)", env_EDITOR, portpath.native(), (portpath / "portfile.cmake").native()); Checks::exit_with_code(VCPKG_LINE_INFO, System::cmd_execute(cmdLine)); }