From d6cb0fba1aefa40235c7a4d0ed6f4397fb35dbe4 Mon Sep 17 00:00:00 2001 From: Simon Gardling Date: Thu, 4 Dec 2025 18:46:46 -0500 Subject: [PATCH] upgrade cargo dependencies --- Cargo.lock | 341 +++++++++++++++++----------------------- Cargo.toml | 29 ++-- build.rs | 8 +- src/function_manager.rs | 6 +- src/math_app.rs | 4 +- src/misc.rs | 11 -- tests/function.rs | 32 ++-- 7 files changed, 183 insertions(+), 248 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index b2bb9e8..831dca0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -50,7 +50,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5a15f179cd60c4584b8a8c596927aadc462e27f2ca70c04e0071964a73ba7a75" dependencies = [ "cfg-if", - "getrandom 0.3.4", + "getrandom", "once_cell", "serde", "version_check", @@ -168,9 +168,9 @@ dependencies = [ [[package]] name = "base64" -version = "0.21.7" +version = "0.22.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" +checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" [[package]] name = "benchmarks" @@ -217,15 +217,6 @@ version = "2.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "812e12b5285cc515a9c72a5c1d3b6d46a19dac5acfef5265968c166106e31dd3" -[[package]] -name = "block-buffer" -version = "0.10.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" -dependencies = [ - "generic-array", -] - [[package]] name = "block2" version = "0.5.1" @@ -261,12 +252,6 @@ dependencies = [ "syn", ] -[[package]] -name = "byteorder" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" - [[package]] name = "byteorder-lite" version = "0.1.0" @@ -375,19 +360,6 @@ dependencies = [ "libc", ] -[[package]] -name = "chrono" -version = "0.4.42" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "145052bdd345b87320e369255277e3fb5152762ad123a901ef5c262dd38fe8d2" -dependencies = [ - "iana-time-zone", - "js-sys", - "num-traits", - "wasm-bindgen", - "windows-link", -] - [[package]] name = "clap" version = "2.34.0" @@ -516,15 +488,6 @@ dependencies = [ "cfg-if", ] -[[package]] -name = "cpufeatures" -version = "0.2.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280" -dependencies = [ - "libc", -] - [[package]] name = "crc32fast" version = "1.5.0" @@ -545,7 +508,7 @@ dependencies = [ "clap", "criterion-plot", "csv", - "itertools", + "itertools 0.10.5", "lazy_static", "num-traits", "oorandom", @@ -567,7 +530,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2673cc8207403546f45f5fd319a974b1e6983ad1a3ee7e6041650013be041876" dependencies = [ "cast", - "itertools", + "itertools 0.10.5", ] [[package]] @@ -601,16 +564,6 @@ version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "460fbee9c2c2f33933d720630a6a0bac33ba7053db5344fac858d4b8952d77d5" -[[package]] -name = "crypto-common" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78c8292055d1c1df0cce5d180393dc8cce0abec0a7102adb6c7b1eef6016d60a" -dependencies = [ - "generic-array", - "typenum", -] - [[package]] name = "csv" version = "1.4.0" @@ -648,24 +601,12 @@ dependencies = [ ] [[package]] -name = "derive_more" -version = "0.99.20" +name = "deranged" +version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6edb4b64a43d977b8e99788fe3a04d483834fba1215a7e02caa415b626497f7f" +checksum = "ececcb659e7ba858fb4f10388c250a7252eb0a27373f1a72b8748afdd248e587" dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "digest" -version = "0.10.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" -dependencies = [ - "block-buffer", - "crypto-common", + "powerfmt", ] [[package]] @@ -1043,22 +984,12 @@ dependencies = [ [[package]] name = "fsio" -version = "0.3.1" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de6fce87c901c64837f745e7fffddeca1de8e054b544ba82c419905d40a0e1be" +checksum = "f4944f16eb6a05b4b2b79986b4786867bb275f52882adea798f17cc2588f25b2" dependencies = [ "dunce", - "rand", -] - -[[package]] -name = "generic-array" -version = "0.14.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" -dependencies = [ - "typenum", - "version_check", + "rand 0.9.2", ] [[package]] @@ -1071,19 +1002,6 @@ dependencies = [ "windows-link", ] -[[package]] -name = "getrandom" -version = "0.2.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "335ff9f135e4384c8150d6f27c6daed433577f86b4750418338c01a1a2528592" -dependencies = [ - "cfg-if", - "js-sys", - "libc", - "wasi", - "wasm-bindgen", -] - [[package]] name = "getrandom" version = "0.3.4" @@ -1104,11 +1022,11 @@ checksum = "e629b9b98ef3dd8afe6ca2bd0f89306cec16d43d907889945bc5d6687f2f13c7" [[package]] name = "git2" -version = "0.14.4" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0155506aab710a86160ddb504a480d2964d7ab5b9e62419be69e0032bc5931c" +checksum = "2deb07a133b1520dc1a5690e9bd08950108873d7ed5de38dcc74d3b5ebffa110" dependencies = [ - "bitflags 1.3.2", + "bitflags 2.10.0", "libc", "libgit2-sys", "log", @@ -1446,6 +1364,15 @@ dependencies = [ "either", ] +[[package]] +name = "itertools" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b192c782037fadd9cfa75548310488aabdbf3d2da73885b31bd0abd03351285" +dependencies = [ + "either", +] + [[package]] name = "itoa" version = "1.0.15" @@ -1480,7 +1407,7 @@ version = "0.1.34" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9afb3de4395d6b3e67a780b6de64b51c978ecf11cb9a462c66be7d4ca9039d33" dependencies = [ - "getrandom 0.3.4", + "getrandom", "libc", ] @@ -1496,13 +1423,12 @@ dependencies = [ [[package]] name = "json5" -version = "0.4.1" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96b0db21af676c1ce64250b5f40f3ce2cf27e4e47cb91ed91eb6fe9350b430c1" +checksum = "0dadca0807203e4dad79bc9229663ea382d7e809eeb2213496a1ae4aff0069d6" dependencies = [ - "pest", - "pest_derive", "serde", + "ucd-trie", ] [[package]] @@ -1540,9 +1466,9 @@ checksum = "37c93d8daa9d8a012fd8ab92f088405fb202ea0b6ab73ee2482ae66af4f42091" [[package]] name = "libgit2-sys" -version = "0.13.5+1.4.5" +version = "0.18.2+1.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51e5ea06c26926f1002dd553fded6cfcdc9784c1f60feeb58368b4d9b07b6dba" +checksum = "1c42fe03df2bd3c53a3a9c7317ad91d80c81cd1fb0caec8d7cc4cd2bfa10c222" dependencies = [ "cc", "libc", @@ -1804,6 +1730,12 @@ dependencies = [ "num-traits", ] +[[package]] +name = "num-conv" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" + [[package]] name = "num-format" version = "0.4.4" @@ -1877,6 +1809,15 @@ dependencies = [ "syn", ] +[[package]] +name = "num_threads" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c7398b9c8b70908f6371f47ed36737907c87c52af34c268fed0bf0ceb92ead9" +dependencies = [ + "libc", +] + [[package]] name = "objc-sys" version = "0.3.5" @@ -2225,49 +2166,6 @@ version = "2.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220" -[[package]] -name = "pest" -version = "2.8.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cbcfd20a6d4eeba40179f05735784ad32bdaef05ce8e8af05f180d45bb3e7e22" -dependencies = [ - "memchr", - "ucd-trie", -] - -[[package]] -name = "pest_derive" -version = "2.8.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51f72981ade67b1ca6adc26ec221be9f463f2b5839c7508998daa17c23d94d7f" -dependencies = [ - "pest", - "pest_generator", -] - -[[package]] -name = "pest_generator" -version = "2.8.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dee9efd8cdb50d719a80088b76f81aec7c41ed6d522ee750178f83883d271625" -dependencies = [ - "pest", - "pest_meta", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "pest_meta" -version = "2.8.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf1d70880e76bdc13ba52eafa6239ce793d85c8e43896507e43dd8984ff05b82" -dependencies = [ - "pest", - "sha2", -] - [[package]] name = "phf" version = "0.11.3" @@ -2294,7 +2192,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3c80231409c20246a13fddb31776fb942c38553c51e871f8cbd687a4cfb5843d" dependencies = [ "phf_shared", - "rand", + "rand 0.8.5", ] [[package]] @@ -2417,6 +2315,12 @@ dependencies = [ "zerovec", ] +[[package]] +name = "powerfmt" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" + [[package]] name = "pprof" version = "0.9.1" @@ -2525,19 +2429,27 @@ version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" dependencies = [ - "libc", + "rand_core 0.6.4", +] + +[[package]] +name = "rand" +version = "0.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6db2770f06117d490610c7488547d543617b21bfa07796d7a12f6f1bd53850d1" +dependencies = [ "rand_chacha", - "rand_core", + "rand_core 0.9.3", ] [[package]] name = "rand_chacha" -version = "0.3.1" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb" dependencies = [ "ppv-lite86", - "rand_core", + "rand_core 0.9.3", ] [[package]] @@ -2545,8 +2457,14 @@ name = "rand_core" version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" + +[[package]] +name = "rand_core" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "99d9a13982dcf210057a8a78572b2217b667c3beacbf3a0d8b454f6f82837d38" dependencies = [ - "getrandom 0.2.16", + "getrandom", ] [[package]] @@ -2639,9 +2557,9 @@ dependencies = [ [[package]] name = "run_script" -version = "0.9.0" +version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5dd85213e37f76b40186ee781cf3a689b05c518c3102c987acf679c573d8e4ef" +checksum = "e8f982753d06bafa2d1e5c1bd5be496bcb3cd02919a89f07e7f21c7a6ecb4e1a" dependencies = [ "fsio", ] @@ -2698,12 +2616,10 @@ checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d" [[package]] name = "ruzstd" -version = "0.5.0" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58c4eb8a81997cf040a091d1f7e1938aeab6749d3a0dfa73af43cdc32393483d" +checksum = "e5ff0cc5e135c8870a775d3320910cd9b564ec036b4dc0b8741629020be63f01" dependencies = [ - "byteorder", - "derive_more", "twox-hash", ] @@ -2787,27 +2703,17 @@ dependencies = [ "serde_core", ] -[[package]] -name = "sha2" -version = "0.10.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283" -dependencies = [ - "cfg-if", - "cpufeatures", - "digest", -] - [[package]] name = "shadow-rs" -version = "0.12.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed1b83da0a4e48d8dcc13ad177b64f2fc40097974f9bf176c2bcb702cabadff3" +checksum = "72d18183cef626bce22836103349c7050d73db799be0171386b80947d157ae32" dependencies = [ - "chrono", "const_format", "git2", "is_debug", + "time", + "tzdb", ] [[package]] @@ -3009,7 +2915,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2d31c77bdf42a745371d260a26ca7163f1e0924b64afa0b688e61b5a9fa02f16" dependencies = [ "fastrand", - "getrandom 0.3.4", + "getrandom", "once_cell", "rustix 1.1.2", "windows-sys 0.61.2", @@ -3087,6 +2993,39 @@ dependencies = [ "zune-jpeg", ] +[[package]] +name = "time" +version = "0.3.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91e7d9e3bb61134e77bde20dd4825b97c010155709965fedf0f49bb138e52a9d" +dependencies = [ + "deranged", + "itoa", + "libc", + "num-conv", + "num_threads", + "powerfmt", + "serde", + "time-core", + "time-macros", +] + +[[package]] +name = "time-core" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40868e7c1d2f0b8d73e4a8c7f0ff63af4f6d19be117e90bd73eb1d62cf831c6b" + +[[package]] +name = "time-macros" +version = "0.2.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "30cfb0125f12d9c277f35663a0a33f8c30190f4e4574868a330595412d34ebf3" +dependencies = [ + "num-conv", + "time-core", +] + [[package]] name = "tinystr" version = "0.8.2" @@ -3214,13 +3153,9 @@ checksum = "d2df906b07856748fa3f6e0ad0cbaa047052d4a7dd609e231c4f72cee8c36f31" [[package]] name = "twox-hash" -version = "1.6.3" +version = "2.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97fee6b57c6a41524a810daee9286c02d7752c4253064d0b05472833a438f675" -dependencies = [ - "cfg-if", - "static_assertions", -] +checksum = "9ea3136b675547379c4bd395ca6b938e5ad3c3d20fad76e7fe85f9e0d011419c" [[package]] name = "type-map" @@ -3232,10 +3167,30 @@ dependencies = [ ] [[package]] -name = "typenum" -version = "1.19.0" +name = "tz-rs" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "562d481066bde0658276a35467c4af00bdc6ee726305698a55b86e61d7ad82bb" +checksum = "14eff19b8dc1ace5bf7e4d920b2628ae3837f422ff42210cb1567cbf68b5accf" + +[[package]] +name = "tzdb" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0be2ea5956f295449f47c0b825c5e109022ff1a6a53bb4f77682a87c2341fbf5" +dependencies = [ + "iana-time-zone", + "tz-rs", + "tzdb_data", +] + +[[package]] +name = "tzdb_data" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c4c81d75033770e40fbd3643ce7472a1a9fd301f90b7139038228daf8af03ec" +dependencies = [ + "tz-rs", +] [[package]] name = "ucd-trie" @@ -3325,12 +3280,6 @@ dependencies = [ "winapi-util", ] -[[package]] -name = "wasi" -version = "0.11.1+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" - [[package]] name = "wasip2" version = "1.0.1+wasi-0.2.4" @@ -4159,9 +4108,8 @@ dependencies = [ "egui_plot", "emath", "epaint", - "getrandom 0.2.16", "instant", - "itertools", + "itertools 0.14.0", "json5", "lol_alloc", "parsing", @@ -4256,20 +4204,19 @@ dependencies = [ [[package]] name = "zstd" -version = "0.11.2+zstd.1.5.2" +version = "0.13.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20cc960326ece64f010d2d2107537f26dc589a6573a316bd5b1dba685fa5fde4" +checksum = "e91ee311a569c327171651566e07972200e76fcfe2242a4fa446149a3881c08a" dependencies = [ "zstd-safe", ] [[package]] name = "zstd-safe" -version = "5.0.2+zstd.1.5.2" +version = "7.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d2a5585e04f9eea4b2a3d1eca508c4dee9592a89ef6f450c11719da0726f4db" +checksum = "8f49c4d5f0abb602a93fb8736af2a4f4dd9512e36f7f570d66e65ff867ed3b9d" dependencies = [ - "libc", "zstd-sys", ] diff --git a/Cargo.toml b/Cargo.toml index 4a791a5..2c10792 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -50,22 +50,22 @@ emath = { git = "https://github.com/titaniumtown/egui.git", default-features = f egui_plot = { version = "0.34.0", default-features = false } -shadow-rs = { version = "0.12", default-features = false } +shadow-rs = { version = "1.4", default-features = false } const_format = { version = "0.2", default-features = false, features = ["fmt"] } cfg-if = "1" -ruzstd = "0.5" +ruzstd = "0.8" tracing = "0.1" -itertools = "0.10" +itertools = "0.14" static_assertions = "1.1" bincode = "1.3" serde = "1" -base64 = "0.21" +base64 = "0.22" [dev-dependencies] benchmarks = { path = "./benchmarks" } [build-dependencies] -shadow-rs = "0.12" +shadow-rs = "1.4" epaint = { git = "https://github.com/titaniumtown/egui.git", default-features = false, features = [ "bytemuck", ] } @@ -75,23 +75,21 @@ egui = { git = "https://github.com/titaniumtown/egui.git", default-features = fa bincode = "1.3" serde = "1" serde_json = "1" -zstd = { version = "0.11", default-features = false, features = ["pkg-config"] } -run_script = "0.9" -json5 = "0.4" -itertools = "0.10" +zstd = { version = "0.13", default-features = false, features = ["pkg-config"] } +run_script = "0.11" +json5 = "1.0" +itertools = "0.14" [target.'cfg(not(target_arch = "wasm32"))'.dependencies] instant = "0.1" tracing-subscriber = "0.3" -getrandom = { version = "0.2" } [target.'cfg(target_arch = "wasm32")'.dependencies] instant = { version = "0.1", features = ["wasm-bindgen"] } -lol_alloc = "0.4.0" +lol_alloc = "0.4.1" wasm-bindgen = { version = "0.2", default-features = false, features = ["std"] } web-sys = "0.3" tracing-wasm = "0.2" -getrandom = { version = "0.2", features = ["js"] } # pinned to 0.4.54 in order to be compatible with nixos's wasm-bindgen-cli version wasm-bindgen-futures = "=0.4.54" @@ -103,13 +101,6 @@ skip_optional_dependencies = true #don't test optional dependencies, only featur # ln: failed to create symbolic link '/nix/store/plh3y4gfxgwcacjccv72f551y1k89x75-cargo-vendor-dir/ecolor-0.33.2/qb43vsx43av6kf4h9y4bsmisvbjlcxd1-ecolor-0.33.2': Permission denied # ```` -[patch."https://github.com/emilk/egui_plot.git"] -egui = { git = "https://github.com/titaniumtown/egui.git" } -eframe = { git = "https://github.com/titaniumtown/egui.git" } -epaint = { git = "https://github.com/titaniumtown/egui.git" } -emath = { git = "https://github.com/titaniumtown/egui.git" } -ecolor = { git = "https://github.com/titaniumtown/egui.git" } - [patch.crates-io] egui = { git = "https://github.com/titaniumtown/egui.git" } eframe = { git = "https://github.com/titaniumtown/egui.git" } diff --git a/build.rs b/build.rs index 7c15ffc..727867c 100644 --- a/build.rs +++ b/build.rs @@ -8,11 +8,12 @@ use std::{ }; use epaint::{ - text::{FontData, FontDefinitions, FontTweak}, FontFamily, + text::{FontData, FontDefinitions, FontTweak}, }; use run_script::ScriptOptions; +use shadow_rs::ShadowBuilder; include!(concat!( env!("CARGO_MANIFEST_DIR"), @@ -72,8 +73,9 @@ fn main() { // rebuild if new commit or contents of `assets` folder changed println!("cargo:rerun-if-changed=.git/logs/HEAD"); println!("cargo:rerun-if-changed=assets/*"); - - shadow_rs::new().expect("Could not initialize shadow_rs"); + ShadowBuilder::builder() + .build() + .expect("Could not initialize shadow_rs"); let mut main_chars: Vec = b"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzsu0123456789?.,!(){}[]-_=+-/<>'\\ :^*`@#$%&|~;" diff --git a/src/function_manager.rs b/src/function_manager.rs index d3b1e7d..85f8155 100644 --- a/src/function_manager.rs +++ b/src/function_manager.rs @@ -1,6 +1,4 @@ -use crate::{ - consts::COLORS, function_entry::FunctionEntry, misc::random_u64, widgets::widgets_ontop, -}; +use crate::{consts::COLORS, function_entry::FunctionEntry, widgets::widgets_ontop}; use egui::{Button, Id, Key, Modifiers, PopupCloseBehavior, TextEdit, WidgetText}; use emath::vec2; use parsing::Movement; @@ -256,7 +254,7 @@ impl FunctionManager { /// Create and push new empty function entry pub fn push_empty(&mut self) { self.functions.push(( - Id::new(random_u64().expect("unable to generate random id")), + Id::new(format!("function #{}", self.functions.len() + 1)), FunctionEntry::default(), )); } diff --git a/src/math_app.rs b/src/math_app.rs index accfaee..1391f88 100644 --- a/src/math_app.rs +++ b/src/math_app.rs @@ -12,7 +12,7 @@ use egui::{ use egui_plot::Plot; use emath::{Align, Align2}; -use epaint::{Margin, Rounding}; +use epaint::Margin; use instant::Instant; use itertools::Itertools; use std::{io::Read, ops::BitXorAssign}; @@ -179,7 +179,7 @@ impl MathApp { fn decompress_fonts() -> epaint::text::FontDefinitions { let mut data = Vec::new(); let _ = - ruzstd::StreamingDecoder::new( + ruzstd::decoding::StreamingDecoder::new( &mut const { include_bytes!(concat!(env!("OUT_DIR"), "/compressed_data")).as_slice() }, diff --git a/src/misc.rs b/src/misc.rs index e39c3d7..ef3eee9 100644 --- a/src/misc.rs +++ b/src/misc.rs @@ -1,7 +1,6 @@ use base64::{Engine as _, engine::general_purpose}; use egui_plot::{Line, PlotPoint, PlotPoints, Points}; use emath::Pos2; -use getrandom::getrandom; use itertools::Itertools; use parsing::FlatExWrapper; @@ -195,16 +194,6 @@ pub fn hashed_storage_read(data: &str) -> Option<(HashBytes, Vec)> { Some((hash, data_bytes.to_vec())) } -/// Creates and returns random u64 -pub fn random_u64() -> Result { - // Buffer of 8 `u8`s that are later merged into one u64 - let mut buf = [0u8; 8]; - // Populate buffer with random values - getrandom(&mut buf)?; - // Merge buffer into u64 - Ok(u64::from_be_bytes(buf)) -} - include!(concat!(env!("OUT_DIR"), "/valid_chars.rs")); pub fn is_valid_char(c: char) -> bool { diff --git a/tests/function.rs b/tests/function.rs index c2623aa..63016eb 100644 --- a/tests/function.rs +++ b/tests/function.rs @@ -502,21 +502,29 @@ fn test_extrema_and_roots_with_trig() { let extrema_x: Vec = function.extrema_data.iter().map(|p| p.x as f32).collect(); // Should have extrema near ±π/2 - assert!(extrema_x - .iter() - .any(|&x| emath::almost_equal(x, std::f32::consts::PI / 2.0, 0.1))); - assert!(extrema_x - .iter() - .any(|&x| emath::almost_equal(x, -std::f32::consts::PI / 2.0, 0.1))); + assert!( + extrema_x + .iter() + .any(|&x| emath::almost_equal(x, std::f32::consts::PI / 2.0, 0.1)) + ); + assert!( + extrema_x + .iter() + .any(|&x| emath::almost_equal(x, -std::f32::consts::PI / 2.0, 0.1)) + ); let roots_x: Vec = function.root_data.iter().map(|p| p.x as f32).collect(); - assert!(roots_x - .iter() - .any(|&x| emath::almost_equal(x, std::f32::consts::PI, 0.1))); - assert!(roots_x - .iter() - .any(|&x| emath::almost_equal(x, -std::f32::consts::PI, 0.1))); + assert!( + roots_x + .iter() + .any(|&x| emath::almost_equal(x, std::f32::consts::PI, 0.1)) + ); + assert!( + roots_x + .iter() + .any(|&x| emath::almost_equal(x, -std::f32::consts::PI, 0.1)) + ); assert!(roots_x.iter().any(|&x| emath::almost_equal(x, 0.0, 0.1))); }