@@ -88,7 +88,7 @@ declare_lint_pass!(OptionIfLetElse => [OPTION_IF_LET_ELSE]);
88
88
/// None/_ => {..}
89
89
/// }
90
90
/// ```
91
- struct OptionOccurence {
91
+ struct OptionOccurrence {
92
92
option : String ,
93
93
method_sugg : String ,
94
94
some_expr : String ,
@@ -109,13 +109,13 @@ fn format_option_in_sugg(cx: &LateContext<'_>, cond_expr: &Expr<'_>, as_ref: boo
109
109
)
110
110
}
111
111
112
- fn try_get_option_occurence < ' tcx > (
112
+ fn try_get_option_occurrence < ' tcx > (
113
113
cx : & LateContext < ' tcx > ,
114
114
pat : & Pat < ' tcx > ,
115
115
expr : & Expr < ' _ > ,
116
116
if_then : & ' tcx Expr < ' _ > ,
117
117
if_else : & ' tcx Expr < ' _ > ,
118
- ) -> Option < OptionOccurence > {
118
+ ) -> Option < OptionOccurrence > {
119
119
let cond_expr = match expr. kind {
120
120
ExprKind :: Unary ( UnOp :: Deref , inner_expr) | ExprKind :: AddrOf ( _, _, inner_expr) => inner_expr,
121
121
_ => expr,
@@ -160,7 +160,7 @@ fn try_get_option_occurence<'tcx>(
160
160
}
161
161
}
162
162
163
- return Some ( OptionOccurence {
163
+ return Some ( OptionOccurrence {
164
164
option: format_option_in_sugg( cx, cond_expr, as_ref, as_mut) ,
165
165
method_sugg: method_sugg. to_string( ) ,
166
166
some_expr: format!( "|{capture_mut}{capture_name}| {}" , Sugg :: hir_with_macro_callsite( cx, some_body, ".." ) ) ,
@@ -182,9 +182,9 @@ fn try_get_inner_pat<'tcx>(cx: &LateContext<'tcx>, pat: &Pat<'tcx>) -> Option<&'
182
182
}
183
183
184
184
/// If this expression is the option if let/else construct we're detecting, then
185
- /// this function returns an `OptionOccurence ` struct with details if
185
+ /// this function returns an `OptionOccurrence ` struct with details if
186
186
/// this construct is found, or None if this construct is not found.
187
- fn detect_option_if_let_else < ' tcx > ( cx : & LateContext < ' tcx > , expr : & Expr < ' tcx > ) -> Option < OptionOccurence > {
187
+ fn detect_option_if_let_else < ' tcx > ( cx : & LateContext < ' tcx > , expr : & Expr < ' tcx > ) -> Option < OptionOccurrence > {
188
188
if let Some ( higher:: IfLet {
189
189
let_pat,
190
190
let_expr,
@@ -193,16 +193,16 @@ fn detect_option_if_let_else<'tcx>(cx: &LateContext<'tcx>, expr: &Expr<'tcx>) ->
193
193
} ) = higher:: IfLet :: hir ( cx, expr)
194
194
{
195
195
if !is_else_clause ( cx. tcx , expr) {
196
- return try_get_option_occurence ( cx, let_pat, let_expr, if_then, if_else) ;
196
+ return try_get_option_occurrence ( cx, let_pat, let_expr, if_then, if_else) ;
197
197
}
198
198
}
199
199
None
200
200
}
201
201
202
- fn detect_option_match < ' tcx > ( cx : & LateContext < ' tcx > , expr : & Expr < ' tcx > ) -> Option < OptionOccurence > {
202
+ fn detect_option_match < ' tcx > ( cx : & LateContext < ' tcx > , expr : & Expr < ' tcx > ) -> Option < OptionOccurrence > {
203
203
if let ExprKind :: Match ( ex, arms, MatchSource :: Normal ) = expr. kind {
204
204
if let Some ( ( let_pat, if_then, if_else) ) = try_convert_match ( cx, arms) {
205
- return try_get_option_occurence ( cx, let_pat, ex, if_then, if_else) ;
205
+ return try_get_option_occurrence ( cx, let_pat, ex, if_then, if_else) ;
206
206
}
207
207
}
208
208
None
0 commit comments