-
Notifications
You must be signed in to change notification settings - Fork 13.6k
[clang-tidy] Sync ContainerSizeEmptyCheck with container-size-empty doc #118459
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
[clang-tidy] Sync ContainerSizeEmptyCheck with container-size-empty doc #118459
Conversation
@llvm/pr-subscribers-clang-tidy @llvm/pr-subscribers-clang-tools-extra Author: Niels Dekker (N-Dekker) ChangesBrought the class documentation in sync with the user documentation at container-size-empty.rst: llvm-project/clang-tools-extra/docs/clang-tidy/checks/readability/container-size-empty.rst Lines 7 to 14 in bfb2620
Full diff: https://github.com/llvm/llvm-project/pull/118459.diff 1 Files Affected:
diff --git a/clang-tools-extra/clang-tidy/readability/ContainerSizeEmptyCheck.h b/clang-tools-extra/clang-tidy/readability/ContainerSizeEmptyCheck.h
index acd8a6bfc50f5e..5f189b426f2413 100644
--- a/clang-tools-extra/clang-tidy/readability/ContainerSizeEmptyCheck.h
+++ b/clang-tools-extra/clang-tidy/readability/ContainerSizeEmptyCheck.h
@@ -18,10 +18,10 @@ namespace clang::tidy::readability {
/// a call to `empty()`.
///
/// The emptiness of a container should be checked using the `empty()` method
-/// instead of the `size()` method. It shows clearer intent to use `empty()`.
-/// Furthermore some containers may implement the `empty()` method but not
-/// implement the `size()` method. Using `empty()` whenever possible makes it
-/// easier to switch to another container in the future.
+/// instead of the `size()`/`length()` method. It shows clearer intent to use
+/// `empty()`. Furthermore some containers may implement the `empty()` method
+/// but not implement the `size()` or `length()` method. Using `empty()`
+/// whenever possible makes it easier to switch to another container in the future.
class ContainerSizeEmptyCheck : public ClangTidyCheck {
public:
ContainerSizeEmptyCheck(StringRef Name, ClangTidyContext *Context);
|
✅ With the latest revision this PR passed the C/C++ code formatter. |
Brought the class documentation in sync with the user documentation at clang-tools-extra/docs/clang-tidy/checks/readability/container-size-empty.rst
7a51334
to
1e2cb11
Compare
/// `empty()`. Furthermore some containers may implement the `empty()` method | ||
/// but not implement the `size()` or `length()` method. Using `empty()` | ||
/// whenever possible makes it easier to switch to another container in the | ||
/// future. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you both for your approval, @HerrCai0907 and @carlosgalvezp. I'm considering to propose mentioning std::forward_list
here, as it is the one STL container that does not implement size()
. But maybe first wait for this one (#118459) to get merged...
@HerrCai0907 Thanks again for your approval, and for merging my very first LLVM PR (#117629). Can you please 🙏 merge this one as well? |
Brought the class documentation in sync with the user documentation at container-size-empty.rst:
llvm-project/clang-tools-extra/docs/clang-tidy/checks/readability/container-size-empty.rst
Lines 7 to 14 in bfb2620