tools: fix bogus code in "tools/generate-docs-nm-property-infos.py"

Coverity warns about this:

  2. NetworkManager-1.32.2/tools/generate-docs-nm-property-infos.py:117: identical_branches:
  The same code is executed regardless of whether "temp.index(subelement) < len(temp) - 1" is
  true, because the then and else branches are identical. Should one of the branches be modified,
  or the entire 'if' statement replaced?

Fixes: c3504f7e62 ('Rewrite `./tools/generate-docs-nm-property-infos.py` with XML library')
This commit is contained in:
Thomas Haller 2021-07-06 09:08:30 +02:00
parent c6be3404f8
commit dd595c6c1d
No known key found for this signature in database
GPG key ID: 29C2366E4DFC5728

View file

@ -128,10 +128,7 @@ def pretty_xml(element, newline, level=0):
element.text = newline + element.text.strip() + newline
temp = list(element)
for subelement in temp:
if temp.index(subelement) < (len(temp) - 1):
subelement.tail = newline
else:
subelement.tail = newline
subelement.tail = newline
pretty_xml(subelement, newline, level=level + 1)