mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-28 09:44:08 +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)
|
||||
.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 {
|
||||
edit.insert(method_call.syntax().text_range().start(), "!");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user