11use std:: iter:: ExactSizeIterator ;
22use std:: ops:: Deref ;
33
4- use rustc_ast:: ast:: { self , AttrVec , FnRetTy , Mutability } ;
5- use rustc_span:: { symbol:: kw, symbol :: Ident , BytePos , Pos , Span } ;
4+ use rustc_ast:: ast:: { self , FnRetTy , Mutability } ;
5+ use rustc_span:: { symbol:: kw, BytePos , Pos , Span } ;
66
7+ use crate :: comment:: { combine_strs_with_missing_comments, contains_comment} ;
78use crate :: config:: lists:: * ;
89use crate :: config:: { IndentStyle , TypeDensity , Version } ;
910use crate :: expr:: {
1011 format_expr, rewrite_assign_rhs, rewrite_call, rewrite_tuple, rewrite_unary_prefix, ExprType ,
1112} ;
12- use crate :: items:: StructParts ;
1313use crate :: lists:: {
1414 definitive_tactic, itemize_list, write_list, ListFormatting , ListItem , Separator ,
1515} ;
@@ -24,11 +24,6 @@ use crate::utils::{
2424 colon_spaces, extra_offset, first_line_width, format_extern, format_mutability,
2525 last_line_extendable, last_line_width, mk_sp, rewrite_ident,
2626} ;
27- use crate :: DEFAULT_VISIBILITY ;
28- use crate :: {
29- comment:: { combine_strs_with_missing_comments, contains_comment} ,
30- items:: format_struct_struct,
31- } ;
3227
3328#[ derive( Copy , Clone , Debug , Eq , PartialEq ) ]
3429pub ( crate ) enum PathContext {
@@ -769,54 +764,6 @@ impl Rewrite for ast::Ty {
769764 ast:: TyKind :: Tup ( ref items) => {
770765 rewrite_tuple ( context, items. iter ( ) , self . span , shape, items. len ( ) == 1 )
771766 }
772- ast:: TyKind :: AnonymousStruct ( ref fields, recovered) => {
773- let ident = Ident :: new (
774- kw:: Struct ,
775- mk_sp ( self . span . lo ( ) , self . span . lo ( ) + BytePos ( 6 ) ) ,
776- ) ;
777- let data = ast:: VariantData :: Struct ( fields. clone ( ) , recovered) ;
778- let variant = ast:: Variant {
779- attrs : AttrVec :: new ( ) ,
780- id : self . id ,
781- span : self . span ,
782- vis : DEFAULT_VISIBILITY ,
783- ident,
784- data,
785- disr_expr : None ,
786- is_placeholder : false ,
787- } ;
788- format_struct_struct (
789- & context,
790- & StructParts :: from_variant ( & variant) ,
791- fields,
792- shape. indent ,
793- None ,
794- )
795- }
796- ast:: TyKind :: AnonymousUnion ( ref fields, recovered) => {
797- let ident = Ident :: new (
798- kw:: Union ,
799- mk_sp ( self . span . lo ( ) , self . span . lo ( ) + BytePos ( 5 ) ) ,
800- ) ;
801- let data = ast:: VariantData :: Struct ( fields. clone ( ) , recovered) ;
802- let variant = ast:: Variant {
803- attrs : AttrVec :: new ( ) ,
804- id : self . id ,
805- span : self . span ,
806- vis : DEFAULT_VISIBILITY ,
807- ident,
808- data,
809- disr_expr : None ,
810- is_placeholder : false ,
811- } ;
812- format_struct_struct (
813- & context,
814- & StructParts :: from_variant ( & variant) ,
815- fields,
816- shape. indent ,
817- None ,
818- )
819- }
820767 ast:: TyKind :: Path ( ref q_self, ref path) => {
821768 rewrite_path ( context, PathContext :: Type , q_self. as_ref ( ) , path, shape)
822769 }
0 commit comments