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

maint(clang-tidy): Improve code readability with explicit boolean casts #3148

Merged
merged 9 commits into from
Jul 27, 2021

Conversation

Skylion007
Copy link
Collaborator

Description

  • This adds some non-controversial clang-tidy checks that improve code readability. Mainly requiring boolean conversions to be more explicit and using modern syntax for making shared or unique along with other modern C++ language features. Many of these checks don't actually change that much of the code,

Suggested changelog entry:

* Add clang-tidy-readability rules to make boolean casts explicit improving code readability. Also enabled other misc and readability clang-tidy checks.

@Skylion007 Skylion007 requested review from rwgk and henryiii July 27, 2021 15:55
@Skylion007 Skylion007 closed this Jul 27, 2021
@Skylion007 Skylion007 reopened this Jul 27, 2021
include/pybind11/cast.h Outdated Show resolved Hide resolved
tests/test_methods_and_attributes.cpp Outdated Show resolved Hide resolved
tests/test_smart_ptr.cpp Show resolved Hide resolved
include/pybind11/numpy.h Show resolved Hide resolved
Copy link
Collaborator

@rwgk rwgk left a comment

Choose a reason for hiding this comment

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

That's really awesome now!

@rwgk
Copy link
Collaborator

rwgk commented Jul 27, 2021

@Skylion007 I'll go ahead merging this now (and then #3135, and then update the smart_holder branch, and then import everything into the google environment :-) )

@rwgk rwgk merged commit 9beaa92 into pybind:master Jul 27, 2021
@github-actions github-actions bot added the needs changelog Possibly needs a changelog entry label Jul 27, 2021
rwgk pushed a commit to rwgk/pybind11 that referenced this pull request Jul 27, 2021
henryiii pushed a commit to henryiii/pybind11 that referenced this pull request Jul 29, 2021
…ts (pybind#3148)

* maint(clang-tidy) Improve code readability

* Fix minor typos

* Revert optimization that removed test case

* Fix comment formatting

* Revert another optimization to repro an issue

* Remove make_unique since it C++14 and newer only

* eformat comments

* Fix unsignedness of comparison

* Update comment
@henryiii henryiii removed the needs changelog Possibly needs a changelog entry label Sep 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants