Skip to content

Commit 48e5a08

Browse files
[api-logs] Remove unneeded if check in LogRecordAttributeList (open-telemetry#6076)
Co-authored-by: Mikel Blanchard <[email protected]>
1 parent fdca498 commit 48e5a08

File tree

1 file changed

+35
-38
lines changed

1 file changed

+35
-38
lines changed

src/OpenTelemetry.Api/Logs/LogRecordAttributeList.cs

Lines changed: 35 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -228,53 +228,50 @@ public readonly Enumerator GetEnumerator()
228228
attributeStorage ??= new List<KeyValuePair<string, object?>>(OverflowAdditionalCapacity);
229229

230230
// TODO: Perf test this, adjust as needed.
231-
if (count > 0)
231+
attributeStorage.Add(this.attribute1);
232+
if (count == 1)
232233
{
233-
attributeStorage.Add(this.attribute1);
234-
if (count == 1)
235-
{
236-
return attributeStorage;
237-
}
238-
239-
attributeStorage.Add(this.attribute2);
240-
if (count == 2)
241-
{
242-
return attributeStorage;
243-
}
234+
return attributeStorage;
235+
}
244236

245-
attributeStorage.Add(this.attribute3);
246-
if (count == 3)
247-
{
248-
return attributeStorage;
249-
}
237+
attributeStorage.Add(this.attribute2);
238+
if (count == 2)
239+
{
240+
return attributeStorage;
241+
}
250242

251-
attributeStorage.Add(this.attribute4);
252-
if (count == 4)
253-
{
254-
return attributeStorage;
255-
}
243+
attributeStorage.Add(this.attribute3);
244+
if (count == 3)
245+
{
246+
return attributeStorage;
247+
}
256248

257-
attributeStorage.Add(this.attribute5);
258-
if (count == 5)
259-
{
260-
return attributeStorage;
261-
}
249+
attributeStorage.Add(this.attribute4);
250+
if (count == 4)
251+
{
252+
return attributeStorage;
253+
}
262254

263-
attributeStorage.Add(this.attribute6);
264-
if (count == 6)
265-
{
266-
return attributeStorage;
267-
}
255+
attributeStorage.Add(this.attribute5);
256+
if (count == 5)
257+
{
258+
return attributeStorage;
259+
}
268260

269-
attributeStorage.Add(this.attribute7);
270-
if (count == 7)
271-
{
272-
return attributeStorage;
273-
}
261+
attributeStorage.Add(this.attribute6);
262+
if (count == 6)
263+
{
264+
return attributeStorage;
265+
}
274266

275-
attributeStorage.Add(this.attribute8);
267+
attributeStorage.Add(this.attribute7);
268+
if (count == 7)
269+
{
270+
return attributeStorage;
276271
}
277272

273+
attributeStorage.Add(this.attribute8);
274+
278275
return attributeStorage;
279276
}
280277

0 commit comments

Comments
 (0)