@@ -4,7 +4,6 @@ use ruff_text_size::{Ranged, TextRange};
44
55use crate :: checkers:: ast:: Checker ;
66use crate :: fix:: snippet:: SourceCodeSnippet ;
7- use crate :: preview:: is_support_slices_in_literal_concatenation_enabled;
87use crate :: { Edit , Fix , FixAvailability , Violation } ;
98
109/// ## What it does
@@ -96,7 +95,7 @@ enum Type {
9695}
9796
9897/// Recursively merge all the tuples and lists in the expression.
99- fn concatenate_expressions ( expr : & Expr , should_support_slices : bool ) -> Option < ( Expr , Type ) > {
98+ fn concatenate_expressions ( expr : & Expr ) -> Option < ( Expr , Type ) > {
10099 let Expr :: BinOp ( ast:: ExprBinOp {
101100 left,
102101 op : Operator :: Add ,
@@ -108,22 +107,18 @@ fn concatenate_expressions(expr: &Expr, should_support_slices: bool) -> Option<(
108107 } ;
109108
110109 let new_left = match left. as_ref ( ) {
111- Expr :: BinOp ( ast:: ExprBinOp { .. } ) => {
112- match concatenate_expressions ( left, should_support_slices) {
113- Some ( ( new_left, _) ) => new_left,
114- None => * left. clone ( ) ,
115- }
116- }
110+ Expr :: BinOp ( ast:: ExprBinOp { .. } ) => match concatenate_expressions ( left) {
111+ Some ( ( new_left, _) ) => new_left,
112+ None => * left. clone ( ) ,
113+ } ,
117114 _ => * left. clone ( ) ,
118115 } ;
119116
120117 let new_right = match right. as_ref ( ) {
121- Expr :: BinOp ( ast:: ExprBinOp { .. } ) => {
122- match concatenate_expressions ( right, should_support_slices) {
123- Some ( ( new_right, _) ) => new_right,
124- None => * right. clone ( ) ,
125- }
126- }
118+ Expr :: BinOp ( ast:: ExprBinOp { .. } ) => match concatenate_expressions ( right) {
119+ Some ( ( new_right, _) ) => new_right,
120+ None => * right. clone ( ) ,
121+ } ,
127122 _ => * right. clone ( ) ,
128123 } ;
129124
@@ -151,9 +146,7 @@ fn concatenate_expressions(expr: &Expr, should_support_slices: bool) -> Option<(
151146 make_splat_elts ( splat_element, other_elements, splat_at_left)
152147 }
153148 // Subscripts are also considered safe-ish to splat if the indexer is a slice.
154- Expr :: Subscript ( ast:: ExprSubscript { slice, .. } )
155- if should_support_slices && matches ! ( & * * slice, Expr :: Slice ( _) ) =>
156- {
149+ Expr :: Subscript ( ast:: ExprSubscript { slice, .. } ) if matches ! ( & * * slice, Expr :: Slice ( _) ) => {
157150 make_splat_elts ( splat_element, other_elements, splat_at_left)
158151 }
159152 // If the splat element is itself a list/tuple, insert them in the other list/tuple.
@@ -198,10 +191,7 @@ pub(crate) fn collection_literal_concatenation(checker: &Checker, expr: &Expr) {
198191 return ;
199192 }
200193
201- let should_support_slices =
202- is_support_slices_in_literal_concatenation_enabled ( checker. settings ) ;
203-
204- let Some ( ( new_expr, type_) ) = concatenate_expressions ( expr, should_support_slices) else {
194+ let Some ( ( new_expr, type_) ) = concatenate_expressions ( expr) else {
205195 return ;
206196 } ;
207197
0 commit comments