mirror of
https://github.com/rust-lang/rust-clippy
synced 2025-02-17 06:28:42 +00:00
Add test for try_err
lint within try blocks.
This commit is contained in:
parent
eb4d88e690
commit
fceeb13399
1 changed files with 9 additions and 1 deletions
|
@ -1,5 +1,5 @@
|
|||
//@aux-build:proc_macros.rs
|
||||
|
||||
#![feature(try_blocks)]
|
||||
#![deny(clippy::try_err)]
|
||||
#![allow(
|
||||
clippy::unnecessary_wraps,
|
||||
|
@ -152,3 +152,11 @@ pub fn try_return(x: bool) -> Result<i32, i32> {
|
|||
}
|
||||
Ok(0)
|
||||
}
|
||||
|
||||
// Test that the lint is suppressed in try block.
|
||||
pub fn try_block() -> Result<(), i32> {
|
||||
let _: Result<_, i32> = try {
|
||||
Err(1)?;
|
||||
};
|
||||
Ok(())
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue