@@ -838,52 +838,6 @@ impl Rewrite for ast::NestedMetaItem {
838
838
}
839
839
}
840
840
841
- fn count_missing_closing_parens ( s : & str ) -> u32 {
842
- let mut op_parens: u32 = 0 ;
843
- let mut cl_parens: u32 = 0 ;
844
-
845
- #[ derive( Eq , PartialEq ) ]
846
- pub enum SnippetState {
847
- Normal ,
848
- InsideStr ,
849
- InsideBulletComment ,
850
- InsideSingleLineComment ,
851
- }
852
-
853
- let mut state = SnippetState :: Normal ;
854
- let mut iter = s. chars ( ) . peekable ( ) ;
855
- let mut prev_char: Option < char > = None ;
856
- while let Some ( c) = iter. next ( ) {
857
- let next_char = iter. peek ( ) ;
858
- match c {
859
- '/' if state == SnippetState :: Normal => match next_char {
860
- Some ( & '*' ) => state = SnippetState :: InsideBulletComment ,
861
- Some ( & '/' ) if prev_char. map_or ( true , |c| c != '*' ) => {
862
- state = SnippetState :: InsideSingleLineComment ;
863
- }
864
- _ => ( ) ,
865
- } ,
866
- '*' if state == SnippetState :: InsideBulletComment &&
867
- next_char. map_or ( false , |c| * c == '/' ) =>
868
- {
869
- state = SnippetState :: Normal ;
870
- }
871
- '\n' if state == SnippetState :: InsideSingleLineComment => state = SnippetState :: Normal ,
872
- '"' if state == SnippetState :: InsideStr && prev_char. map_or ( false , |c| c != '\\' ) => {
873
- state = SnippetState :: Normal ;
874
- }
875
- '"' if state == SnippetState :: Normal && prev_char. map_or ( false , |c| c != '\\' ) => {
876
- state = SnippetState :: InsideStr
877
- }
878
- '(' if state == SnippetState :: Normal => op_parens += 1 ,
879
- ')' if state == SnippetState :: Normal => cl_parens += 1 ,
880
- _ => ( ) ,
881
- }
882
- prev_char = Some ( c) ;
883
- }
884
- op_parens. checked_sub ( cl_parens) . unwrap_or ( 0 )
885
- }
886
-
887
841
impl Rewrite for ast:: MetaItem {
888
842
fn rewrite ( & self , context : & RewriteContext , shape : Shape ) -> Option < String > {
889
843
Some ( match self . node {
@@ -896,21 +850,15 @@ impl Rewrite for ast::MetaItem {
896
850
. shrink_left( name. len( ) + 3 )
897
851
. and_then( |s| s. sub_width( 2 ) )
898
852
) ;
899
- let hi = self . span . hi +
900
- BytePos ( count_missing_closing_parens ( & context. snippet ( self . span ) ) ) ;
901
853
let items = itemize_list (
902
854
context. codemap ,
903
855
list. iter ( ) ,
904
856
")" ,
905
857
|nested_meta_item| nested_meta_item. span . lo ,
906
- // FIXME: Span from MetaItem is missing closing parens.
907
- |nested_meta_item| {
908
- let snippet = context. snippet ( nested_meta_item. span ) ;
909
- nested_meta_item. span . hi + BytePos ( count_missing_closing_parens ( & snippet) )
910
- } ,
858
+ |nested_meta_item| nested_meta_item. span . hi ,
911
859
|nested_meta_item| nested_meta_item. rewrite ( context, item_shape) ,
912
860
self . span . lo ,
913
- hi,
861
+ self . span . hi ,
914
862
false ,
915
863
) ;
916
864
let item_vec = items. collect :: < Vec < _ > > ( ) ;
0 commit comments