@@ -164,7 +164,8 @@ impl ExtraFields {
164164 pub ( crate ) fn from_protected_header (
165165 protected : & ProtectedHeader , error_report : & ProblemReport ,
166166 ) -> anyhow:: Result < Self > {
167- let context = "COSE ProtectedHeader to ExtraFields" ;
167+ /// Context for error messages.
168+ const CONTEXT : & str = "COSE ProtectedHeader to ExtraFields" ;
168169
169170 let mut extra = ExtraFields :: default ( ) ;
170171
@@ -180,7 +181,7 @@ impl ExtraFields {
180181 "CBOR COSE protected header doc ref" ,
181182 & format ! ( "{cbor_doc_ref:?}" ) ,
182183 & format ! ( "Expected DocumentRef: {e}" ) ,
183- & format ! ( "{context }, DocumentRef" ) ,
184+ & format ! ( "{CONTEXT }, DocumentRef" ) ,
184185 ) ;
185186 } ,
186187 }
@@ -198,7 +199,7 @@ impl ExtraFields {
198199 "CBOR COSE protected header document template" ,
199200 & format ! ( "{cbor_doc_template:?}" ) ,
200201 & format ! ( "Expected DocumentRef: {e}" ) ,
201- & format ! ( "{context }, DocumentRef" ) ,
202+ & format ! ( "{CONTEXT }, DocumentRef" ) ,
202203 ) ;
203204 } ,
204205 }
@@ -216,7 +217,7 @@ impl ExtraFields {
216217 "CBOR COSE protected header document reply" ,
217218 & format ! ( "{cbor_doc_reply:?}" ) ,
218219 & format ! ( "Expected DocumentRef: {e}" ) ,
219- & format ! ( "{context }, DocumentRef" ) ,
220+ & format ! ( "{CONTEXT }, DocumentRef" ) ,
220221 ) ;
221222 } ,
222223 }
@@ -234,7 +235,7 @@ impl ExtraFields {
234235 "COSE protected header document section" ,
235236 & format ! ( "{cbor_doc_section:?}" ) ,
236237 & format ! ( "Expected String: {e:?}" ) ,
237- & format ! ( "{context }, converting document section to String" ) ,
238+ & format ! ( "{CONTEXT }, converting document section to String" ) ,
238239 ) ;
239240 } ,
240241 }
@@ -256,7 +257,7 @@ impl ExtraFields {
256257 & format ! ( "COSE protected header collaborator index {ids}" ) ,
257258 & format ! ( "{collaborator:?}" ) ,
258259 & format ! ( "Expected String: {e:?}" ) ,
259- & format ! ( "{context }, converting collaborator to String" ) ,
260+ & format ! ( "{CONTEXT }, converting collaborator to String" ) ,
260261 ) ;
261262 } ,
262263 }
@@ -268,7 +269,7 @@ impl ExtraFields {
268269 "CBOR COSE protected header collaborators" ,
269270 & format ! ( "{cbor_doc_collabs:?}" ) ,
270271 & format ! ( "Expected Array: {e:?}" ) ,
271- & format ! ( "{context }, converting collaborators to Array" ) ,
272+ & format ! ( "{CONTEXT }, converting collaborators to Array" ) ,
272273 ) ;
273274 } ,
274275 }
@@ -286,7 +287,7 @@ impl ExtraFields {
286287 "CBOR COSE protected header brand ID" ,
287288 & format ! ( "{cbor_doc_brand_id:?}" ) ,
288289 & format ! ( "Expected UUID: {e:?}" ) ,
289- & format ! ( "{context }, decoding CBOR UUID for brand ID" ) ,
290+ & format ! ( "{CONTEXT }, decoding CBOR UUID for brand ID" ) ,
290291 ) ;
291292 } ,
292293 }
@@ -304,7 +305,7 @@ impl ExtraFields {
304305 "CBOR COSE protected header campaign ID" ,
305306 & format ! ( "{cbor_doc_campaign_id:?}" ) ,
306307 & format ! ( "Expected UUID: {e:?}" ) ,
307- & format ! ( "{context }, decoding CBOR UUID for campaign ID" ) ,
308+ & format ! ( "{CONTEXT }, decoding CBOR UUID for campaign ID" ) ,
308309 ) ;
309310 } ,
310311 }
@@ -322,7 +323,7 @@ impl ExtraFields {
322323 "CBOR COSE protected header election ID" ,
323324 & format ! ( "{cbor_doc_election_id:?}" ) ,
324325 & format ! ( "Expected UUID: {e:?}" ) ,
325- & format ! ( "{context }, decoding CBOR UUID for election ID" ) ,
326+ & format ! ( "{CONTEXT }, decoding CBOR UUID for election ID" ) ,
326327 ) ;
327328 } ,
328329 }
@@ -340,7 +341,7 @@ impl ExtraFields {
340341 "CBOR COSE protected header category ID" ,
341342 & format ! ( "{cbor_doc_category_id:?}" ) ,
342343 & format ! ( "Expected UUID: {e:?}" ) ,
343- & format ! ( "{context }, decoding CBOR UUID for category ID" ) ,
344+ & format ! ( "{CONTEXT }, decoding CBOR UUID for category ID" ) ,
344345 ) ;
345346 } ,
346347 }
0 commit comments