]> git.lizzy.rs Git - rust.git/commitdiff
re-introduce `always!`
authorAnatol Ulrich <anatol.ulrich@ferrous-systems.com>
Wed, 27 Oct 2021 15:25:37 +0000 (17:25 +0200)
committerAnatol Ulrich <anatol.ulrich@ferrous-systems.com>
Wed, 27 Oct 2021 15:25:42 +0000 (17:25 +0200)
crates/ide/src/rename.rs

index 8292a6e26d814de61fab5f2a1571867db4d99d94..270e06bc5fb02ddccc4bf0c126bb3f6cd899e3b4 100644 (file)
@@ -12,7 +12,7 @@
     RootDatabase,
 };
 use itertools::Itertools;
-use stdx::never;
+use stdx::{always, never};
 use syntax::{ast, AstNode, SyntaxNode};
 
 use text_edit::TextEdit;
@@ -41,13 +41,12 @@ pub(crate) fn prepare_rename(
                 bail!("No references found at position")
             }
             let frange = sema.original_range(name_like.syntax());
-            if frange.range.contains_inclusive(position.offset)
-                && frange.file_id == position.file_id
-            {
-                Ok(frange.range)
-            } else {
-                bail!("invalid text range")
-            }
+
+            always!(
+                frange.range.contains_inclusive(position.offset)
+                    && frange.file_id == position.file_id
+            );
+            Ok(frange.range)
         })
         .reduce(|acc, cur| match (acc, cur) {
             // ensure all ranges are the same