summaryrefslogtreecommitdiffstats
path: root/src/tools/clippy/tests/ui-toml/expect_used/expect_used.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/tools/clippy/tests/ui-toml/expect_used/expect_used.rs')
-rw-r--r--src/tools/clippy/tests/ui-toml/expect_used/expect_used.rs23
1 files changed, 14 insertions, 9 deletions
diff --git a/src/tools/clippy/tests/ui-toml/expect_used/expect_used.rs b/src/tools/clippy/tests/ui-toml/expect_used/expect_used.rs
index 22dcd3ae9..bff97d97d 100644
--- a/src/tools/clippy/tests/ui-toml/expect_used/expect_used.rs
+++ b/src/tools/clippy/tests/ui-toml/expect_used/expect_used.rs
@@ -16,14 +16,19 @@ fn main() {
expect_result();
}
-#[test]
-fn test_expect_option() {
- let opt = Some(0);
- let _ = opt.expect("");
-}
+#[cfg(test)]
+mod issue9612 {
+ // should not lint in `#[cfg(test)]` modules
+ #[test]
+ fn test_fn() {
+ let _a: u8 = 2.try_into().unwrap();
+ let _a: u8 = 3.try_into().expect("");
-#[test]
-fn test_expect_result() {
- let res: Result<u8, ()> = Ok(0);
- let _ = res.expect("");
+ util();
+ }
+
+ fn util() {
+ let _a: u8 = 4.try_into().unwrap();
+ let _a: u8 = 5.try_into().expect("");
+ }
}