@@ -16,23 +16,23 @@ fn default_indentation_spaces() -> u32 {
1616 INDENTATION_LEVEL_DEFAULT
1717}
1818
19- pub struct MethodOutputBreakRule {
19+ pub struct BreakMethodOutputRule {
2020 pub enabled : bool
2121}
2222
23- pub struct MethodOutputBreakArgs {
23+ pub struct BreakMethodOutputArgs {
2424 pub before_arrow_range : ZeroRange ,
2525 pub arrow_range : ZeroRange ,
2626 pub after_arrow_range : ZeroRange ,
2727}
2828
2929#[ derive( Clone , Debug , Serialize , Deserialize , PartialEq ) ]
30- pub struct MethodOutputBreakOptions {
30+ pub struct BreakMethodOutputOptions {
3131}
3232
33- impl Rule for MethodOutputBreakRule {
33+ impl Rule for BreakMethodOutputRule {
3434 fn name ( ) -> & ' static str {
35- "method_output_break "
35+ "break_method_output "
3636 }
3737 fn description ( ) -> & ' static str {
3838 "Break long method declarations with output parameters before the arrow."
@@ -42,19 +42,19 @@ impl Rule for MethodOutputBreakRule {
4242 }
4343}
4444
45- impl MethodOutputBreakArgs {
46- pub fn from_method ( node : & MethodContent ) -> Option < MethodOutputBreakArgs > {
45+ impl BreakMethodOutputArgs {
46+ pub fn from_method ( node : & MethodContent ) -> Option < BreakMethodOutputArgs > {
4747 let Some ( returns) = & node. returns else { return None ; } ;
48- Some ( MethodOutputBreakArgs {
48+ Some ( BreakMethodOutputArgs {
4949 before_arrow_range : node. rparen . range ( ) ,
5050 arrow_range : returns. 0 . range ( ) ,
5151 after_arrow_range : returns. 1 . range ( ) ,
5252 } )
5353 }
5454}
5555
56- impl MethodOutputBreakRule {
57- pub fn check ( & self , args : Option < MethodOutputBreakArgs > , acc : & mut Vec < DMLStyleError > ) {
56+ impl BreakMethodOutputRule {
57+ pub fn check ( & self , args : Option < BreakMethodOutputArgs > , acc : & mut Vec < DMLStyleError > ) {
5858 if !self . enabled { return ; }
5959 let Some ( args) = args else { return ; } ;
6060 if args. before_arrow_range . row_end . 0 == args. after_arrow_range . row_start . 0 {
@@ -68,26 +68,26 @@ impl MethodOutputBreakRule {
6868 }
6969}
7070
71- pub struct FuncCallBreakOnOpenParenRule {
71+ pub struct BreakFuncCallOpenParenRule {
7272 pub enabled : bool ,
7373 indentation_spaces : u32
7474}
7575
76- pub struct FuncCallBreakOnOpenParenArgs {
76+ pub struct BreakFuncCallOpenParenArgs {
7777 pub members_ranges : Vec < ZeroRange > ,
7878 pub expected_depth : u32 ,
7979 pub lparen : ZeroRange ,
8080}
8181
8282#[ derive( Clone , Debug , Serialize , Deserialize , PartialEq ) ]
83- pub struct FuncCallBreakOnOpenParenOptions {
83+ pub struct BreakFuncCallOpenParenOptions {
8484 #[ serde( default = "default_indentation_spaces" ) ]
8585 pub indentation_spaces : u32 ,
8686}
8787
88- impl Rule for FuncCallBreakOnOpenParenRule {
88+ impl Rule for BreakFuncCallOpenParenRule {
8989 fn name ( ) -> & ' static str {
90- "FUNC_CALL_BREAK_ON_OPEN_PAREN "
90+ "break_func_call_open_paren "
9191 }
9292 fn description ( ) -> & ' static str {
9393 "Function or method calls broken right after opening parenthesis should
@@ -98,7 +98,7 @@ impl Rule for FuncCallBreakOnOpenParenRule {
9898 }
9999}
100100
101- impl FuncCallBreakOnOpenParenArgs {
101+ impl BreakFuncCallOpenParenArgs {
102102 pub fn filter_out_parenthesized_tokens ( expression_tokens : TreeElementTokenIterator ) -> Vec < Token > {
103103 let mut token_list: Vec < Token > = vec ! [ ] ;
104104 let mut paren_depth = 0 ;
@@ -125,7 +125,7 @@ impl FuncCallBreakOnOpenParenArgs {
125125 }
126126 token_list
127127 }
128- pub fn from_function_call ( node : & FunctionCallContent , depth : u32 ) -> Option < FuncCallBreakOnOpenParenArgs > {
128+ pub fn from_function_call ( node : & FunctionCallContent , depth : u32 ) -> Option < BreakFuncCallOpenParenArgs > {
129129 let mut filtered_member_ranges: Vec < ZeroRange > = vec ! [ ] ;
130130 for ( arg, _comma) in node. arguments . iter ( ) {
131131 filtered_member_ranges. extend (
@@ -139,40 +139,40 @@ impl FuncCallBreakOnOpenParenArgs {
139139 filtered_member_ranges. first ( ) ?. to_owned ( ) ) {
140140 return None
141141 }
142- Some ( FuncCallBreakOnOpenParenArgs {
142+ Some ( BreakFuncCallOpenParenArgs {
143143 members_ranges : filtered_member_ranges,
144144 expected_depth : depth,
145145 lparen : node. lparen . range ( ) ,
146146 } )
147147 }
148148
149- pub fn from_paren_expression ( node : & ParenExpressionContent , depth : u32 ) -> Option < FuncCallBreakOnOpenParenArgs > {
150- Some ( FuncCallBreakOnOpenParenArgs {
149+ pub fn from_paren_expression ( node : & ParenExpressionContent , depth : u32 ) -> Option < BreakFuncCallOpenParenArgs > {
150+ Some ( BreakFuncCallOpenParenArgs {
151151 members_ranges : Self :: filter_out_parenthesized_tokens ( node. expr . tokens ( ) )
152152 . iter ( ) . map ( |t| t. range ) . collect ( ) ,
153153 expected_depth : depth,
154154 lparen : node. lparen . range ( ) ,
155155 } )
156156 }
157157
158- pub fn from_method ( node : & MethodContent , depth : u32 ) -> Option < FuncCallBreakOnOpenParenArgs > {
158+ pub fn from_method ( node : & MethodContent , depth : u32 ) -> Option < BreakFuncCallOpenParenArgs > {
159159 let mut filtered_member_ranges: Vec < ZeroRange > = vec ! [ ] ;
160160 for ( arg, _comma) in node. arguments . iter ( ) {
161161 filtered_member_ranges. extend (
162162 Self :: filter_out_parenthesized_tokens ( arg. tokens ( ) )
163163 . iter ( ) . map ( |t| t. range ) ) ;
164164 }
165- Some ( FuncCallBreakOnOpenParenArgs {
165+ Some ( BreakFuncCallOpenParenArgs {
166166 members_ranges : filtered_member_ranges,
167167 expected_depth : depth,
168168 lparen : node. lparen . range ( ) ,
169169 } )
170170 }
171171
172- pub fn from_cast ( node : & CastContent , depth : u32 ) -> Option < FuncCallBreakOnOpenParenArgs > {
172+ pub fn from_cast ( node : & CastContent , depth : u32 ) -> Option < BreakFuncCallOpenParenArgs > {
173173 let mut cast_member_tokens = node. from . tokens ( ) ;
174174 cast_member_tokens. append ( & mut node. to . tokens ( ) ) ;
175- Some ( FuncCallBreakOnOpenParenArgs {
175+ Some ( BreakFuncCallOpenParenArgs {
176176 members_ranges : Self :: filter_out_parenthesized_tokens ( cast_member_tokens)
177177 . iter ( ) . map ( |t| t. range ) . collect ( ) ,
178178 expected_depth : depth,
@@ -181,21 +181,21 @@ impl FuncCallBreakOnOpenParenArgs {
181181 }
182182}
183183
184- impl FuncCallBreakOnOpenParenRule {
185- pub fn from_options ( options : & Option < FuncCallBreakOnOpenParenOptions > ) -> FuncCallBreakOnOpenParenRule {
184+ impl BreakFuncCallOpenParenRule {
185+ pub fn from_options ( options : & Option < BreakFuncCallOpenParenOptions > ) -> BreakFuncCallOpenParenRule {
186186 match options {
187- Some ( options) => FuncCallBreakOnOpenParenRule {
187+ Some ( options) => BreakFuncCallOpenParenRule {
188188 enabled : true ,
189189 indentation_spaces : options. indentation_spaces
190190 } ,
191- None => FuncCallBreakOnOpenParenRule {
191+ None => BreakFuncCallOpenParenRule {
192192 enabled : false ,
193193 indentation_spaces : 0
194194 }
195195 }
196196 }
197197
198- pub fn check ( & self , args : Option < FuncCallBreakOnOpenParenArgs > , acc : & mut Vec < DMLStyleError > ) {
198+ pub fn check ( & self , args : Option < BreakFuncCallOpenParenArgs > , acc : & mut Vec < DMLStyleError > ) {
199199 if !self . enabled { return ; }
200200 let Some ( args) = args else { return ; } ;
201201 if args. members_ranges . is_empty ( ) { return ; }
@@ -271,11 +271,11 @@ impl Rule for BreakBeforeBinaryOpRule {
271271 }
272272}
273273
274- pub struct ConditionalExpressionBreakBeforeOperatorRule {
274+ pub struct BreakConditionalExpressionRule {
275275 pub enabled : bool ,
276276}
277277
278- pub struct ConditionalExpressionBreakBeforeOperatorArgs {
278+ pub struct BreakConditionalExpression {
279279 pub left : ZeroRange ,
280280 pub left_operation : ZeroRange ,
281281 pub middle : ZeroRange ,
@@ -284,10 +284,10 @@ pub struct ConditionalExpressionBreakBeforeOperatorArgs {
284284}
285285
286286
287- impl ConditionalExpressionBreakBeforeOperatorArgs {
287+ impl BreakConditionalExpression {
288288 pub fn from_tertiary_expression ( node : & TertiaryExpressionContent )
289- -> Option < ConditionalExpressionBreakBeforeOperatorArgs > {
290- Some ( ConditionalExpressionBreakBeforeOperatorArgs {
289+ -> Option < BreakConditionalExpression > {
290+ Some ( BreakConditionalExpression {
291291 left : node. left . range ( ) ,
292292 left_operation : node. left_operation . range ( ) ,
293293 middle : node. middle . range ( ) ,
@@ -297,19 +297,19 @@ impl ConditionalExpressionBreakBeforeOperatorArgs {
297297 }
298298}
299299
300- impl ConditionalExpressionBreakBeforeOperatorRule {
301- pub fn from_options ( options : & Option < ConditionalExpressionBreakBeforeOperatorOptions > ) -> ConditionalExpressionBreakBeforeOperatorRule {
300+ impl BreakConditionalExpressionRule {
301+ pub fn from_options ( options : & Option < BreakConditionalExpressionOptions > ) -> BreakConditionalExpressionRule {
302302 match options {
303- Some ( _options) => ConditionalExpressionBreakBeforeOperatorRule {
303+ Some ( _options) => BreakConditionalExpressionRule {
304304 enabled : true ,
305305 } ,
306- None => ConditionalExpressionBreakBeforeOperatorRule {
306+ None => BreakConditionalExpressionRule {
307307 enabled : false ,
308308 }
309309 }
310310 }
311311
312- pub fn check ( & self , args : Option < ConditionalExpressionBreakBeforeOperatorArgs > , acc : & mut Vec < DMLStyleError > ) {
312+ pub fn check ( & self , args : Option < BreakConditionalExpression > , acc : & mut Vec < DMLStyleError > ) {
313313 if !self . enabled { return ; }
314314 let Some ( args) = args else { return ; } ;
315315 let has_break_before_question_operator = args. left . row_end . 0 != args. left_operation . row_start . 0 ;
@@ -327,12 +327,12 @@ impl ConditionalExpressionBreakBeforeOperatorRule {
327327
328328
329329#[ derive( Clone , Debug , Serialize , Deserialize , PartialEq ) ]
330- pub struct ConditionalExpressionBreakBeforeOperatorOptions {
330+ pub struct BreakConditionalExpressionOptions {
331331}
332332
333- impl Rule for ConditionalExpressionBreakBeforeOperatorRule {
333+ impl Rule for BreakConditionalExpressionRule {
334334 fn name ( ) -> & ' static str {
335- "COND_EXPRESSION_BREAK_BEFORE_OPERATOR "
335+ "break_conditional_expression "
336336 }
337337 fn description ( ) -> & ' static str {
338338 "Break conditional expressions before the ?, or both before the ? and before the :."
0 commit comments