Skip to content

Commit

Permalink
chore: set panic abort to reduce package size
Browse files Browse the repository at this point in the history
  • Loading branch information
Zvicii committed Jan 3, 2024
1 parent 4feb18c commit 7f0b2cc
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 12 deletions.
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ version = "0.1.0"
edition = "2021"

[profile.release]
panic = 'abort'
codegen-units = 1
lto = true
opt-level = 'z'
Expand Down
12 changes: 0 additions & 12 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,6 @@ pub fn init(params: String) {
if !runtime.is_none() {
return;
}
std::panic::set_hook(Box::new(|info| {
let backtrace = std::backtrace::Backtrace::force_capture();
let payload = info.payload();
if let Some(string) = payload.downcast_ref::<String>() {
error!("panic captured: {string}");
} else if let Some(str) = payload.downcast_ref::<&'static str>() {
error!("panic captured: {str}")
} else {
error!("panic captured: {payload:?}")
}
error!("panic backtrace:\n{:?}", backtrace);
}));
let parsed_params = match serde_json::from_str::<InitParams>(&params) {
Ok(result) => result,
Err(err) => {
Expand Down

0 comments on commit 7f0b2cc

Please sign in to comment.