mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 11:31:15 +00:00
Replace unwrap with expect
This commit is contained in:
parent
34d3490198
commit
c266387e13
@ -219,7 +219,12 @@ pub(crate) fn apply_demorgan_iterator(acc: &mut Assists, ctx: &AssistContext<'_>
|
|||||||
.and_then(ast::PrefixExpr::cast)
|
.and_then(ast::PrefixExpr::cast)
|
||||||
.filter(|prefix_expr| matches!(prefix_expr.op_kind(), Some(ast::UnaryOp::Not)))
|
.filter(|prefix_expr| matches!(prefix_expr.op_kind(), Some(ast::UnaryOp::Not)))
|
||||||
{
|
{
|
||||||
edit.delete(prefix_expr.op_token().unwrap().text_range());
|
edit.delete(
|
||||||
|
prefix_expr
|
||||||
|
.op_token()
|
||||||
|
.expect("prefix expression always has an operator")
|
||||||
|
.text_range(),
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
edit.insert(method_call.syntax().text_range().start(), "!");
|
edit.insert(method_call.syntax().text_range().start(), "!");
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user