Use const

This commit is contained in:
Alexander Karatarakis 2017-08-28 17:16:38 -07:00
parent 269c6b4d55
commit 4a43e3e7f9
3 changed files with 7 additions and 6 deletions

View File

@ -15,7 +15,7 @@ namespace vcpkg::Commands::Cache
{
const Expected<std::unordered_map<std::string, std::string>> 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);

View File

@ -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);
}

View File

@ -27,7 +27,7 @@ namespace vcpkg::Commands::Edit
if (env_EDITOR.empty())
{
const Optional<std::wstring> 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<std::wstring> 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));
}