View Issue Details [ Jump to Notes ] | [ Issue History ] [ Print ] |
ID | Project | Category | View Status | Date Submitted | Last Update |
0003817 | Doomseeker | [All Projects] Cleanup | public | 2020-06-07 06:41 | 2020-06-07 20:55 |
|
Reporter | WubTheCaptain | |
Assigned To | | |
Priority | none | Severity | tweak | Reproducibility | sometimes |
Status | confirmed | Resolution | open | |
Platform | | OS | | OS Version | |
Product Version | 1.3.1 | |
Target Version | | Fixed in Version | | |
|
Summary | 0003817: std::string compare method is sometimes used instead of equality/inequality operators |
Description | I think some of these string comparisons with std::string's compare method don't make sense over equality or inequality operators (== or !=). Bad readability, clang-tidy seems to agree. |
Steps To Reproduce | An example:
Quote from src/core/irc/ircuserinfo.cpp
bool IRCUserInfo::operator==(const IRCUserInfo &otherUser) const
{
QString thisNickname = this->cleanNicknameLowerCase();
QString otherNickname = otherUser.cleanNicknameLowerCase();
return thisNickname.compare(otherNickname) == 0;
}
Could instead have written return thisNickname == otherNickname.
grep -r '\.compare' src/ | less to sort through some of these. Some Qt::CaseInsensitive cases make sense. |
Additional Information | 'https://clang.llvm.org/extra/clang-tidy/checks/readability-string-compare.html [^]' |
|
Attached Files | |
|