Skip to content

Commit c432550

Browse files
committedJun 20, 2024
Removed else after if return.
1 parent 2ab2f93 commit c432550

File tree

1 file changed

+40
-48
lines changed

1 file changed

+40
-48
lines changed
 

‎src/app/clusters/service-area-server/service-area-server.cpp

+40-48
Original file line numberDiff line numberDiff line change
@@ -137,19 +137,17 @@ CHIP_ERROR Instance::ReadSupportedLocations(AttributeValueEncoder & aEncoder)
137137
{
138138
return aEncoder.EncodeNull();
139139
}
140-
else
141-
{
142-
return aEncoder.EncodeList([this](const auto & encoder) -> CHIP_ERROR {
143-
uint8_t locationIndex = 0;
144-
LocationStructureWrapper supportedLocation;
145140

146-
while (mDelegate->GetSupportedLocationByIndex(locationIndex++, supportedLocation))
147-
{
148-
ReturnErrorOnFailure(encoder.Encode(supportedLocation));
149-
}
150-
return CHIP_NO_ERROR;
151-
});
152-
}
141+
return aEncoder.EncodeList([this](const auto & encoder) -> CHIP_ERROR {
142+
uint8_t locationIndex = 0;
143+
LocationStructureWrapper supportedLocation;
144+
145+
while (mDelegate->GetSupportedLocationByIndex(locationIndex++, supportedLocation))
146+
{
147+
ReturnErrorOnFailure(encoder.Encode(supportedLocation));
148+
}
149+
return CHIP_NO_ERROR;
150+
});
153151
}
154152

155153
CHIP_ERROR Instance::ReadSupportedMaps(AttributeValueEncoder & aEncoder)
@@ -158,19 +156,17 @@ CHIP_ERROR Instance::ReadSupportedMaps(AttributeValueEncoder & aEncoder)
158156
{
159157
return aEncoder.EncodeNull();
160158
}
161-
else
162-
{
163-
return aEncoder.EncodeList([this](const auto & encoder) -> CHIP_ERROR {
164-
uint32_t mapIndex = 0;
165-
MapStructureWrapper supportedMap;
166159

167-
while (mDelegate->GetSupportedMapByIndex(mapIndex++, supportedMap))
168-
{
169-
ReturnErrorOnFailure(encoder.Encode(supportedMap));
170-
}
171-
return CHIP_NO_ERROR;
172-
});
173-
}
160+
return aEncoder.EncodeList([this](const auto & encoder) -> CHIP_ERROR {
161+
uint32_t mapIndex = 0;
162+
MapStructureWrapper supportedMap;
163+
164+
while (mDelegate->GetSupportedMapByIndex(mapIndex++, supportedMap))
165+
{
166+
ReturnErrorOnFailure(encoder.Encode(supportedMap));
167+
}
168+
return CHIP_NO_ERROR;
169+
});
174170
}
175171

176172
CHIP_ERROR Instance::ReadSelectedLocations(AttributeValueEncoder & aEncoder)
@@ -179,19 +175,17 @@ CHIP_ERROR Instance::ReadSelectedLocations(AttributeValueEncoder & aEncoder)
179175
{
180176
return aEncoder.EncodeNull();
181177
}
182-
else
183-
{
184-
return aEncoder.EncodeList([this](const auto & encoder) -> CHIP_ERROR {
185-
uint32_t locationIndex = 0;
186-
uint32_t selectedLocation;
187178

188-
while (mDelegate->GetSelectedLocationByIndex(locationIndex++, selectedLocation))
189-
{
190-
ReturnErrorOnFailure(encoder.Encode(selectedLocation));
191-
}
192-
return CHIP_NO_ERROR;
193-
});
194-
}
179+
return aEncoder.EncodeList([this](const auto & encoder) -> CHIP_ERROR {
180+
uint32_t locationIndex = 0;
181+
uint32_t selectedLocation;
182+
183+
while (mDelegate->GetSelectedLocationByIndex(locationIndex++, selectedLocation))
184+
{
185+
ReturnErrorOnFailure(encoder.Encode(selectedLocation));
186+
}
187+
return CHIP_NO_ERROR;
188+
});
195189
}
196190

197191
CHIP_ERROR Instance::ReadProgress(AttributeValueEncoder & aEncoder)
@@ -200,19 +194,17 @@ CHIP_ERROR Instance::ReadProgress(AttributeValueEncoder & aEncoder)
200194
{
201195
return aEncoder.EncodeNull();
202196
}
203-
else
204-
{
205-
return aEncoder.EncodeList([this](const auto & encoder) -> CHIP_ERROR {
206-
uint32_t locationIndex = 0;
207-
Structs::ProgressStruct::Type progressElement;
208197

209-
while (mDelegate->GetProgressElementByIndex(locationIndex++, progressElement))
210-
{
211-
ReturnErrorOnFailure(encoder.Encode(progressElement));
212-
}
213-
return CHIP_NO_ERROR;
214-
});
215-
}
198+
return aEncoder.EncodeList([this](const auto & encoder) -> CHIP_ERROR {
199+
uint32_t locationIndex = 0;
200+
Structs::ProgressStruct::Type progressElement;
201+
202+
while (mDelegate->GetProgressElementByIndex(locationIndex++, progressElement))
203+
{
204+
ReturnErrorOnFailure(encoder.Encode(progressElement));
205+
}
206+
return CHIP_NO_ERROR;
207+
});
216208
}
217209

218210
//*************************************************************************

0 commit comments

Comments
 (0)