Skip to content

Commit fceeb13

Browse files
committed
Add test for try_err lint within try blocks.
1 parent eb4d88e commit fceeb13

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

tests/ui/try_err.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//@aux-build:proc_macros.rs
2-
2+
#![feature(try_blocks)]
33
#![deny(clippy::try_err)]
44
#![allow(
55
clippy::unnecessary_wraps,
@@ -152,3 +152,11 @@ pub fn try_return(x: bool) -> Result<i32, i32> {
152152
}
153153
Ok(0)
154154
}
155+
156+
// Test that the lint is suppressed in try block.
157+
pub fn try_block() -> Result<(), i32> {
158+
let _: Result<_, i32> = try {
159+
Err(1)?;
160+
};
161+
Ok(())
162+
}

0 commit comments

Comments
 (0)