Add failing test

This commit is contained in:
Peter Fürstenau 2018-12-19 20:46:12 +01:00
parent e722b1338e
commit 18584698ee
2 changed files with 35 additions and 26 deletions

View file

@ -15,6 +15,15 @@ fn some_func(a: Option<u32>) -> Option<u32> {
a a
} }
fn some_other_func(a: Option<u32>) -> Option<u32> {
if a.is_none() {
return None;
} else {
return Some(0);
}
unreachable!()
}
pub enum SeemsOption<T> { pub enum SeemsOption<T> {
Some(T), Some(T),
None, None,

View file

@ -9,54 +9,54 @@ error: this block may be rewritten with the `?` operator
= note: `-D clippy::question-mark` implied by `-D warnings` = note: `-D clippy::question-mark` implied by `-D warnings`
error: this block may be rewritten with the `?` operator error: this block may be rewritten with the `?` operator
--> $DIR/question_mark.rs:47:9 --> $DIR/question_mark.rs:56:9
| |
47 | / if (self.opt).is_none() { 56 | / if (self.opt).is_none() {
48 | | return None; 57 | | return None;
49 | | } 58 | | }
| |_________^ help: replace_it_with: `(self.opt)?;` | |_________^ help: replace_it_with: `(self.opt)?;`
error: this block may be rewritten with the `?` operator error: this block may be rewritten with the `?` operator
--> $DIR/question_mark.rs:51:9 --> $DIR/question_mark.rs:60:9
| |
51 | / if self.opt.is_none() { 60 | / if self.opt.is_none() {
52 | | return None 61 | | return None
53 | | } 62 | | }
| |_________^ help: replace_it_with: `self.opt?;` | |_________^ help: replace_it_with: `self.opt?;`
error: this block may be rewritten with the `?` operator error: this block may be rewritten with the `?` operator
--> $DIR/question_mark.rs:55:17 --> $DIR/question_mark.rs:64:17
| |
55 | let _ = if self.opt.is_none() { 64 | let _ = if self.opt.is_none() {
| _________________^ | _________________^
56 | | return None; 65 | | return None;
57 | | } else { 66 | | } else {
58 | | self.opt 67 | | self.opt
59 | | }; 68 | | };
| |_________^ help: replace_it_with: `Some(self.opt?)` | |_________^ help: replace_it_with: `Some(self.opt?)`
error: this block may be rewritten with the `?` operator error: this block may be rewritten with the `?` operator
--> $DIR/question_mark.rs:72:9 --> $DIR/question_mark.rs:81:9
| |
72 | / if self.opt.is_none() { 81 | / if self.opt.is_none() {
73 | | return None; 82 | | return None;
74 | | } 83 | | }
| |_________^ help: replace_it_with: `self.opt.as_ref()?;` | |_________^ help: replace_it_with: `self.opt.as_ref()?;`
error: this block may be rewritten with the `?` operator error: this block may be rewritten with the `?` operator
--> $DIR/question_mark.rs:80:9 --> $DIR/question_mark.rs:89:9
| |
80 | / if self.opt.is_none() { 89 | / if self.opt.is_none() {
81 | | return None; 90 | | return None;
82 | | } 91 | | }
| |_________^ help: replace_it_with: `self.opt.as_ref()?;` | |_________^ help: replace_it_with: `self.opt.as_ref()?;`
error: this block may be rewritten with the `?` operator error: this block may be rewritten with the `?` operator
--> $DIR/question_mark.rs:88:9 --> $DIR/question_mark.rs:97:9
| |
88 | / if self.opt.is_none() { 97 | / if self.opt.is_none() {
89 | | return None; 98 | | return None;
90 | | } 99 | | }
| |_________^ help: replace_it_with: `self.opt.as_ref()?;` | |_________^ help: replace_it_with: `self.opt.as_ref()?;`
error: aborting due to 7 previous errors error: aborting due to 7 previous errors