Skip to content

Commit

Permalink
Do not ignore first logical line when it comes to tracked vars.
Browse files Browse the repository at this point in the history
  • Loading branch information
hoel-bagard committed Nov 16, 2023
1 parent aa7b6e6 commit 8d3744d
Showing 1 changed file with 5 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -354,12 +354,8 @@ pub(crate) fn blank_lines(
) {
let line_is_comment_only = line.is_comment_only();

if tracked_vars.is_first_logical_line {
if !line_is_comment_only {
tracked_vars.is_first_logical_line = false;
}
// Don't expect blank lines before the first line non comment line.
return;
if tracked_vars.is_first_logical_line && !line_is_comment_only {
tracked_vars.is_first_logical_line = false;
}

let mut follows_class_or_fn = false;
Expand Down Expand Up @@ -406,7 +402,9 @@ pub(crate) fn blank_lines(
continue;
}

if token.kind() == TokenKind::Def
if tracked_vars.is_first_logical_line {
// Don't expect blank lines before the first line non comment line.
} else if token.kind() == TokenKind::Def
// Only applies to method.
&& tracked_vars.is_in_class
&& (
Expand Down

0 comments on commit 8d3744d

Please sign in to comment.