Repository: microsoft/terminal
File: src/cascadia/TerminalSettingsEditor/ProfileViewModel.cpp (C++)

Code before:
        return _currentIconType == _IconTypes.GetAt(2);
    }

    bool ProfileViewModel::UsingImageIcon() const
    {
        return _currentIconType == _IconTypes.GetAt(3);
    }

    hstring ProfileViewModel::BellStylePreview() const
    {
        const auto bellStyle = BellStyle();
        const bool isAudibleSet = WI_IsFlagSet(bellStyle, BellStyle::Audible);
        const bool isWindowSet = WI_IsFlagSet(bellStyle, BellStyle::Window);
        const bool isTaskbarSet = WI_IsFlagSet(bellStyle, BellStyle::Taskbar);
        if (bellStyle == Model::BellStyle::All || (isAudibleSet && isWindowSet && isTaskbarSet))
        {
            return RS_(L"Profile_BellStyleAll/Content");
        }
        else if (bellStyle == static_cast<Model::BellStyle>(0))
        {
            return RS_(L"Profile_BellStyleNone/Content");
        }

        std::vector<hstring> resultList;
        resultList.reserve(3);
        if (isAudibleSet)
        {
            resultList.emplace_back(RS_(L"Profile_BellStyleAudible/Content"));
        }
        if (isWindowSet)
        {
            resultList.emplace_back(RS_(L"Profile_BellStyleWindow/Content"));
        }
        if (isTaskbarSet)
        {
            resultList.emplace_back(RS_(L"Profile_BellStyleTaskbar/Content"));
        }

        // add in the commas
        hstring result{};
        for (auto&& entry : resultList)
        {
            if (entry == resultList.front())
            {
                result = entry;
            }
            else
            {
                result = result + L", " + entry;
            }
        }

Review comment (suggestion):
replace all these with


```suggestion
        if (WI_IsFlagSet(bellStyle, BellStyle::Audible))
```

and get rid of the temporary booleans. :)

Code after:
        return _currentIconType == _IconTypes.GetAt(2);
    }

    bool ProfileViewModel::UsingImageIcon() const
    {
        return _currentIconType == _IconTypes.GetAt(3);
    }

    hstring ProfileViewModel::BellStylePreview() const
    {
        const auto bellStyle = BellStyle();
        if (WI_AreAllFlagsSet(bellStyle, BellStyle::Audible | BellStyle::Window | BellStyle::Taskbar))
        {
            return RS_(L"Profile_BellStyleAll/Content");
        }
        else if (bellStyle == static_cast<Model::BellStyle>(0))
        {
            return RS_(L"Profile_BellStyleNone/Content");
        }

        std::vector<hstring> resultList;
        resultList.reserve(3);
        if (WI_IsFlagSet(bellStyle, BellStyle::Audible))
        {
            resultList.emplace_back(RS_(L"Profile_BellStyleAudible/Content"));
        }
        if (WI_IsFlagSet(bellStyle, BellStyle::Window))
        {
            resultList.emplace_back(RS_(L"Profile_BellStyleWindow/Content"));
        }
        if (WI_IsFlagSet(bellStyle, BellStyle::Taskbar))
        {
            resultList.emplace_back(RS_(L"Profile_BellStyleTaskbar/Content"));
        }

        // add in the commas
        hstring result{};
        for (auto&& entry : resultList)
        {
            if (result.empty())
            {
                result = entry;
            }
            else
            {
                result = result + L", " + entry;
            }
        }
        return result;
    }