@@ -8626,12 +8626,7 @@ impl<'a> ExtractFunction<'a> {
8626
8626
let location = statements
8627
8627
. first ( )
8628
8628
. location ( )
8629
- . merge ( & match & statements. last ( ) {
8630
- ast:: Statement :: Expression ( expression) => expression. location ( ) ,
8631
- ast:: Statement :: Assignment ( assignment) => assignment. location ,
8632
- ast:: Statement :: Assert ( assert) => assert. location ,
8633
- ast:: Statement :: Use ( use_) => use_. call . location ( ) ,
8634
- } ) ;
8629
+ . merge ( & statements. last ( ) . location ( ) ) ;
8635
8630
8636
8631
self . extract_code_in_tail_position (
8637
8632
* full_location,
@@ -8972,12 +8967,7 @@ impl<'ast> ast::visit::Visit<'ast> for ExtractFunction<'ast> {
8972
8967
statements : & ' ast [ TypedStatement ] ,
8973
8968
) {
8974
8969
let last_statement_location = self . last_statement_location ;
8975
- self . last_statement_location = statements. last ( ) . map ( |last| match last {
8976
- ast:: Statement :: Expression ( _)
8977
- | ast:: Statement :: Assignment ( _)
8978
- | ast:: Statement :: Assert ( _) => last. location ( ) ,
8979
- ast:: Statement :: Use ( use_) => last. location ( ) . merge ( & use_. call . location ( ) ) ,
8980
- } ) ;
8970
+ self . last_statement_location = statements. last ( ) . map ( |last| last. location ( ) ) ;
8981
8971
8982
8972
ast:: visit:: visit_typed_expr_block ( self , location, statements) ;
8983
8973
@@ -9002,12 +8992,7 @@ impl<'ast> ast::visit::Visit<'ast> for ExtractFunction<'ast> {
9002
8992
}
9003
8993
9004
8994
fn visit_typed_statement ( & mut self , statement : & ' ast TypedStatement ) {
9005
- let statement_location = match statement {
9006
- ast:: Statement :: Expression ( expression) => expression. location ( ) ,
9007
- ast:: Statement :: Assignment ( assignment) => assignment. location ,
9008
- ast:: Statement :: Assert ( assert) => assert. location ,
9009
- ast:: Statement :: Use ( use_) => use_. location . merge ( & use_. call . location ( ) ) ,
9010
- } ;
8995
+ let statement_location = statement. location ( ) ;
9011
8996
9012
8997
if self . can_extract ( statement_location) {
9013
8998
let is_in_tail_position =
0 commit comments