Skip to content

Commit ad42ac9

Browse files
committed
Return after linting to prevent bugs
1 parent e5bf24a commit ad42ac9

File tree

3 files changed

+3
-17
lines changed

3 files changed

+3
-17
lines changed

clippy_lints/src/items_after_test_module.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ impl LateLintPass<'_> for ItemsAfterTestModule {
7575
) // ^ Copy the item to the new location
7676
], Applicability::MachineApplicable);
7777
});
78+
return;
7879
}
7980
}
8081

tests/ui/items_after_test_modules/items_after_test_module.fixed

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ fn main() {}
99

1010
fn should_lint() {}
1111

12-
const SHOULD_ALSO_LINT: usize = 1;
13-
1412
fn should_not_lint() {}
1513

1614
#[allow(dead_code)]
@@ -24,4 +22,4 @@ mod tests {
2422

2523

2624

27-
25+
const SHOULD_ALSO_LINT: usize = 1;

tests/ui/items_after_test_modules/items_after_test_module.stderr

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,5 @@ LL + fn should_lint() {}
1212
LL +
1313
|
1414

15-
error: an item was found after the testing module
16-
--> $DIR/items_after_test_module.rs:23:1
17-
|
18-
LL | const SHOULD_ALSO_LINT: usize = 1;
19-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
20-
|
21-
help: move the item to before the testing module was defined
22-
|
23-
LL +
24-
LL + const SHOULD_ALSO_LINT: usize = 1;
25-
LL +
26-
|
27-
28-
error: aborting due to 2 previous errors
15+
error: aborting due to previous error
2916

0 commit comments

Comments
 (0)