@@ -139,10 +139,7 @@ impl<'a> FmtVisitor<'a> {
139139 ast:: ForeignItemKind :: Static ( ref ty, is_mutable) => {
140140 // FIXME(#21): we're dropping potential comments in between the
141141 // function keywords here.
142- let vis = match format_visibility ( & item. vis ) {
143- Some ( s) => s,
144- None => return ,
145- } ;
142+ let vis = format_visibility ( & item. vis ) ;
146143 let mut_str = if is_mutable {
147144 "mut "
148145 } else {
@@ -453,7 +450,7 @@ pub fn format_impl(context: &RewriteContext, item: &ast::Item, offset: Indent) -
453450 ref self_ty,
454451 ref items) = item. node {
455452 let mut result = String :: new ( ) ;
456- result. push_str ( try_opt ! ( format_visibility( & item. vis) ) ) ;
453+ result. push_str ( & * format_visibility ( & item. vis ) ) ;
457454 result. push_str ( format_unsafety ( unsafety) ) ;
458455 result. push_str ( "impl" ) ;
459456
@@ -623,7 +620,7 @@ pub fn format_trait(context: &RewriteContext, item: &ast::Item, offset: Indent)
623620 item. node {
624621 let mut result = String :: new ( ) ;
625622 let header = format ! ( "{}{}trait {}" ,
626- try_opt! ( format_visibility( & item. vis) ) ,
623+ format_visibility( & item. vis) ,
627624 format_unsafety( unsafety) ,
628625 item. ident) ;
629626
@@ -945,7 +942,7 @@ pub fn rewrite_type_alias(context: &RewriteContext,
945942 -> Option < String > {
946943 let mut result = String :: new ( ) ;
947944
948- result. push_str ( & try_opt ! ( format_visibility( & vis) ) ) ;
945+ result. push_str ( & format_visibility ( & vis) ) ;
949946 result. push_str ( "type " ) ;
950947 result. push_str ( & ident. to_string ( ) ) ;
951948
@@ -1013,7 +1010,7 @@ impl Rewrite for ast::StructField {
10131010 }
10141011
10151012 let name = self . ident ;
1016- let vis = try_opt ! ( format_visibility( & self . vis) ) ;
1013+ let vis = format_visibility ( & self . vis ) ;
10171014 let mut attr_str = try_opt ! ( self . attrs
10181015 . rewrite( context, context. config. max_width - offset. width( ) , offset) ) ;
10191016 if !attr_str. is_empty ( ) {
@@ -1042,7 +1039,7 @@ pub fn rewrite_static(prefix: &str,
10421039 context : & RewriteContext )
10431040 -> Option < String > {
10441041 let prefix = format ! ( "{}{} {}{}: " ,
1045- try_opt! ( format_visibility( vis) ) ,
1042+ format_visibility( vis) ,
10461043 prefix,
10471044 format_mutability( mutability) ,
10481045 ident) ;
@@ -1260,7 +1257,7 @@ fn rewrite_fn_base(context: &RewriteContext,
12601257
12611258 let mut result = String :: with_capacity ( 1024 ) ;
12621259 // Vis unsafety abi.
1263- result. push_str ( try_opt ! ( format_visibility( vis) ) ) ;
1260+ result. push_str ( & * format_visibility ( vis) ) ;
12641261
12651262 if let ast:: Constness :: Const = constness {
12661263 result. push_str ( "const " ) ;
@@ -1817,7 +1814,7 @@ fn rewrite_where_clause(context: &RewriteContext,
18171814}
18181815
18191816fn format_header ( item_name : & str , ident : ast:: Ident , vis : & ast:: Visibility ) -> Option < String > {
1820- Some ( format ! ( "{}{}{}" , try_opt! ( format_visibility( vis) ) , item_name, ident) )
1817+ Some ( format ! ( "{}{}{}" , format_visibility( vis) , item_name, ident) )
18211818}
18221819
18231820fn format_generics ( context : & RewriteContext ,
0 commit comments