@@ -26,11 +26,8 @@ impl SslConfigCtx {
2626 }
2727
2828 pub ( super ) fn cmd ( & mut self , cmd : & str , value : Option < & str > ) -> c_int {
29- let command = match self . supported_command ( cmd) {
30- Some ( command) => command,
31- None => {
32- return -2 ; // "A return value of -2 means option is not recognised."
33- }
29+ let Some ( command) = self . supported_command ( cmd) else {
30+ return -2 ; // "A return value of -2 means option is not recognised."
3431 } ;
3532
3633 match ( command. action ) ( self , value) {
@@ -85,9 +82,8 @@ impl SslConfigCtx {
8582 }
8683
8784 fn min_protocol ( & mut self , proto : Option < & str > ) -> Result < ActionResult , Error > {
88- let ver = match Self :: parse_protocol_version ( proto) {
89- Some ( ver) => ver,
90- None => return Err ( Error :: bad_data ( "unrecognized protocol version" ) ) ,
85+ let Some ( ver) = Self :: parse_protocol_version ( proto) else {
86+ return Err ( Error :: bad_data ( "unrecognized protocol version" ) ) ;
9187 } ;
9288
9389 Ok ( match & self . state {
@@ -105,9 +101,8 @@ impl SslConfigCtx {
105101 }
106102
107103 fn max_protocol ( & mut self , proto : Option < & str > ) -> Result < ActionResult , Error > {
108- let ver = match Self :: parse_protocol_version ( proto) {
109- Some ( ver) => ver,
110- None => return Err ( Error :: bad_data ( "unrecognized protocol version" ) ) ,
104+ let Some ( ver) = Self :: parse_protocol_version ( proto) else {
105+ return Err ( Error :: bad_data ( "unrecognized protocol version" ) ) ;
111106 } ;
112107
113108 Ok ( match & self . state {
@@ -132,9 +127,8 @@ impl SslConfigCtx {
132127 State :: ApplyingToCtx ( ctx) => ctx. get ( ) . verify_mode ,
133128 } ;
134129
135- let raw_mode = match raw_mode {
136- Some ( raw_mode) => raw_mode,
137- None => return Ok ( ActionResult :: ValueRequired ) ,
130+ let Some ( raw_mode) = raw_mode else {
131+ return Ok ( ActionResult :: ValueRequired ) ;
138132 } ;
139133
140134 if !self . flags . is_server ( ) && !self . flags . is_client ( ) {
@@ -176,9 +170,8 @@ impl SslConfigCtx {
176170 }
177171
178172 fn certificate ( & mut self , path : Option < & str > ) -> Result < ActionResult , Error > {
179- let path = match path {
180- Some ( path) => path,
181- None => return Ok ( ActionResult :: ValueRequired ) ,
173+ let Some ( path) = path else {
174+ return Ok ( ActionResult :: ValueRequired ) ;
182175 } ;
183176 let cert_chain = use_cert_chain_file ( path) ?;
184177
@@ -201,9 +194,8 @@ impl SslConfigCtx {
201194 }
202195
203196 fn private_key ( & mut self , path : Option < & str > ) -> Result < ActionResult , Error > {
204- let path = match path {
205- Some ( path) => path,
206- None => return Ok ( ActionResult :: ValueRequired ) ,
197+ let Some ( path) = path else {
198+ return Ok ( ActionResult :: ValueRequired ) ;
207199 } ;
208200 let key = use_private_key_file ( path, FILETYPE_PEM ) ?;
209201
@@ -221,9 +213,8 @@ impl SslConfigCtx {
221213 }
222214
223215 fn verify_ca_path ( & mut self , path : Option < & str > ) -> Result < ActionResult , Error > {
224- let path = match path {
225- Some ( path) => path,
226- None => return Ok ( ActionResult :: ValueRequired ) ,
216+ let Some ( path) = path else {
217+ return Ok ( ActionResult :: ValueRequired ) ;
227218 } ;
228219
229220 match & self . state {
@@ -242,9 +233,8 @@ impl SslConfigCtx {
242233 }
243234
244235 fn verify_ca_file ( & mut self , path : Option < & str > ) -> Result < ActionResult , Error > {
245- let path = match path {
246- Some ( path) => path,
247- None => return Ok ( ActionResult :: ValueRequired ) ,
236+ let Some ( path) = path else {
237+ return Ok ( ActionResult :: ValueRequired ) ;
248238 } ;
249239
250240 match & self . state {
@@ -280,9 +270,8 @@ impl SslConfigCtx {
280270 }
281271
282272 fn options ( & mut self , opts : Option < & str > ) -> Result < ActionResult , Error > {
283- let opts = match opts {
284- Some ( path) => path,
285- None => return Ok ( ActionResult :: ValueRequired ) ,
273+ let Some ( opts) = opts else {
274+ return Ok ( ActionResult :: ValueRequired ) ;
286275 } ;
287276
288277 for part in opts. split ( ',' ) . map ( |part| part. trim ( ) ) {
0 commit comments