From b421159f81216268fc8772b81f03932394c6fb4d Mon Sep 17 00:00:00 2001 From: Simon Gardling Date: Wed, 8 Mar 2023 13:11:01 -0500 Subject: [PATCH] fixup and line width changes --- src/function_entry.rs | 2 +- src/math_app.rs | 19 ++++++++----------- src/unicode_helper.rs | 11 ++++------- 3 files changed, 13 insertions(+), 19 deletions(-) diff --git a/src/function_entry.rs b/src/function_entry.rs index e3ff1c1..0f80899 100644 --- a/src/function_entry.rs +++ b/src/function_entry.rs @@ -389,7 +389,7 @@ impl FunctionEntry { self.back_data .clone() .to_line() - .stroke(egui::Stroke::new(2.0, main_plot_color)), + .stroke(egui::Stroke::new(4.0, main_plot_color)), ); } diff --git a/src/math_app.rs b/src/math_app.rs index 59ed52c..457549a 100644 --- a/src/math_app.rs +++ b/src/math_app.rs @@ -193,16 +193,13 @@ impl MathApp { fn decompress_data() -> crate::data::TotalData { let mut data = Vec::new(); - let _ = unsafe { - ruzstd::StreamingDecoder::new( - &mut const { - include_bytes!(concat!(env!("OUT_DIR"), "/compressed_data")).as_slice() - }, - ) - .unwrap_unchecked() - .read_to_end(&mut data) - .unwrap_unchecked() - }; + let _ = ruzstd::StreamingDecoder::new( + &mut const { include_bytes!(concat!(env!("OUT_DIR"), "/compressed_data")).as_slice() }, + ) + .expect("unable to decode compressed data") + .read_to_end(&mut data) + .expect("unable to read compressed data"); + #[cfg(target = "wasm32")] { debug_assert!(!data.is_empty()); @@ -224,7 +221,7 @@ impl MathApp { .expect("failed to set local storage cache"); } - unsafe { bincode::deserialize(data.as_slice()).unwrap_unchecked() } + bincode::deserialize(data.as_slice()).expect("unable to deserialize bincode") } #[cfg(target = "wasm32")] diff --git a/src/unicode_helper.rs b/src/unicode_helper.rs index edda889..1a7bb06 100644 --- a/src/unicode_helper.rs +++ b/src/unicode_helper.rs @@ -11,13 +11,10 @@ pub fn to_unicode_hash(c: char) -> String { #[allow(dead_code)] pub fn to_chars_array(chars: Vec) -> String { - [ - "[", - &chars + "[".to_string() + + &chars .iter() .map(|c| format!("'{}'", c.escape_unicode())) - .join(", "), - "]", - ] - .concat() + .join(", ") + + "]" }