Skip to content

Commit 9bfc9a4

Browse files
fix: main_recursion enable lint in no_std crates and fix broken tests
1 parent 6110c80 commit 9bfc9a4

File tree

3 files changed

+28
-4
lines changed

3 files changed

+28
-4
lines changed
Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
1-
//@check-pass
21
//@ignore-target: apple
3-
42
#![feature(rustc_attrs)]
5-
63
#[warn(clippy::main_recursion)]
74
#[allow(unconditional_recursion)]
85
#[rustc_main]
96
fn a() {
10-
println!("Hello, World!");
117
a();
8+
//~^ main_recursion
129
}
10+
11+
fn main() {}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
error: recursing into entrypoint `a`
2+
--> tests/ui/crate_level_checks/entrypoint_recursion.rs:7:5
3+
|
4+
LL | a();
5+
| ^
6+
|
7+
= help: consider using another function for this recursion
8+
= note: `-D clippy::main-recursion` implied by `-D warnings`
9+
= help: to override `-D warnings` add `#[allow(clippy::main_recursion)]`
10+
11+
error: aborting due to 1 previous error
12+
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
//@check-pass
2+
//@compile-flags: -Cpanic=abort
3+
#![no_std]
4+
#[warn(clippy::main_recursion)]
5+
#[allow(unconditional_recursion)]
6+
fn main() {
7+
main();
8+
}
9+
10+
#[panic_handler]
11+
fn panic(_info: &core::panic::PanicInfo) -> ! {
12+
loop {}
13+
}

0 commit comments

Comments
 (0)