Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed: incorrect erasing of env vars #3622

Merged
merged 2 commits into from
Nov 20, 2024

Conversation

Klaim
Copy link
Member

@Klaim Klaim commented Nov 20, 2024

The expectaction of this change is that the intent was to remove elements (env vars values) from that vector, in which case an erase was missing as remove_if will not remove elements, just move them around and report where the new range ends (c++20's std::erase_if would have done the job more properly here - or replacing the container by a flat_map).

conda_environment_env_vars.begin(),
conda_environment_env_vars.end(),
[](auto& el) { return el.second == CONDA_ENV_VARS_UNSET_VAR; }
conda_environment_env_vars.erase(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe leave a comment about using std::erase_if when we switch to C++20?

@Klaim Klaim marked this pull request as ready for review November 20, 2024 17:04
@JohanMabille JohanMabille merged commit d4de99b into mamba-org:main Nov 20, 2024
32 checks passed
@JohanMabille JohanMabille deleted the klaim/remove-erase branch November 20, 2024 17:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release::bug_fixes For PRs fixing bugs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants