fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #103046 - JanBeh:PR_clarify_cmp_terminology, r=workingjubilee3bcad65fbf6

master
4.4 KiB145 linesraw
1error: this block may be rewritten with the `?` operator
2  --> $DIR/question_mark.rs:7:5
3   |
4LL | /     if a.is_none() {
5LL | |         return None;
6LL | |     }
7   | |_____^ help: replace it with: `a?;`
8   |
9   = note: `-D clippy::question-mark` implied by `-D warnings`
10   = help: to override `-D warnings` add `#[allow(clippy::question_mark)]`
11
12error: this block may be rewritten with the `?` operator
13  --> $DIR/question_mark.rs:52:9
14   |
15LL | /         if (self.opt).is_none() {
16LL | |             return None;
17LL | |         }
18   | |_________^ help: replace it with: `(self.opt)?;`
19
20error: this block may be rewritten with the `?` operator
21  --> $DIR/question_mark.rs:56:9
22   |
23LL | /         if self.opt.is_none() {
24LL | |             return None
25LL | |         }
26   | |_________^ help: replace it with: `self.opt?;`
27
28error: this block may be rewritten with the `?` operator
29  --> $DIR/question_mark.rs:60:17
30   |
31LL |           let _ = if self.opt.is_none() {
32   |  _________________^
33LL | |             return None;
34LL | |         } else {
35LL | |             self.opt
36LL | |         };
37   | |_________^ help: replace it with: `Some(self.opt?)`
38
39error: this block may be rewritten with the `?` operator
40  --> $DIR/question_mark.rs:66:17
41   |
42LL |           let _ = if let Some(x) = self.opt {
43   |  _________________^
44LL | |             x
45LL | |         } else {
46LL | |             return None;
47LL | |         };
48   | |_________^ help: replace it with: `self.opt?`
49
50error: this block may be rewritten with the `?` operator
51  --> $DIR/question_mark.rs:83:9
52   |
53LL | /         if self.opt.is_none() {
54LL | |             return None;
55LL | |         }
56   | |_________^ help: replace it with: `self.opt.as_ref()?;`
57
58error: this block may be rewritten with the `?` operator
59  --> $DIR/question_mark.rs:91:9
60   |
61LL | /         if self.opt.is_none() {
62LL | |             return None;
63LL | |         }
64   | |_________^ help: replace it with: `self.opt.as_ref()?;`
65
66error: this block may be rewritten with the `?` operator
67  --> $DIR/question_mark.rs:99:9
68   |
69LL | /         if self.opt.is_none() {
70LL | |             return None;
71LL | |         }
72   | |_________^ help: replace it with: `self.opt.as_ref()?;`
73
74error: this block may be rewritten with the `?` operator
75  --> $DIR/question_mark.rs:106:26
76   |
77LL |           let v: &Vec<_> = if let Some(ref v) = self.opt {
78   |  __________________________^
79LL | |             v
80LL | |         } else {
81LL | |             return None;
82LL | |         };
83   | |_________^ help: replace it with: `self.opt.as_ref()?`
84
85error: this block may be rewritten with the `?` operator
86  --> $DIR/question_mark.rs:116:17
87   |
88LL |           let v = if let Some(v) = self.opt {
89   |  _________________^
90LL | |             v
91LL | |         } else {
92LL | |             return None;
93LL | |         };
94   | |_________^ help: replace it with: `self.opt?`
95
96error: this block may be rewritten with the `?` operator
97  --> $DIR/question_mark.rs:131:5
98   |
99LL | /     if f().is_none() {
100LL | |         return None;
101LL | |     }
102   | |_____^ help: replace it with: `f()?;`
103
104error: this block may be rewritten with the `?` operator
105  --> $DIR/question_mark.rs:143:13
106   |
107LL |     let _ = if let Ok(x) = x { x } else { return x };
108   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `x?`
109
110error: this block may be rewritten with the `?` operator
111  --> $DIR/question_mark.rs:145:5
112   |
113LL | /     if x.is_err() {
114LL | |         return x;
115LL | |     }
116   | |_____^ help: replace it with: `x?;`
117
118error: this block may be rewritten with the `?` operator
119  --> $DIR/question_mark.rs:213:5
120   |
121LL | /     if let Err(err) = func_returning_result() {
122LL | |         return Err(err);
123LL | |     }
124   | |_____^ help: replace it with: `func_returning_result()?;`
125
126error: this block may be rewritten with the `?` operator
127  --> $DIR/question_mark.rs:220:5
128   |
129LL | /     if let Err(err) = func_returning_result() {
130LL | |         return Err(err);
131LL | |     }
132   | |_____^ help: replace it with: `func_returning_result()?;`
133
134error: this block may be rewritten with the `?` operator
135  --> $DIR/question_mark.rs:297:13
136   |
137LL | /             if a.is_none() {
138LL | |                 return None;
139LL | |                 // do lint here, the outer `try` is not relevant here
140LL | |                 // https://github.com/rust-lang/rust-clippy/pull/11001#issuecomment-1610636867
141LL | |             }
142   | |_____________^ help: replace it with: `a?;`
143
144error: aborting due to 16 previous errors
145