[clang-tidy] Enable readability-container-contains (#16438)

This commit is contained in:
Jonathan Swoboda
2026-05-14 18:38:09 -04:00
committed by GitHub
parent 7436d1c199
commit a8e69a15e4
7 changed files with 8 additions and 9 deletions
-1
View File
@@ -116,7 +116,6 @@ Checks: >-
-portability-template-virtual-member-function,
-readability-ambiguous-smartptr-reset-call,
-readability-avoid-nested-conditional-operator,
-readability-container-contains,
-readability-container-data-pointer,
-readability-convert-member-functions-to-static,
-readability-else-after-return,
+1 -1
View File
@@ -1 +1 @@
593fd53fa09944a59af3f38521e31d87fe10b60326b8d82bb76413c5149b312c
27aaab4e0ebfc10491720345aa746fc2dffa6a3985f73ec111b12dd99078d46f
+1 -1
View File
@@ -572,7 +572,7 @@ void LvButtonMatrixType::set_obj(lv_obj_t *lv_obj) {
auto key_idx = lv_buttonmatrix_get_selected_button(self->obj);
if (key_idx == LV_BUTTONMATRIX_BUTTON_NONE)
return;
if (self->key_map_.count(key_idx) != 0) {
if (self->key_map_.contains(key_idx)) {
self->send_key_(self->key_map_[key_idx]);
return;
}
+2 -2
View File
@@ -16,7 +16,7 @@ GPIOPin *const NullPin::NULL_PIN = new NullPin(); // NOLINT(cppcoreguidelines-a
SPIDelegate *SPIComponent::register_device(SPIClient *device, SPIMode mode, SPIBitOrder bit_order, uint32_t data_rate,
GPIOPin *cs_pin, bool release_device, bool write_only) {
if (this->devices_.count(device) != 0) {
if (this->devices_.contains(device)) {
ESP_LOGE(TAG, "Device already registered");
return this->devices_[device];
}
@@ -27,7 +27,7 @@ SPIDelegate *SPIComponent::register_device(SPIClient *device, SPIMode mode, SPIB
}
void SPIComponent::unregister_device(SPIClient *device) {
if (this->devices_.count(device) == 0) {
if (!this->devices_.contains(device)) {
esph_log_e(TAG, "Device not registered");
return;
}
@@ -78,7 +78,7 @@ void Touchscreen::add_raw_touch_position_(uint8_t id, int16_t x_raw, int16_t y_r
if (this->swap_x_y_) {
std::swap(x_raw, y_raw);
}
if (this->touches_.count(id) == 0) {
if (!this->touches_.contains(id)) {
tp.state = STATE_PRESSED;
tp.id = id;
} else {
@@ -154,7 +154,7 @@ bool UponorSmatrixComponent::parse_byte_(uint8_t byte) {
}
// Log unknown device addresses
if (!found && !this->unknown_devices_.count(device_address)) {
if (!found && !this->unknown_devices_.contains(device_address)) {
ESP_LOGI(TAG, "Received packet for unknown device address 0x%08" PRIX32 " ", device_address);
this->unknown_devices_.insert(device_address);
}
+2 -2
View File
@@ -2638,9 +2638,9 @@ bool WebServer::isRequestHandlerTrivial() const { return false; }
void WebServer::add_sorting_info_(JsonObject &root, EntityBase *entity) {
#ifdef USE_WEBSERVER_SORTING
if (this->sorting_entitys_.find(entity) != this->sorting_entitys_.end()) {
if (this->sorting_entitys_.contains(entity)) {
root[ESPHOME_F("sorting_weight")] = this->sorting_entitys_[entity].weight;
if (this->sorting_groups_.find(this->sorting_entitys_[entity].group_id) != this->sorting_groups_.end()) {
if (this->sorting_groups_.contains(this->sorting_entitys_[entity].group_id)) {
root[ESPHOME_F("sorting_group")] = this->sorting_groups_[this->sorting_entitys_[entity].group_id].name;
}
}