A CLI tool that scans a batch of files with clang-tidy and/or clang-format, then provides feedback in the form of comments, annotations, summaries, and reviews.
Currently, there are a lot of places where I use Result.expect() to panic on unexpected behavior. Most notably in RestApiClient.send_api_request(). It is more idiomatic rust to handle errors in the caller instead of arbitrarily throwing panics.
This solution may be considered a refactor since there are so many instances where the code calls Result.expect(), or Result.unwrap() (same as .expect() but without customized error message).
[!note]
There are some instances where it makes sense to use .unwrap(), but it should be determined by the code block's local context.
TBH, this problem was born from the fact that this is my first rust project. I should have picked a more robust design from the start.
Currently, there are a lot of places where I use
Result.expect()
to panic on unexpected behavior. Most notably inRestApiClient.send_api_request()
. It is more idiomatic rust to handle errors in the caller instead of arbitrarily throwing panics.This solution may be considered a refactor since there are so many instances where the code calls
Result.expect()
, orResult.unwrap()
(same as.expect()
but without customized error message).TBH, this problem was born from the fact that this is my first rust project. I should have picked a more robust design from the start.