about summary refs log tree commit diff
diff options
context:
space:
mode:
authorLukas Wirth <lukastw97@gmail.com>2023-10-04 13:06:23 +0200
committerGitHub <noreply@github.com>2023-10-04 13:06:23 +0200
commitc266387e130de11c60be2c2d7d0a1d5c3bc3eb62 (patch)
tree26fa9ccfb37bf27ff03c79e13701d9e6f898f8fb
parent34d3490198fe6e7f56eb60c9665d25ef9cfd6f4e (diff)
downloadrust-c266387e130de11c60be2c2d7d0a1d5c3bc3eb62.tar.gz
rust-c266387e130de11c60be2c2d7d0a1d5c3bc3eb62.zip
Replace unwrap with expect
-rw-r--r--crates/ide-assists/src/handlers/apply_demorgan.rs7
1 files changed, 6 insertions, 1 deletions
diff --git a/crates/ide-assists/src/handlers/apply_demorgan.rs b/crates/ide-assists/src/handlers/apply_demorgan.rs
index 74db300465a..2d41243c20e 100644
--- a/crates/ide-assists/src/handlers/apply_demorgan.rs
+++ b/crates/ide-assists/src/handlers/apply_demorgan.rs
@@ -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(), "!");
             }