File tree Expand file tree Collapse file tree 1 file changed +13
-16
lines changed Expand file tree Collapse file tree 1 file changed +13
-16
lines changed Original file line number Diff line number Diff line change @@ -328,26 +328,23 @@ impl Item {
328328 }
329329
330330 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 ) ;
334333
335- if s. level == stability:: Unstable {
336- classes. push ( "unstable" ) ;
337- }
334+ if s. level == stability:: Unstable {
335+ classes. push ( "unstable" ) ;
336+ }
338337
339- if !s. deprecated_since . is_empty ( ) {
340- classes. push ( "deprecated" ) ;
341- }
338+ if !s. deprecated_since . is_empty ( ) {
339+ classes. push ( "deprecated" ) ;
340+ }
342341
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
348346 }
349- None => None ,
350- }
347+ } )
351348 }
352349
353350 pub fn stable_since ( & self ) -> Option < & str > {
You can’t perform that action at this time.
0 commit comments