@@ -51,9 +51,8 @@ fn test_spec_testvectors() {
5151 // Verify the ciphersuite is supported
5252 assert ! (
5353 supported_ciphersuites. contains_key( & vector. ciphersuite) ,
54- "Unsupported ciphersuite '{}' in test vector {}" ,
55- vector. ciphersuite,
56- test_name
54+ "Unsupported ciphersuite '{}' in test vector {test_name}" ,
55+ vector. ciphersuite
5756 ) ;
5857
5958 // Parse the statement from the test vector
@@ -71,8 +70,7 @@ fn test_spec_testvectors() {
7170 assert_eq ! (
7271 parsed_instance. label( ) ,
7372 vector. statement,
74- "parsed statement doesn't match original for {}" ,
75- test_name
73+ "parsed statement doesn't match original for {test_name}"
7674 ) ;
7775
7876 // Create NIZK with the session_id from the test vector
@@ -90,8 +88,7 @@ fn test_spec_testvectors() {
9088 assert_eq ! (
9189 computed_iv,
9290 vector. iv. as_slice( ) ,
93- "Computed IV doesn't match test vector IV for {}" ,
94- test_name
91+ "Computed IV doesn't match test vector IV for {test_name}"
9592 ) ;
9693
9794 // Generate proof with the proof generation RNG
@@ -101,70 +98,66 @@ fn test_spec_testvectors() {
10198 // Verify the proof matches
10299 assert_eq ! (
103100 proof_bytes, vector. proof,
104- "proof bytes for test vector {} do not match" ,
105- test_name
101+ "proof bytes for test vector {test_name} do not match"
106102 ) ;
107103
108104 // Verify the proof is valid
109105 let verified = nizk. verify_batchable ( & proof_bytes) . is_ok ( ) ;
110106 assert ! (
111107 verified,
112- "Fiat-Shamir Schnorr proof verification failed for {}" ,
113- test_name
108+ "Fiat-Shamir Schnorr proof verification failed for {test_name}"
114109 ) ;
115110 }
116111}
117112
118113fn extract_vectors_new ( path : & str ) -> Result < HashMap < String , TestVector > , String > {
119114 use std:: collections:: HashMap ;
120115
121- let content =
122- fs:: read_to_string ( path) . map_err ( |e| format ! ( "Unable to read JSON file: {}" , e) ) ?;
123- let root: JsonValue =
124- json:: parse ( & content) . map_err ( |e| format ! ( "JSON parsing error: {}" , e) ) ?;
116+ let content = fs:: read_to_string ( path) . map_err ( |e| format ! ( "Unable to read JSON file: {e}" ) ) ?;
117+ let root: JsonValue = json:: parse ( & content) . map_err ( |e| format ! ( "JSON parsing error: {e}" ) ) ?;
125118
126119 let mut vectors = HashMap :: new ( ) ;
127120
128121 for ( name, obj) in root. entries ( ) {
129122 let ciphersuite = obj[ "Ciphersuite" ]
130123 . as_str ( )
131- . ok_or_else ( || format ! ( "Ciphersuite field not found for {}" , name ) ) ?
124+ . ok_or_else ( || format ! ( "Ciphersuite field not found for {name}" ) ) ?
132125 . to_string ( ) ;
133126
134127 let session_id = Vec :: from_hex (
135128 obj[ "SessionId" ]
136129 . as_str ( )
137- . ok_or_else ( || format ! ( "SessionId field not found for {}" , name ) ) ?,
130+ . ok_or_else ( || format ! ( "SessionId field not found for {name}" ) ) ?,
138131 )
139- . map_err ( |e| format ! ( "Invalid hex in SessionId for {}: {}" , name , e ) ) ?;
132+ . map_err ( |e| format ! ( "Invalid hex in SessionId for {name }: {e}" ) ) ?;
140133
141134 let statement = Vec :: from_hex (
142135 obj[ "Statement" ]
143136 . as_str ( )
144- . ok_or_else ( || format ! ( "Statement field not found for {}" , name ) ) ?,
137+ . ok_or_else ( || format ! ( "Statement field not found for {name}" ) ) ?,
145138 )
146- . map_err ( |e| format ! ( "Invalid hex in Statement for {}: {}" , name , e ) ) ?;
139+ . map_err ( |e| format ! ( "Invalid hex in Statement for {name }: {e}" ) ) ?;
147140
148141 let witness = Vec :: from_hex (
149142 obj[ "Witness" ]
150143 . as_str ( )
151- . ok_or_else ( || format ! ( "Witness field not found for {}" , name ) ) ?,
144+ . ok_or_else ( || format ! ( "Witness field not found for {name}" ) ) ?,
152145 )
153- . map_err ( |e| format ! ( "Invalid hex in Witness for {}: {}" , name , e ) ) ?;
146+ . map_err ( |e| format ! ( "Invalid hex in Witness for {name }: {e}" ) ) ?;
154147
155148 let iv = Vec :: from_hex (
156149 obj[ "IV" ]
157150 . as_str ( )
158- . ok_or_else ( || format ! ( "IV field not found for {}" , name ) ) ?,
151+ . ok_or_else ( || format ! ( "IV field not found for {name}" ) ) ?,
159152 )
160- . map_err ( |e| format ! ( "Invalid hex in IV for {}: {}" , name , e ) ) ?;
153+ . map_err ( |e| format ! ( "Invalid hex in IV for {name }: {e}" ) ) ?;
161154
162155 let proof = Vec :: from_hex (
163156 obj[ "Proof" ]
164157 . as_str ( )
165- . ok_or_else ( || format ! ( "Proof field not found for {}" , name ) ) ?,
158+ . ok_or_else ( || format ! ( "Proof field not found for {name}" ) ) ?,
166159 )
167- . map_err ( |e| format ! ( "Invalid hex in Proof for {}: {}" , name , e ) ) ?;
160+ . map_err ( |e| format ! ( "Invalid hex in Proof for {name }: {e}" ) ) ?;
168161
169162 vectors. insert (
170163 name. to_string ( ) ,
0 commit comments