Skip to content

Commit b963319

Browse files
author
Kevin Gosse
committed
More clippy
1 parent 61d95da commit b963319

File tree

1 file changed

+8
-13
lines changed
  • crashtracker-ffi/src/collector_windows

1 file changed

+8
-13
lines changed

crashtracker-ffi/src/collector_windows/api.rs

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -265,18 +265,13 @@ pub unsafe extern "C" fn ddog_crasht_exception_event_callback(
265265
for thread in threads.unwrap() {
266266
let stack_result = walk_thread_stack(exception_information.hProcess, thread, &modules);
267267

268-
let stack: StackTrace = if stack_result.is_err() {
269-
output_debug_string(
270-
format!(
271-
"Failed to walk thread stack: {}",
272-
stack_result.err().unwrap()
273-
)
274-
.as_str(),
275-
);
276-
StackTrace::new_incomplete()
277-
} else {
278-
stack_result.unwrap()
279-
};
268+
let stack: StackTrace = stack_result.map_or_else(
269+
|e| {
270+
output_debug_string(format!("Failed to walk thread stack: {}", e).as_str());
271+
StackTrace::new_incomplete()
272+
},
273+
|stack| stack,
274+
);
280275

281276
if thread == crash_tid {
282277
builder
@@ -471,7 +466,7 @@ unsafe fn walk_thread_stack(
471466
"{:x}",
472467
native_frame.AddrPC.Offset - module.base_address
473468
));
474-
frame.path = module.path.clone();
469+
frame.path.clone_from(&module.path);
475470

476471
if let Some(pdb_info) = &module.pdb_info {
477472
frame.build_id = Some(format!("{:x}{:x}", pdb_info.signature, pdb_info.age));

0 commit comments

Comments
 (0)