Fix compiler warning about unused variable (#3873)

This was added to indicate that the return value of chdir was unused,
but newer compilers "see through" this and determine it to be unused.
The return value is not marked must-use, so just doing nothing with it
is sufficient.
This commit is contained in:
Dustin J. Mitchell 2025-05-08 13:08:22 -04:00 committed by GitHub
parent 0e59a62ead
commit 79eb38d582
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -619,10 +619,9 @@ CmdEdit::editResult CmdEdit::editFile(Task& task) {
auto dateformat = Context::getContext().config.get("dateformat.edit"); auto dateformat = Context::getContext().config.get("dateformat.edit");
if (dateformat == "") dateformat = Context::getContext().config.get("dateformat"); if (dateformat == "") dateformat = Context::getContext().config.get("dateformat");
// Change directory for the editor // Change directory for the editor, doing nothing on error.
auto current_dir = Directory::cwd(); auto current_dir = Directory::cwd();
int ignored = chdir(location._data.c_str()); chdir(location._data.c_str());
++ignored; // Keep compiler quiet.
// Check if the file already exists, if so, bail out // Check if the file already exists, if so, bail out
Path filepath = Path(file.str()); Path filepath = Path(file.str());
@ -702,7 +701,7 @@ ARE_THESE_REALLY_HARMFUL:
// Cleanup. // Cleanup.
File::remove(file.str()); File::remove(file.str());
ignored = chdir(current_dir.c_str()); chdir(current_dir.c_str());
return changes ? CmdEdit::editResult::changes : CmdEdit::editResult::nochanges; return changes ? CmdEdit::editResult::changes : CmdEdit::editResult::nochanges;
} }