File tree 1 file changed +4
-4
lines changed
1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -216,16 +216,16 @@ fn check_else(cx: &EarlyContext<'_>, expr: &Expr) {
216
216
// it’s bad when there is a ‘\n’ after the “else”
217
217
if let Some ( else_snippet) = snippet_opt( cx, else_span) ;
218
218
if let Some ( ( pre_else, post_else) ) = else_snippet. split_once( "else" ) ;
219
- if let Some ( post_else_eol_pos ) = post_else. find ( '\n' ) ;
219
+ if let Some ( ( _ , post_else_post_eol ) ) = post_else. split_once ( '\n' ) ;
220
220
221
221
then {
222
222
// Allow allman style braces `} \n else \n {`
223
223
if_chain! {
224
224
if is_block( else_) ;
225
- if let Some ( pre_else_eol_pos ) = pre_else. find ( '\n' ) ;
225
+ if let Some ( ( _ , pre_else_post_eol ) ) = pre_else. split_once ( '\n' ) ;
226
226
// Exactly one eol before and after the else
227
- if !pre_else [ pre_else_eol_pos + 1 .. ] . contains( '\n' ) ;
228
- if !post_else [ post_else_eol_pos + 1 .. ] . contains( '\n' ) ;
227
+ if !pre_else_post_eol . contains( '\n' ) ;
228
+ if !post_else_post_eol . contains( '\n' ) ;
229
229
then {
230
230
return ;
231
231
}
You can’t perform that action at this time.
0 commit comments