@@ -54,10 +54,10 @@ impl Validate for LicenseChoice {
5454
5555 match self {
5656 LicenseChoice :: License ( license) => {
57- context. add_struct ( "license" , license, version) ;
57+ context = context . add_struct ( "license" , license, version) ;
5858 }
5959 LicenseChoice :: Expression ( expression) => {
60- context. add_enum ( "expression" , expression, validate_spdx_expression) ;
60+ context = context . add_enum ( "expression" , expression, validate_spdx_expression) ;
6161 }
6262 }
6363
@@ -148,17 +148,15 @@ pub enum LicenseIdentifier {
148148}
149149
150150impl Validate for LicenseIdentifier {
151- fn validate ( & self , version : SpecVersion ) -> ValidationResult {
152- let mut context = ValidationContext :: new ( ) ;
151+ fn validate ( & self , _version : SpecVersion ) -> ValidationResult {
153152 match self {
154- LicenseIdentifier :: Name ( name) => {
155- context . add_enum ( "Name" , name, validate_normalized_string) ;
156- }
157- LicenseIdentifier :: SpdxId ( id) => {
158- context . add_field ( "SpdxId" , id, validate_spdx_identifier) ;
159- }
153+ LicenseIdentifier :: Name ( name) => ValidationContext :: new ( )
154+ . add_enum ( "Name" , name, validate_normalized_string)
155+ . into ( ) ,
156+ LicenseIdentifier :: SpdxId ( id) => ValidationContext :: new ( )
157+ . add_field ( "SpdxId" , id, validate_spdx_identifier)
158+ . into ( ) ,
160159 }
161- context. into ( )
162160 }
163161}
164162
0 commit comments