Skip to content

Commit

Permalink
Do not count Rust functions in return statements for lloc
Browse files Browse the repository at this point in the history
  • Loading branch information
Luni-4 committed Mar 19, 2021
1 parent 20d1fd8 commit 9cb72f1
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/metrics/loc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,9 @@ impl Loc for RustCode {
| WhileLetExpression
| ForExpression
| IfExpression
| IfLetExpression,
| IfLetExpression
| ReturnExpression
| AwaitExpression,
Block
) == 0
{
Expand Down Expand Up @@ -675,6 +677,18 @@ mod tests {
);
}

#[test]
fn rust_function_in_return_lloc() {
check_metrics!(
"return foo();
await foo();",
"foo.rs",
RustParser,
loc,
[(lloc, 2, usize)]
);
}

#[test]
fn rust_closure_expression_lloc() {
check_metrics!(
Expand Down

0 comments on commit 9cb72f1

Please sign in to comment.