@@ -776,11 +776,10 @@ impl ExprCollector<'_> {
776776 None => self . collect_expr_opt ( e. condition ( ) ) ,
777777 } ;
778778
779- let break_expr =
780- self . alloc_expr ( Expr :: Break { expr : None , label : None } , syntax_ptr. clone ( ) ) ;
779+ let break_expr = self . alloc_expr ( Expr :: Break { expr : None , label : None } , syntax_ptr) ;
781780 let if_expr = self . alloc_expr (
782781 Expr :: If { condition, then_branch : body, else_branch : Some ( break_expr) } ,
783- syntax_ptr. clone ( ) ,
782+ syntax_ptr,
784783 ) ;
785784 self . alloc_expr ( Expr :: Loop { body : if_expr, label } , syntax_ptr)
786785 }
@@ -811,19 +810,19 @@ impl ExprCollector<'_> {
811810 return self . alloc_expr ( Expr :: Missing , syntax_ptr) ;
812811 } ;
813812 let head = self . collect_expr_opt ( e. iterable ( ) ) ;
814- let into_iter_fn_expr = self . alloc_expr ( Expr :: Path ( into_iter_fn) , syntax_ptr. clone ( ) ) ;
813+ let into_iter_fn_expr = self . alloc_expr ( Expr :: Path ( into_iter_fn) , syntax_ptr) ;
815814 let iterator = self . alloc_expr (
816815 Expr :: Call {
817816 callee : into_iter_fn_expr,
818817 args : Box :: new ( [ head] ) ,
819818 is_assignee_expr : false ,
820819 } ,
821- syntax_ptr. clone ( ) ,
820+ syntax_ptr,
822821 ) ;
823822 let none_arm = MatchArm {
824823 pat : self . alloc_pat_desugared ( Pat :: Path ( Box :: new ( option_none) ) ) ,
825824 guard : None ,
826- expr : self . alloc_expr ( Expr :: Break { expr : None , label : None } , syntax_ptr. clone ( ) ) ,
825+ expr : self . alloc_expr ( Expr :: Break { expr : None , label : None } , syntax_ptr) ,
827826 } ;
828827 let some_pat = Pat :: TupleStruct {
829828 path : Some ( Box :: new ( option_some) ) ,
@@ -839,27 +838,25 @@ impl ExprCollector<'_> {
839838 } ) ,
840839 } ;
841840 let iter_name = Name :: generate_new_name ( ) ;
842- let iter_expr =
843- self . alloc_expr ( Expr :: Path ( Path :: from ( iter_name. clone ( ) ) ) , syntax_ptr. clone ( ) ) ;
841+ let iter_expr = self . alloc_expr ( Expr :: Path ( Path :: from ( iter_name. clone ( ) ) ) , syntax_ptr) ;
844842 let iter_expr_mut = self . alloc_expr (
845843 Expr :: Ref { expr : iter_expr, rawness : Rawness :: Ref , mutability : Mutability :: Mut } ,
846- syntax_ptr. clone ( ) ,
844+ syntax_ptr,
847845 ) ;
848- let iter_next_fn_expr = self . alloc_expr ( Expr :: Path ( iter_next_fn) , syntax_ptr. clone ( ) ) ;
846+ let iter_next_fn_expr = self . alloc_expr ( Expr :: Path ( iter_next_fn) , syntax_ptr) ;
849847 let iter_next_expr = self . alloc_expr (
850848 Expr :: Call {
851849 callee : iter_next_fn_expr,
852850 args : Box :: new ( [ iter_expr_mut] ) ,
853851 is_assignee_expr : false ,
854852 } ,
855- syntax_ptr. clone ( ) ,
853+ syntax_ptr,
856854 ) ;
857855 let loop_inner = self . alloc_expr (
858856 Expr :: Match { expr : iter_next_expr, arms : Box :: new ( [ none_arm, some_arm] ) } ,
859- syntax_ptr. clone ( ) ,
857+ syntax_ptr,
860858 ) ;
861- let loop_outer =
862- self . alloc_expr ( Expr :: Loop { body : loop_inner, label } , syntax_ptr. clone ( ) ) ;
859+ let loop_outer = self . alloc_expr ( Expr :: Loop { body : loop_inner, label } , syntax_ptr) ;
863860 let iter_binding = self . alloc_binding ( iter_name, BindingAnnotation :: Mutable ) ;
864861 let iter_pat = self . alloc_pat_desugared ( Pat :: Bind { id : iter_binding, subpat : None } ) ;
865862 self . add_definition_to_binding ( iter_binding, iter_pat) ;
@@ -868,7 +865,7 @@ impl ExprCollector<'_> {
868865 expr : iterator,
869866 arms : Box :: new ( [ MatchArm { pat : iter_pat, guard : None , expr : loop_outer } ] ) ,
870867 } ,
871- syntax_ptr. clone ( ) ,
868+ syntax_ptr,
872869 )
873870 }
874871
@@ -896,10 +893,10 @@ impl ExprCollector<'_> {
896893 return self . alloc_expr ( Expr :: Missing , syntax_ptr) ;
897894 } ;
898895 let operand = self . collect_expr_opt ( e. expr ( ) ) ;
899- let try_branch = self . alloc_expr ( Expr :: Path ( try_branch) , syntax_ptr. clone ( ) ) ;
896+ let try_branch = self . alloc_expr ( Expr :: Path ( try_branch) , syntax_ptr) ;
900897 let expr = self . alloc_expr (
901898 Expr :: Call { callee : try_branch, args : Box :: new ( [ operand] ) , is_assignee_expr : false } ,
902- syntax_ptr. clone ( ) ,
899+ syntax_ptr,
903900 ) ;
904901 let continue_name = Name :: generate_new_name ( ) ;
905902 let continue_binding =
@@ -914,7 +911,7 @@ impl ExprCollector<'_> {
914911 ellipsis : None ,
915912 } ) ,
916913 guard : None ,
917- expr : self . alloc_expr ( Expr :: Path ( Path :: from ( continue_name) ) , syntax_ptr. clone ( ) ) ,
914+ expr : self . alloc_expr ( Expr :: Path ( Path :: from ( continue_name) ) , syntax_ptr) ,
918915 } ;
919916 let break_name = Name :: generate_new_name ( ) ;
920917 let break_binding = self . alloc_binding ( break_name. clone ( ) , BindingAnnotation :: Unannotated ) ;
@@ -928,18 +925,18 @@ impl ExprCollector<'_> {
928925 } ) ,
929926 guard : None ,
930927 expr : {
931- let it = self . alloc_expr ( Expr :: Path ( Path :: from ( break_name) ) , syntax_ptr. clone ( ) ) ;
932- let callee = self . alloc_expr ( Expr :: Path ( try_from_residual) , syntax_ptr. clone ( ) ) ;
928+ let it = self . alloc_expr ( Expr :: Path ( Path :: from ( break_name) ) , syntax_ptr) ;
929+ let callee = self . alloc_expr ( Expr :: Path ( try_from_residual) , syntax_ptr) ;
933930 let result = self . alloc_expr (
934931 Expr :: Call { callee, args : Box :: new ( [ it] ) , is_assignee_expr : false } ,
935- syntax_ptr. clone ( ) ,
932+ syntax_ptr,
936933 ) ;
937934 self . alloc_expr (
938935 match self . current_try_block_label {
939936 Some ( label) => Expr :: Break { expr : Some ( result) , label : Some ( label) } ,
940937 None => Expr :: Return { expr : Some ( result) } ,
941938 } ,
942- syntax_ptr. clone ( ) ,
939+ syntax_ptr,
943940 )
944941 } ,
945942 } ;
@@ -1847,8 +1844,8 @@ impl ExprCollector<'_> {
18471844 flags as u128 ,
18481845 Some ( BuiltinUint :: U32 ) ,
18491846 ) ) ) ;
1850- let precision = self . make_count ( & precision, argmap) ;
1851- let width = self . make_count ( & width, argmap) ;
1847+ let precision = self . make_count ( precision, argmap) ;
1848+ let width = self . make_count ( width, argmap) ;
18521849
18531850 let format_placeholder_new = {
18541851 let format_placeholder_new =
@@ -1994,7 +1991,7 @@ impl ExprCollector<'_> {
19941991 fn alloc_expr ( & mut self , expr : Expr , ptr : ExprPtr ) -> ExprId {
19951992 let src = self . expander . in_file ( ptr) ;
19961993 let id = self . body . exprs . alloc ( expr) ;
1997- self . source_map . expr_map_back . insert ( id, src. clone ( ) ) ;
1994+ self . source_map . expr_map_back . insert ( id, src) ;
19981995 self . source_map . expr_map . insert ( src, id) ;
19991996 id
20001997 }
@@ -2022,7 +2019,7 @@ impl ExprCollector<'_> {
20222019 fn alloc_pat ( & mut self , pat : Pat , ptr : PatPtr ) -> PatId {
20232020 let src = self . expander . in_file ( ptr) ;
20242021 let id = self . body . pats . alloc ( pat) ;
2025- self . source_map . pat_map_back . insert ( id, src. clone ( ) ) ;
2022+ self . source_map . pat_map_back . insert ( id, src) ;
20262023 self . source_map . pat_map . insert ( src, id) ;
20272024 id
20282025 }
@@ -2037,7 +2034,7 @@ impl ExprCollector<'_> {
20372034 fn alloc_label ( & mut self , label : Label , ptr : LabelPtr ) -> LabelId {
20382035 let src = self . expander . in_file ( ptr) ;
20392036 let id = self . body . labels . alloc ( label) ;
2040- self . source_map . label_map_back . insert ( id, src. clone ( ) ) ;
2037+ self . source_map . label_map_back . insert ( id, src) ;
20412038 self . source_map . label_map . insert ( src, id) ;
20422039 id
20432040 }
0 commit comments