-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enable empty_loop lint for no_std crates
We skip the lint if the `loop {}` is in the `#[panic_handler]` as the main recommendation we give is to panic, which obviously isn't possible in a panic handler. Signed-off-by: Joe Richey <[email protected]>
- Loading branch information
Showing
4 changed files
with
45 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
error: empty `loop {}` wastes CPU cycles | ||
--> $DIR/empty_loop_no_std.rs:14:5 | ||
| | ||
LL | loop {} | ||
| ^^^^^^^ | ||
| | ||
= note: `-D clippy::empty-loop` implied by `-D warnings` | ||
= help: You should either use `panic!()` or add a call pausing or sleeping the thread to the loop body. | ||
|
||
error: empty `loop {}` wastes CPU cycles | ||
--> $DIR/empty_loop_no_std.rs:26:5 | ||
| | ||
LL | loop {} | ||
| ^^^^^^^ | ||
| | ||
= help: You should either use `panic!()` or add a call pausing or sleeping the thread to the loop body. | ||
|
||
error: aborting due to 2 previous errors | ||
|