Unnamed repository; edit this file 'description' to name the repository.
-rw-r--r--crates/hir/src/lib.rs6
-rw-r--r--crates/ide-db/src/source_change.rs10
2 files changed, 6 insertions, 10 deletions
diff --git a/crates/hir/src/lib.rs b/crates/hir/src/lib.rs
index f676a700cc..8b01c5ae2d 100644
--- a/crates/hir/src/lib.rs
+++ b/crates/hir/src/lib.rs
@@ -7381,9 +7381,9 @@ pub fn resolve_absolute_path<'a, I: Iterator<Item = Symbol> + Clone + 'a>(
let mut def_map = crate_def_map(db, krate);
let mut module = &def_map[def_map.root_module_id()];
let mut segments = segments.with_position().peekable();
- while let Some((_, segment)) = segments.next_if(|&(position, _)| {
- !matches!(position, itertools::Position::Last | itertools::Position::Only)
- }) {
+ while let Some((_, segment)) =
+ segments.next_if(|&(position, _)| !position.is_last)
+ {
let res = module
.scope
.get(&Name::new_symbol_root(segment))
diff --git a/crates/ide-db/src/source_change.rs b/crates/ide-db/src/source_change.rs
index 72683c9512..07bf294405 100644
--- a/crates/ide-db/src/source_change.rs
+++ b/crates/ide-db/src/source_change.rs
@@ -164,13 +164,9 @@ impl SnippetEdit {
.into_iter()
.zip(1..)
.with_position()
- .flat_map(|pos| {
- let (snippet, index) = match pos {
- (itertools::Position::First, it) | (itertools::Position::Middle, it) => it,
- // last/only snippet gets index 0
- (itertools::Position::Last, (snippet, _))
- | (itertools::Position::Only, (snippet, _)) => (snippet, 0),
- };
+ .flat_map(|(position, (snippet, index))| {
+ // The last/only snippet gets index 0.
+ let index = if position.is_last { 0 } else { index };
match snippet {
Snippet::Tabstop(pos) => vec![(index, TextRange::empty(pos))],