Skip to content

Commit ed9c0e3

Browse files
committed
Auto merge of #9550 - alex-semenyuk:fix_typo, r=xFrednet
Fix typo changelog: none
2 parents 8845f82 + 8ba081c commit ed9c0e3

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

clippy_lints/src/option_if_let_else.rs

+9-9
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ declare_lint_pass!(OptionIfLetElse => [OPTION_IF_LET_ELSE]);
8888
/// None/_ => {..}
8989
/// }
9090
/// ```
91-
struct OptionOccurence {
91+
struct OptionOccurrence {
9292
option: String,
9393
method_sugg: String,
9494
some_expr: String,
@@ -109,13 +109,13 @@ fn format_option_in_sugg(cx: &LateContext<'_>, cond_expr: &Expr<'_>, as_ref: boo
109109
)
110110
}
111111

112-
fn try_get_option_occurence<'tcx>(
112+
fn try_get_option_occurrence<'tcx>(
113113
cx: &LateContext<'tcx>,
114114
pat: &Pat<'tcx>,
115115
expr: &Expr<'_>,
116116
if_then: &'tcx Expr<'_>,
117117
if_else: &'tcx Expr<'_>,
118-
) -> Option<OptionOccurence> {
118+
) -> Option<OptionOccurrence> {
119119
let cond_expr = match expr.kind {
120120
ExprKind::Unary(UnOp::Deref, inner_expr) | ExprKind::AddrOf(_, _, inner_expr) => inner_expr,
121121
_ => expr,
@@ -160,7 +160,7 @@ fn try_get_option_occurence<'tcx>(
160160
}
161161
}
162162

163-
return Some(OptionOccurence {
163+
return Some(OptionOccurrence {
164164
option: format_option_in_sugg(cx, cond_expr, as_ref, as_mut),
165165
method_sugg: method_sugg.to_string(),
166166
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<&'
182182
}
183183

184184
/// 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
186186
/// 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> {
188188
if let Some(higher::IfLet {
189189
let_pat,
190190
let_expr,
@@ -193,16 +193,16 @@ fn detect_option_if_let_else<'tcx>(cx: &LateContext<'tcx>, expr: &Expr<'tcx>) ->
193193
}) = higher::IfLet::hir(cx, expr)
194194
{
195195
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);
197197
}
198198
}
199199
None
200200
}
201201

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> {
203203
if let ExprKind::Match(ex, arms, MatchSource::Normal) = expr.kind {
204204
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);
206206
}
207207
}
208208
None

0 commit comments

Comments
 (0)