Skip to content

Commit

Permalink
Use revisions for compiler flag for test
Browse files Browse the repository at this point in the history
  • Loading branch information
chansuke committed Aug 4, 2020
1 parent bfd9fa7 commit 57b3f70
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 18 deletions.
16 changes: 0 additions & 16 deletions tests/ui/unwrap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<u8, ()> = Ok(0);
let _ = res.unwrap();
}

fn main() {
unwrap_option();
unwrap_result();
with_test();
with_cfg_test();
}
4 changes: 2 additions & 2 deletions tests/ui/unwrap.stderr
Original file line number Diff line number Diff line change
@@ -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();
| ^^^^^^^^^^^^
Expand All @@ -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();
| ^^^^^^^^^^^^
Expand Down

0 comments on commit 57b3f70

Please sign in to comment.