From 1a474d9179d301ae5c8ec8c13ba674e0702d8856 Mon Sep 17 00:00:00 2001 From: Liu Dingming Date: Wed, 22 Feb 2023 21:36:30 +0800 Subject: [PATCH] Recover tests --- tests/ui-toml/expect_used/expect_used.rs | 12 ++++++++++++ tests/ui-toml/unwrap_used/unwrap_used.rs | 6 ++++++ 2 files changed, 18 insertions(+) diff --git a/tests/ui-toml/expect_used/expect_used.rs b/tests/ui-toml/expect_used/expect_used.rs index bff97d97df7..89f142a150d 100644 --- a/tests/ui-toml/expect_used/expect_used.rs +++ b/tests/ui-toml/expect_used/expect_used.rs @@ -16,6 +16,18 @@ fn main() { expect_result(); } +#[test] +fn test_expect_option() { + let opt = Some(0); + let _ = opt.expect(""); +} + +#[test] +fn test_expect_result() { + let res: Result = Ok(0); + let _ = res.expect(""); +} + #[cfg(test)] mod issue9612 { // should not lint in `#[cfg(test)]` modules diff --git a/tests/ui-toml/unwrap_used/unwrap_used.rs b/tests/ui-toml/unwrap_used/unwrap_used.rs index bc8e8c1f070..6525ea5bfc3 100644 --- a/tests/ui-toml/unwrap_used/unwrap_used.rs +++ b/tests/ui-toml/unwrap_used/unwrap_used.rs @@ -66,6 +66,12 @@ 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