@@ -31,6 +31,8 @@ use std::iter::FromIterator;
31
31
use std:: rc:: { self , Rc } ;
32
32
use std:: sync:: { self , Arc } ;
33
33
34
+ include ! ( "../auxiliary/option_helpers.rs" ) ;
35
+
34
36
pub struct T ;
35
37
36
38
impl T {
@@ -101,13 +103,6 @@ impl Mul<T> for T {
101
103
fn mul ( self , other : T ) -> T { self } // no error, obviously
102
104
}
103
105
104
- /// Utility macro to test linting behavior in `option_methods()`
105
- /// The lints included in `option_methods()` should not lint if the call to map is partially
106
- /// within a macro
107
- macro_rules! opt_map {
108
- ( $opt: expr, $map: expr) => { ( $opt) . map( $map) } ;
109
- }
110
-
111
106
/// Checks implementation of the following lints:
112
107
/// * `OPTION_MAP_UNWRAP_OR`
113
108
/// * `OPTION_MAP_UNWRAP_OR_ELSE`
@@ -169,29 +164,6 @@ fn option_methods() {
169
164
) ;
170
165
}
171
166
172
- /// Checks implementation of the following lints:
173
- /// * `RESULT_MAP_UNWRAP_OR_ELSE`
174
- fn result_methods ( ) {
175
- let res: Result < i32 , ( ) > = Ok ( 1 ) ;
176
-
177
- // Check RESULT_MAP_UNWRAP_OR_ELSE
178
- // single line case
179
- let _ = res. map ( |x| x + 1 )
180
-
181
- . unwrap_or_else ( |e| 0 ) ; // should lint even though this call is on a separate line
182
- // multi line cases
183
- let _ = res. map ( |x| {
184
- x + 1
185
- }
186
- ) . unwrap_or_else ( |e| 0 ) ;
187
- let _ = res. map ( |x| x + 1 )
188
- . unwrap_or_else ( |e|
189
- 0
190
- ) ;
191
- // macro case
192
- let _ = opt_map ! ( res, |x| x + 1 ) . unwrap_or_else ( |e| 0 ) ; // should not lint
193
- }
194
-
195
167
/// Struct to generate false positives for things with .iter()
196
168
#[ derive( Copy , Clone ) ]
197
169
struct HasIter ;
0 commit comments