Skip to content

[Clang-Tidy] Enable readability string compare check#1250

Merged
Skylion007 merged 2 commits intomasterfrom
clang-tidy-readability-string-compare
May 19, 2021
Merged

[Clang-Tidy] Enable readability string compare check#1250
Skylion007 merged 2 commits intomasterfrom
clang-tidy-readability-string-compare

Conversation

@Skylion007
Copy link
Copy Markdown
Contributor

Motivation and Context

  • This enables a clang-tidy check that discourages the .compare operator to compare strings. There are two reasons for this:
  • This form is more readable.
  • It can early terminate unlike compare and is therefore more performant.
    Given these two benefits, I don't see any reason to use the old fashioned string compares. All fixes in this PR were automated by clang-tidy.

How Has This Been Tested

  • CI

Types of changes

  • Docs change / refactoring / dependency upgrade
  • Bug fix (non-breaking change which fixes an issue)

Checklist

  • My code follows the code style of this project.
  • I have read the CONTRIBUTING document.
  • I have completed my CLA (see CONTRIBUTING)
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@facebook-github-bot facebook-github-bot added the CLA Signed Do not delete this pull request or issue due to inactivity. label May 19, 2021
@Skylion007 Skylion007 requested a review from erikwijmans May 19, 2021 18:35
Copy link
Copy Markdown
Contributor

@jturner65 jturner65 left a comment

Choose a reason for hiding this comment

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

LGTM

@Skylion007 Skylion007 merged commit c41b1bd into master May 19, 2021
@Skylion007 Skylion007 deleted the clang-tidy-readability-string-compare branch May 19, 2021 20:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed Do not delete this pull request or issue due to inactivity.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants