Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
git: Replace some unwraps with `expect` (#49683)
Cole Miller8caebe684018
diff --git a/crates/editor/src/display_map.rs b/crates/editor/src/display_map.rsindex a55650b51d9..19f1df70efd 100644--- a/crates/editor/src/display_map.rs+++ b/crates/editor/src/display_map.rs@@ -551,7 +551,7 @@ impl DisplayMap {.read(cx).rhs_buffer_to_lhs_buffer.get(my_buffer)- .unwrap();+ .expect("unmapped folded buffer");companion_display_map.block_map.folded_buffersdiff --git a/crates/editor/src/split.rs b/crates/editor/src/split.rsindex cfa40235e85..633cd8b26f7 100644--- a/crates/editor/src/split.rs+++ b/crates/editor/src/split.rs@@ -199,7 +199,7 @@ wherelet diff = source_snapshot.diff_for_buffer_id(first.source_buffer.remote_id())- .unwrap();+ .expect("buffer with no diff when creating patches");let rhs_buffer = if first.source_buffer.remote_id() == diff.base_text().remote_id() {first.target_buffer} else {@@ -281,17 +281,17 @@ fn patch_for_excerpt() -> CompanionExcerptPatch {let source_multibuffer_range = source_snapshot.range_for_excerpt(source_excerpt_id)- .unwrap();+ .expect("no excerpt for source id when creating patch");let source_excerpt_start_in_multibuffer = source_multibuffer_range.start;let source_excerpt_start_in_buffer = source_context_range.start;let source_excerpt_end_in_buffer = source_context_range.end;let target_multibuffer_range = target_snapshot.range_for_excerpt(target_excerpt_id)- .unwrap();+ .expect("no excerpt for target id when creating patch");let target_excerpt_start_in_multibuffer = target_multibuffer_range.start;let target_context_range = target_snapshot.context_range_for_excerpt(target_excerpt_id)- .unwrap();+ .expect("no range for target id when creating patch");let target_excerpt_start_in_buffer = target_context_range.start.to_point(&target_buffer);let target_excerpt_end_in_buffer = target_context_range.end.to_point(&target_buffer);