From 57b3f70b874527a440a4bd04f94bb58fb9249363 Mon Sep 17 00:00:00 2001 From: chansuke Date: Tue, 4 Aug 2020 22:11:34 +0900 Subject: [PATCH] Use revisions for compiler flag for test --- tests/ui/unwrap.rs | 16 ---------------- tests/ui/unwrap.stderr | 4 ++-- 2 files changed, 2 insertions(+), 18 deletions(-) diff --git a/tests/ui/unwrap.rs b/tests/ui/unwrap.rs index beccccd08aea..a4a3cd1d3797 100644 --- a/tests/ui/unwrap.rs +++ b/tests/ui/unwrap.rs @@ -10,23 +10,7 @@ fn unwrap_result() { let _ = res.unwrap(); } -// Should not get linted. -#[test] -fn with_test() { - let opt = Some(0); - let _ = opt.unwrap(); -} - -// Should not get linted. -#[cfg(test)] -fn with_cfg_test() { - let res: Result = Ok(0); - let _ = res.unwrap(); -} - fn main() { unwrap_option(); unwrap_result(); - with_test(); - with_cfg_test(); } diff --git a/tests/ui/unwrap.stderr b/tests/ui/unwrap.stderr index 23c3beff50ac..4f0858005f6e 100644 --- a/tests/ui/unwrap.stderr +++ b/tests/ui/unwrap.stderr @@ -1,5 +1,5 @@ error: used `unwrap()` on `an Option` value - --> $DIR/unwrap.rs:7:13 + --> $DIR/unwrap.rs:5:13 | LL | let _ = opt.unwrap(); | ^^^^^^^^^^^^ @@ -8,7 +8,7 @@ LL | let _ = opt.unwrap(); = help: if you don't want to handle the `None` case gracefully, consider using `expect()` to provide a better panic message error: used `unwrap()` on `a Result` value - --> $DIR/unwrap.rs:12:13 + --> $DIR/unwrap.rs:10:13 | LL | let _ = res.unwrap(); | ^^^^^^^^^^^^