Skip to content

Commit

Permalink
Use try_into
Browse files Browse the repository at this point in the history
  • Loading branch information
loewenheim committed Dec 18, 2024
1 parent dbe96bc commit 0159cb5
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions symbolic-symcache/src/writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,9 @@ impl<'a> SymCacheConverter<'a> {
let mut inlinee_ranges = Vec::new();
for inlinee in &function.inlinees {
for line in &inlinee.lines {
let start = line.address as u32;
let end = start.saturating_add(line.size.unwrap_or(1) as u32);
let start = line.address.try_into().unwrap_or(u32::MAX);
let end =
start.saturating_add(line.size.unwrap_or(1).try_into().unwrap_or(u32::MAX));
inlinee_ranges.push(start..end);
}
}
Expand All @@ -213,8 +214,9 @@ impl<'a> SymCacheConverter<'a> {

// Iterate over the line records.
while let Some(line) = next_line.take() {
let line_range_start = line.address as u32;
let line_range_end = line_range_start.saturating_add(line.size.unwrap_or(1) as u32);
let line_range_start = line.address.try_into().unwrap_or(u32::MAX);
let line_range_end = line_range_start
.saturating_add(line.size.unwrap_or(1).try_into().unwrap_or(u32::MAX));

// Find the call location for this line.
while next_call_location.is_some() && next_call_location.unwrap().0 <= line_range_start
Expand Down

0 comments on commit 0159cb5

Please sign in to comment.