From ff96995ea8a051aa74e0446c5da8f079ff32cda9 Mon Sep 17 00:00:00 2001 From: Simon Gardling Date: Thu, 5 May 2022 21:18:49 -0400 Subject: [PATCH] cleanup --- Cargo.lock | 12 ++++++------ src/math_app.rs | 17 ++++++++++------- 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index bf99747..eade0a1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -663,7 +663,7 @@ checksum = "9ea835d29036a4087793836fa931b08837ad5e957da9e23886b29586fb9b6650" [[package]] name = "eframe" version = "0.18.0" -source = "git+https://github.com/Titaniumtown/egui.git#a672934d74c2b5c3c455421bbc2c6a2a40519c1e" +source = "git+https://github.com/Titaniumtown/egui.git#737aedad397d32299f514cb63228512c37674404" dependencies = [ "bytemuck", "egui", @@ -683,7 +683,7 @@ dependencies = [ [[package]] name = "egui" version = "0.18.1" -source = "git+https://github.com/Titaniumtown/egui.git#a672934d74c2b5c3c455421bbc2c6a2a40519c1e" +source = "git+https://github.com/Titaniumtown/egui.git#737aedad397d32299f514cb63228512c37674404" dependencies = [ "ahash", "epaint", @@ -694,7 +694,7 @@ dependencies = [ [[package]] name = "egui-winit" version = "0.18.0" -source = "git+https://github.com/Titaniumtown/egui.git#a672934d74c2b5c3c455421bbc2c6a2a40519c1e" +source = "git+https://github.com/Titaniumtown/egui.git#737aedad397d32299f514cb63228512c37674404" dependencies = [ "arboard", "egui", @@ -707,7 +707,7 @@ dependencies = [ [[package]] name = "egui_glow" version = "0.18.0" -source = "git+https://github.com/Titaniumtown/egui.git#a672934d74c2b5c3c455421bbc2c6a2a40519c1e" +source = "git+https://github.com/Titaniumtown/egui.git#737aedad397d32299f514cb63228512c37674404" dependencies = [ "bytemuck", "egui", @@ -727,7 +727,7 @@ checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" [[package]] name = "emath" version = "0.18.0" -source = "git+https://github.com/Titaniumtown/egui.git#a672934d74c2b5c3c455421bbc2c6a2a40519c1e" +source = "git+https://github.com/Titaniumtown/egui.git#737aedad397d32299f514cb63228512c37674404" dependencies = [ "bytemuck", ] @@ -735,7 +735,7 @@ dependencies = [ [[package]] name = "epaint" version = "0.18.1" -source = "git+https://github.com/Titaniumtown/egui.git#a672934d74c2b5c3c455421bbc2c6a2a40519c1e" +source = "git+https://github.com/Titaniumtown/egui.git#737aedad397d32299f514cb63228512c37674404" dependencies = [ "ab_glyph", "ahash", diff --git a/src/math_app.rs b/src/math_app.rs index a99fac5..3a104dd 100644 --- a/src/math_app.rs +++ b/src/math_app.rs @@ -147,8 +147,6 @@ impl MathApp { .read_to_end(&mut tar_file_data) .expect("failed to read assets"); - let mut tar_archive = tar::Archive::new(&*tar_file_data); - // Stores fonts let mut font_ubuntu_light: Option = None; let mut font_notoemoji: Option = None; @@ -159,12 +157,17 @@ impl MathApp { let mut text_data: Option = None; tracing::info!("Reading assets..."); + // Iterate through all entries in the tarball - for file in tar_archive.entries().unwrap() { - let mut file = file.unwrap(); + for file in unsafe { + tar::Archive::new(&*tar_file_data) + .entries() + .unwrap_unchecked() + } { + let mut file = unsafe { file.unwrap_unchecked() }; let mut data: Vec = Vec::new(); - file.read_to_end(&mut data).unwrap(); - let path = file.header().path().unwrap(); + unsafe { file.read_to_end(&mut data).unwrap_unchecked() }; + let path = unsafe { file.header().path().unwrap_unchecked() }; let path_string = path.to_string_lossy(); tracing::debug!("Loading file: {}", path_string); @@ -207,7 +210,7 @@ impl MathApp { font_data: BTreeMap::from([ ( "Hack".to_owned(), - font_hack.expect("Hack -Regular.ttf not found!"), + font_hack.expect("Hack-Regular.ttf not found!"), ), ( "Ubuntu-Light".to_owned(),