@@ -1193,7 +1193,7 @@ fn parse_named_import_or_export_specifiers<'a>(parent: &Node<'a>, specifiers: Ve
11931193 fn get_node_sorter < ' a > (
11941194 parent_decl : & Node ,
11951195 context : & Context < ' a > ,
1196- ) -> Option < Box < dyn Fn ( & Option < Node < ' a > > , & Option < Node < ' a > > , & mut Context < ' a > ) -> std:: cmp:: Ordering > > {
1196+ ) -> Option < Box < dyn Fn ( & Option < Node < ' a > > , & Option < Node < ' a > > , & Context < ' a > ) -> std:: cmp:: Ordering > > {
11971197 match parent_decl {
11981198 Node :: NamedExport ( _) => get_node_sorter_from_order ( context. config . export_declaration_sort_named_exports ) ,
11991199 Node :: ImportDecl ( _) => get_node_sorter_from_order ( context. config . import_declaration_sort_named_imports ) ,
@@ -5095,7 +5095,7 @@ struct ParseSeparatedValuesOptions<'a> {
50955095 custom_single_line_separator : Option < PrintItems > ,
50965096 multi_line_options : parser_helpers:: MultiLineOptions ,
50975097 force_possible_newline_at_start : bool ,
5098- node_sorter : Option < Box < dyn Fn ( & Option < Node < ' a > > , & Option < Node < ' a > > , & mut Context < ' a > ) -> std:: cmp:: Ordering > > ,
5098+ node_sorter : Option < Box < dyn Fn ( & Option < Node < ' a > > , & Option < Node < ' a > > , & Context < ' a > ) -> std:: cmp:: Ordering > > ,
50995099}
51005100
51015101#[ inline]
@@ -5435,7 +5435,7 @@ struct ParseObjectLikeNodeOptions<'a> {
54355435 prefer_single_line : bool ,
54365436 surround_single_line_with_spaces : bool ,
54375437 allow_blank_lines : bool ,
5438- node_sorter : Option < Box < dyn Fn ( & Option < Node < ' a > > , & Option < Node < ' a > > , & mut Context < ' a > ) -> std:: cmp:: Ordering > > ,
5438+ node_sorter : Option < Box < dyn Fn ( & Option < Node < ' a > > , & Option < Node < ' a > > , & Context < ' a > ) -> std:: cmp:: Ordering > > ,
54395439}
54405440
54415441fn parse_object_like_node < ' a > ( opts : ParseObjectLikeNodeOptions < ' a > , context : & mut Context < ' a > ) -> PrintItems {
@@ -6789,54 +6789,3 @@ fn get_parsed_semi_colon(option: SemiColons, is_trailing: bool, is_multi_line: &
67896789fn create_span_data ( lo : BytePos , hi : BytePos ) -> Span {
67906790 Span { lo, hi, ctxt : Default :: default ( ) }
67916791}
6792-
6793- /* sort functions */
6794-
6795- fn get_node_sorter_from_order < ' a > ( order : SortOrder ) -> Option < Box < dyn Fn ( & Option < Node < ' a > > , & Option < Node < ' a > > , & mut Context < ' a > ) -> std:: cmp:: Ordering > > {
6796- match order {
6797- SortOrder :: Maintain => None ,
6798- SortOrder :: CaseInsensitive => Some ( sort_by_text_case_insensitive ( ) ) ,
6799- SortOrder :: CaseSensitive => Some ( sort_by_text_case_sensitive ( ) ) ,
6800- }
6801- }
6802-
6803- fn sort_by_text_case_insensitive < ' a > ( ) -> Box < dyn Fn ( & Option < Node < ' a > > , & Option < Node < ' a > > , & mut Context < ' a > ) -> std:: cmp:: Ordering > {
6804- Box :: new ( |a, b, context| {
6805- if let Some ( a) = a. as_ref ( ) {
6806- if let Some ( b) = b. as_ref ( ) {
6807- let case_insensitive_result = a. text ( context) . to_lowercase ( ) . cmp ( & b. text ( context) . to_lowercase ( ) ) ;
6808- if case_insensitive_result == std:: cmp:: Ordering :: Equal {
6809- a. text ( context) . cmp ( & b. text ( context) ) // do a case sensitive comparison at this point
6810- } else {
6811- case_insensitive_result
6812- }
6813- } else {
6814- std:: cmp:: Ordering :: Greater
6815- }
6816- } else {
6817- if b. is_none ( ) {
6818- std:: cmp:: Ordering :: Equal
6819- } else {
6820- std:: cmp:: Ordering :: Less
6821- }
6822- }
6823- } )
6824- }
6825-
6826- fn sort_by_text_case_sensitive < ' a > ( ) -> Box < dyn Fn ( & Option < Node < ' a > > , & Option < Node < ' a > > , & mut Context < ' a > ) -> std:: cmp:: Ordering > {
6827- Box :: new ( |a, b, context| {
6828- if let Some ( a) = a. as_ref ( ) {
6829- if let Some ( b) = b. as_ref ( ) {
6830- a. text ( context) . cmp ( & b. text ( context) ) // do a case sensitive comparison at this point
6831- } else {
6832- std:: cmp:: Ordering :: Greater
6833- }
6834- } else {
6835- if b. is_none ( ) {
6836- std:: cmp:: Ordering :: Equal
6837- } else {
6838- std:: cmp:: Ordering :: Less
6839- }
6840- }
6841- } )
6842- }
0 commit comments