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