File tree 1 file changed +13
-16
lines changed
1 file changed +13
-16
lines changed Original file line number Diff line number Diff line change @@ -328,26 +328,23 @@ impl Item {
328
328
}
329
329
330
330
pub fn stability_class ( & self ) -> Option < String > {
331
- match self . stability {
332
- Some ( ref s) => {
333
- let mut classes = Vec :: with_capacity ( 2 ) ;
331
+ self . stability . as_ref ( ) . and_then ( |ref s| {
332
+ let mut classes = Vec :: with_capacity ( 2 ) ;
334
333
335
- if s. level == stability:: Unstable {
336
- classes. push ( "unstable" ) ;
337
- }
334
+ if s. level == stability:: Unstable {
335
+ classes. push ( "unstable" ) ;
336
+ }
338
337
339
- if !s. deprecated_since . is_empty ( ) {
340
- classes. push ( "deprecated" ) ;
341
- }
338
+ if !s. deprecated_since . is_empty ( ) {
339
+ classes. push ( "deprecated" ) ;
340
+ }
342
341
343
- if classes. len ( ) != 0 {
344
- Some ( classes. join ( " " ) )
345
- } else {
346
- None
347
- }
342
+ if classes. len ( ) != 0 {
343
+ Some ( classes. join ( " " ) )
344
+ } else {
345
+ None
348
346
}
349
- None => None ,
350
- }
347
+ } )
351
348
}
352
349
353
350
pub fn stable_since ( & self ) -> Option < & str > {
You can’t perform that action at this time.
0 commit comments