-
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.
changelog: [`result_unit_err`]: do not suggest using `Error` in `no_std` mode before Rust 1.81 Fix #9767
- Loading branch information
Showing
5 changed files
with
67 additions
and
13 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,26 @@ | ||
#![feature(lang_items, start, libc)] | ||
#![no_std] | ||
#![warn(clippy::result_unit_err)] | ||
|
||
#[clippy::msrv = "1.80"] | ||
pub fn returns_unit_error_no_lint() -> Result<u32, ()> { | ||
Err(()) | ||
} | ||
|
||
#[clippy::msrv = "1.81"] | ||
pub fn returns_unit_error_lint() -> Result<u32, ()> { | ||
Err(()) | ||
} | ||
|
||
#[start] | ||
fn main(_argc: isize, _argv: *const *const u8) -> isize { | ||
0 | ||
} | ||
|
||
#[panic_handler] | ||
fn panic(_info: &core::panic::PanicInfo) -> ! { | ||
loop {} | ||
} | ||
|
||
#[lang = "eh_personality"] | ||
extern "C" fn eh_personality() {} |
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,12 @@ | ||
error: this returns a `Result<_, ()>` | ||
--> tests/ui/result_unit_error_no_std.rs:11:1 | ||
| | ||
LL | pub fn returns_unit_error_lint() -> Result<u32, ()> { | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
| | ||
= help: use a custom `Error` type instead | ||
= note: `-D clippy::result-unit-err` implied by `-D warnings` | ||
= help: to override `-D warnings` add `#[allow(clippy::result_unit_err)]` | ||
|
||
error: aborting due to 1 previous error | ||
|