summaryrefslogtreecommitdiffstats
path: root/src/tools/clippy/tests/ui-toml/unwrap_used/unwrap_used.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/tools/clippy/tests/ui-toml/unwrap_used/unwrap_used.rs')
-rw-r--r--src/tools/clippy/tests/ui-toml/unwrap_used/unwrap_used.rs21
1 files changed, 17 insertions, 4 deletions
diff --git a/src/tools/clippy/tests/ui-toml/unwrap_used/unwrap_used.rs b/src/tools/clippy/tests/ui-toml/unwrap_used/unwrap_used.rs
index 0e82fb20e..bc8e8c1f0 100644
--- a/src/tools/clippy/tests/ui-toml/unwrap_used/unwrap_used.rs
+++ b/src/tools/clippy/tests/ui-toml/unwrap_used/unwrap_used.rs
@@ -66,8 +66,21 @@ fn main() {
}
}
-#[test]
-fn test() {
- let boxed_slice: Box<[u8]> = Box::new([0, 1, 2, 3]);
- let _ = boxed_slice.get(1).unwrap();
+#[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("");
+
+ util();
+ }
+
+ fn util() {
+ let _a: u8 = 4.try_into().unwrap();
+ let _a: u8 = 5.try_into().expect("");
+ // should still warn
+ let _ = Box::new([0]).get(1).unwrap();
+ }
}