Skip to content

Commit dfa197a

Browse files
romtsnclaude
andcommitted
Address PR review feedback
- Reverse pending_frames and pop from end instead of remove(0) - Add comment explaining intentional Some(0)/None asymmetry - Use let-else with .first() instead of is_empty + indexing Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent b0cd030 commit dfa197a

File tree

2 files changed

+10
-13
lines changed

2 files changed

+10
-13
lines changed

src/cache/mod.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -899,7 +899,7 @@ impl<'r, 'data> RemappedFrameIter<'r, 'data> {
899899
fn next_inner(&mut self) -> Option<StackFrame<'data>> {
900900
// Drain any buffered frames from multi-frame expansion first.
901901
if !self.pending_frames.is_empty() {
902-
return Some(self.pending_frames.remove(0));
902+
return self.pending_frames.pop();
903903
}
904904

905905
if let Some(frame) = self.fallback.take() {
@@ -918,8 +918,8 @@ impl<'r, 'data> RemappedFrameIter<'r, 'data> {
918918
members.as_slice(),
919919
self.outer_source_file,
920920
);
921-
if !frames.is_empty() {
922-
let first = frames.remove(0);
921+
frames.reverse();
922+
if let Some(first) = frames.pop() {
923923
self.pending_frames = frames;
924924
return Some(first);
925925
}
@@ -1134,8 +1134,8 @@ fn resolve_no_line_frames<'a>(
11341134
/// - **0:0 entries** (`startline().is_some()`): if any entry has a range
11351135
/// (`original_endline != original_startline`), all emit `Some(0)`;
11361136
/// otherwise each emits its `original_startline`.
1137-
/// - **No-range entries** (`startline().is_none()`): a single entry uses
1138-
/// its `original_startline` (or `Some(0)` for bare methods); multiple entries
1137+
/// - **No-range entries** (`startline().is_none()`): a single entry emits
1138+
/// its `original_startline` if > 0, otherwise `Some(0)`; multiple entries
11391139
/// with the same name collapse to one frame with `Some(0)`; different names
11401140
/// each emit `Some(0)` in original order.
11411141
fn resolve_base_entries<'a>(

src/mapper.rs

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -309,10 +309,9 @@ fn resolve_no_line_frames<'s>(
309309
}
310310

311311
// No base entries — fall back to all entries with output line 0.
312-
if mapping_entries.is_empty() {
312+
let Some(first) = mapping_entries.first() else {
313313
return;
314-
}
315-
let first = &mapping_entries[0];
314+
};
316315
let unambiguous = mapping_entries.iter().all(|m| m.original == first.original);
317316
if unambiguous {
318317
collected
@@ -335,8 +334,8 @@ fn resolve_no_line_frames<'s>(
335334
/// - **0:0 entries** (`startline.is_some()`): if any entry has a range
336335
/// (`original_endline != original_startline`), all emit `Some(0)`;
337336
/// otherwise each emits its `original_startline`.
338-
/// - **No-range entries** (`startline.is_none()`): a single entry uses
339-
/// its `original_startline` (or `Some(0)` for bare methods); multiple entries
337+
/// - **No-range entries** (`startline.is_none()`): a single entry emits
338+
/// its `original_startline` if > 0, otherwise `Some(0)`; multiple entries
340339
/// with the same name collapse to one frame with `Some(0)`; different names
341340
/// each emit `Some(0)` in original order.
342341
fn resolve_base_entries<'s>(
@@ -392,10 +391,8 @@ fn resolve_base_entries<'s>(
392391
Some(0)
393392
} else if member.original_startline.unwrap_or(0) > 0 {
394393
member.original_startline
395-
} else if member.original_startline.is_none() {
396-
Some(0)
397394
} else {
398-
None
395+
Some(0)
399396
};
400397
collected
401398
.frames

0 commit comments

Comments
 (0)