Style nit: don't use list comprehensions for side-effecting code.

Signed-off-by: Daira Hopwood <daira@jacaranda.org>
This commit is contained in:
Daira Hopwood 2018-07-21 14:11:07 +01:00
parent 3dfe532bac
commit 5394ee1a15
1 changed files with 3 additions and 3 deletions

View File

@ -93,7 +93,7 @@ def tv_part_rust(name, value, indent=3):
def tv_rust(filename, parts, vectors): def tv_rust(filename, parts, vectors):
print(' struct TestVector {') print(' struct TestVector {')
[print(' %s: %s,' % p) for p in parts] for p in parts: print(' %s: %s,' % p)
print(''' }; print(''' };
// From https://github.com/zcash-hackworks/zcash-test-vectors/blob/master/%s.py''' % ( // From https://github.com/zcash-hackworks/zcash-test-vectors/blob/master/%s.py''' % (
@ -101,13 +101,13 @@ def tv_rust(filename, parts, vectors):
)) ))
if type(vectors) == type({}): if type(vectors) == type({}):
print(' let test_vector = TestVector {') print(' let test_vector = TestVector {')
[tv_part_rust(p[0], vectors[p[0]]) for p in parts] for p in parts: tv_part_rust(p[0], vectors[p[0]])
print(' };') print(' };')
elif type(vectors) == type([]): elif type(vectors) == type([]):
print(' let test_vectors = vec![') print(' let test_vectors = vec![')
for vector in vectors: for vector in vectors:
print(' TestVector {') print(' TestVector {')
[tv_part_rust(p[0], vector[p[0]], 4) for p in parts] for p in parts: tv_part_rust(p[0], vector[p[0]], 4)
print(' },') print(' },')
print(' ];') print(' ];')
else: else: