Skip to content

Commit c266387

Browse files
authored
Replace unwrap with expect
1 parent 34d3490 commit c266387

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

crates/ide-assists/src/handlers/apply_demorgan.rs

+6-1
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,12 @@ pub(crate) fn apply_demorgan_iterator(acc: &mut Assists, ctx: &AssistContext<'_>
219219
.and_then(ast::PrefixExpr::cast)
220220
.filter(|prefix_expr| matches!(prefix_expr.op_kind(), Some(ast::UnaryOp::Not)))
221221
{
222-
edit.delete(prefix_expr.op_token().unwrap().text_range());
222+
edit.delete(
223+
prefix_expr
224+
.op_token()
225+
.expect("prefix expression always has an operator")
226+
.text_range(),
227+
);
223228
} else {
224229
edit.insert(method_call.syntax().text_range().start(), "!");
225230
}

0 commit comments

Comments
 (0)