@@ -4,7 +4,6 @@ use ruff_text_size::{Ranged, TextRange};
4
4
5
5
use crate :: checkers:: ast:: Checker ;
6
6
use crate :: fix:: snippet:: SourceCodeSnippet ;
7
- use crate :: preview:: is_support_slices_in_literal_concatenation_enabled;
8
7
use crate :: { Edit , Fix , FixAvailability , Violation } ;
9
8
10
9
/// ## What it does
@@ -97,7 +96,7 @@ enum Type {
97
96
}
98
97
99
98
/// Recursively merge all the tuples and lists in the expression.
100
- fn concatenate_expressions ( expr : & Expr , should_support_slices : bool ) -> Option < ( Expr , Type ) > {
99
+ fn concatenate_expressions ( expr : & Expr ) -> Option < ( Expr , Type ) > {
101
100
let Expr :: BinOp ( ast:: ExprBinOp {
102
101
left,
103
102
op : Operator :: Add ,
@@ -110,22 +109,18 @@ fn concatenate_expressions(expr: &Expr, should_support_slices: bool) -> Option<(
110
109
} ;
111
110
112
111
let new_left = match left. as_ref ( ) {
113
- Expr :: BinOp ( ast:: ExprBinOp { .. } ) => {
114
- match concatenate_expressions ( left, should_support_slices) {
115
- Some ( ( new_left, _) ) => new_left,
116
- None => * left. clone ( ) ,
117
- }
118
- }
112
+ Expr :: BinOp ( ast:: ExprBinOp { .. } ) => match concatenate_expressions ( left) {
113
+ Some ( ( new_left, _) ) => new_left,
114
+ None => * left. clone ( ) ,
115
+ } ,
119
116
_ => * left. clone ( ) ,
120
117
} ;
121
118
122
119
let new_right = match right. as_ref ( ) {
123
- Expr :: BinOp ( ast:: ExprBinOp { .. } ) => {
124
- match concatenate_expressions ( right, should_support_slices) {
125
- Some ( ( new_right, _) ) => new_right,
126
- None => * right. clone ( ) ,
127
- }
128
- }
120
+ Expr :: BinOp ( ast:: ExprBinOp { .. } ) => match concatenate_expressions ( right) {
121
+ Some ( ( new_right, _) ) => new_right,
122
+ None => * right. clone ( ) ,
123
+ } ,
129
124
_ => * right. clone ( ) ,
130
125
} ;
131
126
@@ -153,9 +148,7 @@ fn concatenate_expressions(expr: &Expr, should_support_slices: bool) -> Option<(
153
148
make_splat_elts ( splat_element, other_elements, splat_at_left)
154
149
}
155
150
// Subscripts are also considered safe-ish to splat if the indexer is a slice.
156
- Expr :: Subscript ( ast:: ExprSubscript { slice, .. } )
157
- if should_support_slices && matches ! ( & * * slice, Expr :: Slice ( _) ) =>
158
- {
151
+ Expr :: Subscript ( ast:: ExprSubscript { slice, .. } ) if matches ! ( & * * slice, Expr :: Slice ( _) ) => {
159
152
make_splat_elts ( splat_element, other_elements, splat_at_left)
160
153
}
161
154
// If the splat element is itself a list/tuple, insert them in the other list/tuple.
@@ -202,10 +195,7 @@ pub(crate) fn collection_literal_concatenation(checker: &Checker, expr: &Expr) {
202
195
return ;
203
196
}
204
197
205
- let should_support_slices =
206
- is_support_slices_in_literal_concatenation_enabled ( checker. settings ) ;
207
-
208
- let Some ( ( new_expr, type_) ) = concatenate_expressions ( expr, should_support_slices) else {
198
+ let Some ( ( new_expr, type_) ) = concatenate_expressions ( expr) else {
209
199
return ;
210
200
} ;
211
201
0 commit comments