diff --git a/render-wasm/Cargo.lock b/render-wasm/Cargo.lock index 0416a6697..c9f243d16 100644 --- a/render-wasm/Cargo.lock +++ b/render-wasm/Cargo.lock @@ -1,6 +1,6 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -version = 3 +version = 4 [[package]] name = "adler2" @@ -8,15 +8,6 @@ version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627" -[[package]] -name = "aho-corasick" -version = "0.7.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc936419f96fa211c1b9166887b38e5e40b19958e5b895be7c1f93adec7071ac" -dependencies = [ - "memchr", -] - [[package]] name = "aho-corasick" version = "1.1.3" @@ -26,196 +17,6 @@ dependencies = [ "memchr", ] -[[package]] -name = "android-tzdata" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0" - -[[package]] -name = "android_system_properties" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" -dependencies = [ - "libc", -] - -[[package]] -name = "ansi_term" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2" -dependencies = [ - "winapi 0.3.9", -] - -[[package]] -name = "async-broadcast" -version = "0.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "435a87a52755b8f27fcf321ac4f04b2802e337c8c4872923137471ec39c37532" -dependencies = [ - "event-listener", - "event-listener-strategy", - "futures-core", - "pin-project-lite", -] - -[[package]] -name = "async-channel" -version = "2.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89b47800b0be77592da0afd425cc03468052844aff33b84e33cc696f64e77b6a" -dependencies = [ - "concurrent-queue", - "event-listener-strategy", - "futures-core", - "pin-project-lite", -] - -[[package]] -name = "async-executor" -version = "1.13.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30ca9a001c1e8ba5149f91a74362376cc6bc5b919d92d988668657bd570bdcec" -dependencies = [ - "async-task", - "concurrent-queue", - "fastrand", - "futures-lite", - "slab", -] - -[[package]] -name = "async-fs" -version = "2.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ebcd09b382f40fcd159c2d695175b2ae620ffa5f3bd6f664131efff4e8b9e04a" -dependencies = [ - "async-lock", - "blocking", - "futures-lite", -] - -[[package]] -name = "async-io" -version = "2.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43a2b323ccce0a1d90b449fd71f2a06ca7faa7c54c2751f06c9bd851fc061059" -dependencies = [ - "async-lock", - "cfg-if 1.0.0", - "concurrent-queue", - "futures-io", - "futures-lite", - "parking", - "polling", - "rustix", - "slab", - "tracing", - "windows-sys 0.59.0", -] - -[[package]] -name = "async-lock" -version = "3.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff6e472cdea888a4bd64f342f09b3f50e1886d32afe8df3d663c01140b811b18" -dependencies = [ - "event-listener", - "event-listener-strategy", - "pin-project-lite", -] - -[[package]] -name = "async-process" -version = "2.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "63255f1dc2381611000436537bbedfe83183faa303a5a0edaf191edef06526bb" -dependencies = [ - "async-channel", - "async-io", - "async-lock", - "async-signal", - "async-task", - "blocking", - "cfg-if 1.0.0", - "event-listener", - "futures-lite", - "rustix", - "tracing", -] - -[[package]] -name = "async-recursion" -version = "1.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b43422f69d8ff38f95f1b2bb76517c91589a924d1559a0e935d7c8ce0274c11" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.82", -] - -[[package]] -name = "async-signal" -version = "0.2.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "637e00349800c0bdf8bfc21ebbc0b6524abea702b0da4168ac00d070d0c0b9f3" -dependencies = [ - "async-io", - "async-lock", - "atomic-waker", - "cfg-if 1.0.0", - "futures-core", - "futures-io", - "rustix", - "signal-hook-registry", - "slab", - "windows-sys 0.59.0", -] - -[[package]] -name = "async-task" -version = "4.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b75356056920673b02621b35afd0f7dda9306d03c79a30f5c56c44cf256e3de" - -[[package]] -name = "async-trait" -version = "0.1.85" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f934833b4b7233644e5848f235df3f57ed8c80f1528a26c3dfa13d2147fa056" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.82", -] - -[[package]] -name = "atomic-waker" -version = "1.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" - -[[package]] -name = "atty" -version = "0.2.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" -dependencies = [ - "hermit-abi 0.1.19", - "libc", - "winapi 0.3.9", -] - -[[package]] -name = "autocfg" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" - [[package]] name = "base64" version = "0.22.1" @@ -228,7 +29,7 @@ version = "0.71.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5f58bf3d7db68cfbac37cfc485a8d711e87e064c3d0fe0435b92f7a407f9d6b3" dependencies = [ - "bitflags 2.6.0", + "bitflags", "cexpr", "clang-sys", "itertools", @@ -239,104 +40,15 @@ dependencies = [ "regex", "rustc-hash", "shlex", - "syn 2.0.82", + "syn", ] -[[package]] -name = "bitflags" -version = "1.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" - [[package]] name = "bitflags" version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" -[[package]] -name = "block" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d8c1fef690941d3e7788d328517591fecc684c084084702d6ff1641e993699a" - -[[package]] -name = "blocking" -version = "1.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "703f41c54fc768e63e091340b424302bb1c29ef4aa0c7f10fe849dfb114d29ea" -dependencies = [ - "async-channel", - "async-task", - "futures-io", - "futures-lite", - "piper", -] - -[[package]] -name = "bstr" -version = "0.2.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba3569f383e8f1598449f1a423e72e99569137b47740b1da11ef19af3d5c3223" -dependencies = [ - "memchr", -] - -[[package]] -name = "bumpalo" -version = "3.17.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1628fb46dfa0b37568d12e5edd512553eccf6a22a78e8bde00bb4aed84d5bdbf" - -[[package]] -name = "camino" -version = "1.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b96ec4966b5813e2c0507c1f86115c8c5abaadc3980879c3424042a02fd1ad3" -dependencies = [ - "serde", -] - -[[package]] -name = "cargo-platform" -version = "0.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e35af189006b9c0f00a064685c727031e3ed2d8020f7ba284d78cc2671bd36ea" -dependencies = [ - "serde", -] - -[[package]] -name = "cargo-watch" -version = "8.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6fee2a949f4d075f1d2ff3bc49feba865145eae3367f331596ecb47477903a16" -dependencies = [ - "camino", - "cargo_metadata", - "clap", - "dotenvy", - "log", - "notify-rust", - "shell-escape", - "stderrlog", - "watchexec", -] - -[[package]] -name = "cargo_metadata" -version = "0.18.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d886547e41f740c616ae73108f6eb70afe6d940c7bc697cb30f13daec073037" -dependencies = [ - "camino", - "cargo-platform", - "semver", - "serde", - "serde_json", - "thiserror", -] - [[package]] name = "cc" version = "1.1.31" @@ -352,41 +64,15 @@ version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6fac387a98bb7c37292057cffc56d62ecb629900026402633ae9160df93a8766" dependencies = [ - "nom 7.1.3", + "nom", ] -[[package]] -name = "cfg-if" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" - [[package]] name = "cfg-if" version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" -[[package]] -name = "cfg_aliases" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" - -[[package]] -name = "chrono" -version = "0.4.39" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e36cc9d416881d2e24f9a963be5fb1cd90966419ac844274161d10488b3e825" -dependencies = [ - "android-tzdata", - "iana-time-zone", - "js-sys", - "num-traits", - "wasm-bindgen", - "windows-targets 0.52.6", -] - [[package]] name = "clang-sys" version = "1.8.1" @@ -398,229 +84,21 @@ dependencies = [ "libloading", ] -[[package]] -name = "clap" -version = "2.34.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a0610544180c38b88101fecf2dd634b174a62eef6946f84dfc6a7127512b381c" -dependencies = [ - "ansi_term", - "atty", - "bitflags 1.3.2", - "strsim 0.8.0", - "textwrap", - "unicode-width", - "vec_map", -] - -[[package]] -name = "clearscreen" -version = "1.0.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e55dadbdd203f69c0a107bc78fca6e47d605345610ee77dcf24203fdf510b317" -dependencies = [ - "nix 0.24.3", - "terminfo", - "thiserror", - "which", - "winapi 0.3.9", -] - -[[package]] -name = "command-group" -version = "1.0.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7a8a86f409b4a59df3a3e4bee2de0b83f1755fdd2a25e3a9684c396fc4bed2c" -dependencies = [ - "nix 0.22.3", - "winapi 0.3.9", -] - -[[package]] -name = "concurrent-queue" -version = "2.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ca0197aee26d1ae37445ee532fefce43251d24cc7c166799f4d46817f1d3973" -dependencies = [ - "crossbeam-utils", -] - -[[package]] -name = "core-foundation-sys" -version = "0.8.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" - [[package]] name = "crc32fast" version = "1.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a97769d94ddab943e4510d138150169a2758b5ef3eb191a9ee688de3e23ef7b3" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", ] -[[package]] -name = "crossbeam-utils" -version = "0.8.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28" - -[[package]] -name = "darling" -version = "0.12.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f2c43f534ea4b0b049015d00269734195e6d3f0f6635cb692251aca6f9f8b3c" -dependencies = [ - "darling_core", - "darling_macro", -] - -[[package]] -name = "darling_core" -version = "0.12.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e91455b86830a1c21799d94524df0845183fa55bafd9aa137b01c7d1065fa36" -dependencies = [ - "fnv", - "ident_case", - "proc-macro2", - "quote", - "strsim 0.10.0", - "syn 1.0.109", -] - -[[package]] -name = "darling_macro" -version = "0.12.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29b5acf0dea37a7f66f7b25d2c5e93fd46f8f6968b1a5d7a3e02e97768afc95a" -dependencies = [ - "darling_core", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "deranged" -version = "0.3.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b42b6fa04a440b495c8b04d0e71b707c585f83cb9cb28cf8cd0d976c315e31b4" -dependencies = [ - "powerfmt", -] - -[[package]] -name = "derive_builder" -version = "0.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d13202debe11181040ae9063d739fa32cfcaaebe2275fe387703460ae2365b30" -dependencies = [ - "derive_builder_macro", -] - -[[package]] -name = "derive_builder_core" -version = "0.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "66e616858f6187ed828df7c64a6d71720d83767a7f19740b2d1b6fe6327b36e5" -dependencies = [ - "darling", - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "derive_builder_macro" -version = "0.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58a94ace95092c5acb1e97a7e846b310cfbd499652f72297da7493f618a98d73" -dependencies = [ - "derive_builder_core", - "syn 1.0.109", -] - -[[package]] -name = "dirs" -version = "4.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca3aa72a6f96ea37bbc5aa912f6788242832f75369bdfdadcb0e38423f100059" -dependencies = [ - "dirs-sys", -] - -[[package]] -name = "dirs-next" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b98cf8ebf19c3d1b223e151f99a4f9f0690dca41414773390fc824184ac833e1" -dependencies = [ - "cfg-if 1.0.0", - "dirs-sys-next", -] - -[[package]] -name = "dirs-sys" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b1d1d91c932ef41c0f2663aa8b0ca0342d444d842c06914aa0a7e352d0bada6" -dependencies = [ - "libc", - "redox_users", - "winapi 0.3.9", -] - -[[package]] -name = "dirs-sys-next" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ebda144c4fe02d1f7ea1a7d9641b6fc6b580adcfa024ae48797ecdeb6825b4d" -dependencies = [ - "libc", - "redox_users", - "winapi 0.3.9", -] - -[[package]] -name = "dotenvy" -version = "0.15.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1aaf95b3e5c8f23aa320147307562d361db0ae0d51242340f558153b4eb2439b" - [[package]] name = "either" version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0" -[[package]] -name = "endi" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3d8a32ae18130a3c84dd492d4215c3d913c3b07c6b63c2eb3eb7ff1101ab7bf" - -[[package]] -name = "enumflags2" -version = "0.7.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba2f4b465f5318854c6f8dd686ede6c0a9dc67d4b1ac241cf0eb51521a309147" -dependencies = [ - "enumflags2_derive", - "serde", -] - -[[package]] -name = "enumflags2_derive" -version = "0.7.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc4caf64a58d7a6d65ab00639b046ff54399a39f5f2554728895ace4b297cd79" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.82", -] - [[package]] name = "equivalent" version = "1.0.1" @@ -637,40 +115,13 @@ dependencies = [ "windows-sys 0.52.0", ] -[[package]] -name = "event-listener" -version = "5.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3492acde4c3fc54c845eaab3eed8bd00c7a7d881f78bfc801e43a93dec1331ae" -dependencies = [ - "concurrent-queue", - "parking", - "pin-project-lite", -] - -[[package]] -name = "event-listener-strategy" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c3e4e0dd3673c1139bf041f3008816d9cf2946bbfac2945c09e523b8d7b05b2" -dependencies = [ - "event-listener", - "pin-project-lite", -] - -[[package]] -name = "fastrand" -version = "2.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be" - [[package]] name = "filetime" version = "0.2.25" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "35c0522e981e68cbfa8c3f978441a5f34b30b96e146b33cd3359176b50fe8586" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "libc", "libredox", "windows-sys 0.59.0", @@ -686,100 +137,13 @@ dependencies = [ "miniz_oxide", ] -[[package]] -name = "fnv" -version = "1.0.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" - -[[package]] -name = "fsevent" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ab7d1bd1bd33cc98b0889831b72da23c0aa4df9cec7e0702f46ecea04b35db6" -dependencies = [ - "bitflags 1.3.2", - "fsevent-sys", -] - -[[package]] -name = "fsevent-sys" -version = "2.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f41b048a94555da0f42f1d632e2e19510084fb8e303b0daa2816e733fb3644a0" -dependencies = [ - "libc", -] - -[[package]] -name = "fuchsia-zircon" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82" -dependencies = [ - "bitflags 1.3.2", - "fuchsia-zircon-sys", -] - -[[package]] -name = "fuchsia-zircon-sys" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7" - -[[package]] -name = "futures-core" -version = "0.3.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" - -[[package]] -name = "futures-io" -version = "0.3.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6" - -[[package]] -name = "futures-lite" -version = "2.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f5edaec856126859abb19ed65f39e90fea3a9574b9707f13539acf4abf7eb532" -dependencies = [ - "fastrand", - "futures-core", - "futures-io", - "parking", - "pin-project-lite", -] - -[[package]] -name = "futures-task" -version = "0.3.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988" - -[[package]] -name = "futures-util" -version = "0.3.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81" -dependencies = [ - "futures-core", - "futures-io", - "futures-task", - "memchr", - "pin-project-lite", - "pin-utils", - "slab", -] - [[package]] name = "getrandom" version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "libc", "wasi", ] @@ -810,19 +174,6 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" -[[package]] -name = "globset" -version = "0.4.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c152169ef1e421390738366d2f796655fec62621dabbd0fd476f905934061e4a" -dependencies = [ - "aho-corasick 0.7.20", - "bstr", - "fnv", - "log", - "regex", -] - [[package]] name = "hashbrown" version = "0.15.0" @@ -835,65 +186,6 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" -[[package]] -name = "hermit-abi" -version = "0.1.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" -dependencies = [ - "libc", -] - -[[package]] -name = "hermit-abi" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fbf6a919d6cf397374f7dfeeea91d974c7c0a7221d0d0f4f20d859d329e53fcc" - -[[package]] -name = "hex" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" - -[[package]] -name = "home" -version = "0.5.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "589533453244b0995c858700322199b2becb13b627df2851f64a2775d024abcf" -dependencies = [ - "windows-sys 0.59.0", -] - -[[package]] -name = "iana-time-zone" -version = "0.1.61" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "235e081f3925a06703c2d0117ea8b91f042756fd6e7a6e5d901e8ca1a996b220" -dependencies = [ - "android_system_properties", - "core-foundation-sys", - "iana-time-zone-haiku", - "js-sys", - "wasm-bindgen", - "windows-core 0.52.0", -] - -[[package]] -name = "iana-time-zone-haiku" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" -dependencies = [ - "cc", -] - -[[package]] -name = "ident_case" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" - [[package]] name = "indexmap" version = "2.7.1" @@ -904,46 +196,6 @@ dependencies = [ "hashbrown", ] -[[package]] -name = "inotify" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4816c66d2c8ae673df83366c18341538f234a26d65a9ecea5c348b453ac1d02f" -dependencies = [ - "bitflags 1.3.2", - "inotify-sys", - "libc", -] - -[[package]] -name = "inotify-sys" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e05c02b5e89bff3b946cedeca278abc628fe811e604f027c45a8aa3cf793d0eb" -dependencies = [ - "libc", -] - -[[package]] -name = "iovec" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2b3ea6ff95e175473f8ffe6a7eb7c00d054240321b84c57051175fe3c1e075e" -dependencies = [ - "libc", -] - -[[package]] -name = "is-terminal" -version = "0.4.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e19b23d53f35ce9f56aebc7d1bb4e6ac1e9c0db7ac85c8d1760c04379edced37" -dependencies = [ - "hermit-abi 0.4.0", - "libc", - "windows-sys 0.59.0", -] - [[package]] name = "itertools" version = "0.12.1" @@ -959,26 +211,6 @@ version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" -[[package]] -name = "js-sys" -version = "0.3.77" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1cfaf33c695fc6e08064efbc1f72ec937429614f25eef83af942d0e227c3a28f" -dependencies = [ - "once_cell", - "wasm-bindgen", -] - -[[package]] -name = "kernel32-sys" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" -dependencies = [ - "winapi 0.2.8", - "winapi-build", -] - [[package]] name = "khronos_api" version = "3.1.0" @@ -991,12 +223,6 @@ version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" -[[package]] -name = "lazycell" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" - [[package]] name = "libc" version = "0.2.161" @@ -1009,8 +235,8 @@ version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4979f22fdb869068da03c9f7528f8297c6fd2606bc3a4affe42e6a823fdb8da4" dependencies = [ - "cfg-if 1.0.0", - "windows-targets 0.52.6", + "cfg-if", + "windows-targets", ] [[package]] @@ -1019,7 +245,7 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c0ff37bd590ca25063e35af745c343cb7a0271906fb7b37e4813e8f79f00268d" dependencies = [ - "bitflags 2.6.0", + "bitflags", "libc", "redox_syscall", ] @@ -1036,52 +262,12 @@ version = "0.4.22" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" -[[package]] -name = "mac-notification-sys" -version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dce8f34f3717aa37177e723df6c1fc5fb02b2a1087374ea3fe0ea42316dc8f91" -dependencies = [ - "cc", - "dirs-next", - "objc-foundation", - "objc_id", - "time", -] - -[[package]] -name = "malloc_buf" -version = "0.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62bb907fe88d54d8d9ce32a3cceab4218ed2f6b7d35617cafe9adf84e43919cb" -dependencies = [ - "libc", -] - [[package]] name = "memchr" version = "2.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" -[[package]] -name = "memoffset" -version = "0.6.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5aa361d4faea93603064a027415f07bd8e1d5c88c9fbf68bf56a285428fd79ce" -dependencies = [ - "autocfg", -] - -[[package]] -name = "memoffset" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "488016bfae457b036d996092f6cb448677611ce4449e970ceaf42695203f218a" -dependencies = [ - "autocfg", -] - [[package]] name = "minimal-lexical" version = "0.2.1" @@ -1097,107 +283,6 @@ dependencies = [ "adler2", ] -[[package]] -name = "mio" -version = "0.6.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4afd66f5b91bf2a3bc13fad0e21caedac168ca4c707504e75585648ae80e4cc4" -dependencies = [ - "cfg-if 0.1.10", - "fuchsia-zircon", - "fuchsia-zircon-sys", - "iovec", - "kernel32-sys", - "libc", - "log", - "miow", - "net2", - "slab", - "winapi 0.2.8", -] - -[[package]] -name = "mio-extras" -version = "2.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52403fe290012ce777c4626790c8951324a2b9e3316b3143779c72b029742f19" -dependencies = [ - "lazycell", - "log", - "mio", - "slab", -] - -[[package]] -name = "miow" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ebd808424166322d4a38da87083bfddd3ac4c131334ed55856112eb06d46944d" -dependencies = [ - "kernel32-sys", - "net2", - "winapi 0.2.8", - "ws2_32-sys", -] - -[[package]] -name = "net2" -version = "0.2.39" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b13b648036a2339d06de780866fbdfda0dde886de7b3af2ddeba8b14f4ee34ac" -dependencies = [ - "cfg-if 0.1.10", - "libc", - "winapi 0.3.9", -] - -[[package]] -name = "nix" -version = "0.22.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4916f159ed8e5de0082076562152a76b7a1f64a01fd9d1e0fea002c37624faf" -dependencies = [ - "bitflags 1.3.2", - "cc", - "cfg-if 1.0.0", - "libc", - "memoffset 0.6.5", -] - -[[package]] -name = "nix" -version = "0.24.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa52e972a9a719cecb6864fb88568781eb706bac2cd1d4f04a648542dbf78069" -dependencies = [ - "bitflags 1.3.2", - "cfg-if 1.0.0", - "libc", -] - -[[package]] -name = "nix" -version = "0.29.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71e2746dc3a24dd78b3cfcb7be93368c6de9963d30f43a6a73998a9cf4b17b46" -dependencies = [ - "bitflags 2.6.0", - "cfg-if 1.0.0", - "cfg_aliases", - "libc", - "memoffset 0.9.1", -] - -[[package]] -name = "nom" -version = "5.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08959a387a676302eebf4ddbcbc611da04285579f76f88ee0506c63b1a61dd4b" -dependencies = [ - "memchr", - "version_check", -] - [[package]] name = "nom" version = "7.1.3" @@ -1208,191 +293,12 @@ dependencies = [ "minimal-lexical", ] -[[package]] -name = "notify" -version = "4.0.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b72dd35279a5dc895a30965e247b0961ba36c233dc48454a2de8ccd459f1afd3" -dependencies = [ - "bitflags 1.3.2", - "filetime", - "fsevent", - "fsevent-sys", - "inotify", - "libc", - "mio", - "mio-extras", - "walkdir", - "winapi 0.3.9", -] - -[[package]] -name = "notify-rust" -version = "4.11.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96ae13fb6065b0865d2310dfa55ce319245052ed95fbbe2bc87c99962c58d73f" -dependencies = [ - "log", - "mac-notification-sys", - "serde", - "tauri-winrt-notification", - "zbus", -] - -[[package]] -name = "num-conv" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" - -[[package]] -name = "num-traits" -version = "0.2.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" -dependencies = [ - "autocfg", -] - -[[package]] -name = "objc" -version = "0.2.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "915b1b472bc21c53464d6c8461c9d3af805ba1ef837e1cac254428f4a77177b1" -dependencies = [ - "malloc_buf", -] - -[[package]] -name = "objc-foundation" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1add1b659e36c9607c7aab864a76c7a4c2760cd0cd2e120f3fb8b952c7e22bf9" -dependencies = [ - "block", - "objc", - "objc_id", -] - -[[package]] -name = "objc_id" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c92d4ddb4bd7b50d730c215ff871754d0da6b2178849f8a2a2ab69712d0c073b" -dependencies = [ - "objc", -] - -[[package]] -name = "once_cell" -version = "1.20.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775" - -[[package]] -name = "ordered-stream" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9aa2b01e1d916879f73a53d01d1d6cee68adbb31d6d9177a8cfce093cced1d50" -dependencies = [ - "futures-core", - "pin-project-lite", -] - -[[package]] -name = "parking" -version = "2.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f38d5652c16fde515bb1ecef450ab0f6a219d619a7274976324d5e377f7dceba" - [[package]] name = "percent-encoding" version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" -[[package]] -name = "phf" -version = "0.11.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fd6780a80ae0c52cc120a26a1a42c1ae51b247a253e4e06113d23d2c2edd078" -dependencies = [ - "phf_shared", -] - -[[package]] -name = "phf_codegen" -version = "0.11.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aef8048c789fa5e851558d709946d6d79a8ff88c0440c587967f8e94bfb1216a" -dependencies = [ - "phf_generator", - "phf_shared", -] - -[[package]] -name = "phf_generator" -version = "0.11.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c80231409c20246a13fddb31776fb942c38553c51e871f8cbd687a4cfb5843d" -dependencies = [ - "phf_shared", - "rand", -] - -[[package]] -name = "phf_shared" -version = "0.11.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67eabc2ef2a60eb7faa00097bd1ffdb5bd28e62bf39990626a582201b7a754e5" -dependencies = [ - "siphasher", -] - -[[package]] -name = "pin-project-lite" -version = "0.2.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b" - -[[package]] -name = "pin-utils" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" - -[[package]] -name = "piper" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96c8c490f422ef9a4efd2cb5b42b76c8613d7e7dfc1caf667b8a3350a5acc066" -dependencies = [ - "atomic-waker", - "fastrand", - "futures-io", -] - -[[package]] -name = "polling" -version = "3.7.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a604568c3202727d1507653cb121dbd627a58684eb09a820fd746bee38b4442f" -dependencies = [ - "cfg-if 1.0.0", - "concurrent-queue", - "hermit-abi 0.4.0", - "pin-project-lite", - "rustix", - "tracing", - "windows-sys 0.59.0", -] - -[[package]] -name = "powerfmt" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" - [[package]] name = "prettyplease" version = "0.2.24" @@ -1400,16 +306,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "910d41a655dac3b764f1ade94821093d3610248694320cd072303a8eedcf221d" dependencies = [ "proc-macro2", - "syn 2.0.82", -] - -[[package]] -name = "proc-macro-crate" -version = "3.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ecf48c7ca261d60b74ab1a7b20da18bede46776b2e55535cb958eb595c5fa7b" -dependencies = [ - "toml_edit", + "syn", ] [[package]] @@ -1421,15 +318,6 @@ dependencies = [ "unicode-ident", ] -[[package]] -name = "quick-xml" -version = "0.31.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1004a344b30a54e2ee58d66a71b32d2db2feb0a31f9a2d302bf0536f15de2a33" -dependencies = [ - "memchr", -] - [[package]] name = "quote" version = "1.0.37" @@ -1439,39 +327,13 @@ dependencies = [ "proc-macro2", ] -[[package]] -name = "rand" -version = "0.8.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" -dependencies = [ - "rand_core", -] - -[[package]] -name = "rand_core" -version = "0.6.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" - [[package]] name = "redox_syscall" version = "0.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9b6dfecf2c74bce2466cabf93f6664d6998a69eb21e39f4207930065b27b771f" dependencies = [ - "bitflags 2.6.0", -] - -[[package]] -name = "redox_users" -version = "0.4.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba009ff324d1fc1b900bd1fdb31564febe58a8ccc8a6fdbb93b543d33b13ca43" -dependencies = [ - "getrandom", - "libredox", - "thiserror", + "bitflags", ] [[package]] @@ -1480,7 +342,7 @@ version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "38200e5ee88914975b69f657f0801b6f6dccafd44fd9326302a4aaeecfacb1d8" dependencies = [ - "aho-corasick 1.1.3", + "aho-corasick", "memchr", "regex-automata", "regex-syntax", @@ -1492,7 +354,7 @@ version = "0.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "368758f23274712b504848e9d5a6f010445cc8b87a7cdb4d7cbee666c1288da3" dependencies = [ - "aho-corasick 1.1.3", + "aho-corasick", "memchr", "regex-syntax", ] @@ -1508,7 +370,6 @@ name = "render" version = "0.1.0" dependencies = [ "base64", - "cargo-watch", "gl", "indexmap", "skia-safe", @@ -1527,43 +388,19 @@ version = "0.38.37" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8acb788b847c24f28525660c4d7758620a7210875711f79e7f663cc152726811" dependencies = [ - "bitflags 2.6.0", + "bitflags", "errno", "libc", "linux-raw-sys", "windows-sys 0.52.0", ] -[[package]] -name = "rustversion" -version = "1.0.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7c45b9784283f1b2e7fb61b42047c2fd678ef0960d4f6f1eba131594cc369d4" - [[package]] name = "ryu" version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" -[[package]] -name = "same-file" -version = "1.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" -dependencies = [ - "winapi-util", -] - -[[package]] -name = "semver" -version = "1.0.25" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f79dfe2d285b0488816f30e700a7438c5a73d816b5b7d3ac72fbc48b0d185e03" -dependencies = [ - "serde", -] - [[package]] name = "serde" version = "1.0.210" @@ -1581,7 +418,7 @@ checksum = "243902eda00fad750862fc144cea25caca5e20d615af0a81bee94ca738f1df1f" dependencies = [ "proc-macro2", "quote", - "syn 2.0.82", + "syn", ] [[package]] @@ -1596,17 +433,6 @@ dependencies = [ "serde", ] -[[package]] -name = "serde_repr" -version = "0.1.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c64451ba24fc7a6a2d60fc75dd9c83c90903b19028d4eff35e88fc1e86564e9" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.82", -] - [[package]] name = "serde_spanned" version = "0.6.8" @@ -1616,33 +442,12 @@ dependencies = [ "serde", ] -[[package]] -name = "shell-escape" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45bb67a18fa91266cc7807181f62f9178a6873bfad7dc788c42e6430db40184f" - [[package]] name = "shlex" version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" -[[package]] -name = "signal-hook-registry" -version = "1.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9e9e0b4211b72e7b8b6e85c807d36c212bdb33ea8587f7569562a84df5465b1" -dependencies = [ - "libc", -] - -[[package]] -name = "siphasher" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56199f7ddabf13fe5074ce809e7d3f42b42ae711800501b5b16ea82ad029c39d" - [[package]] name = "skia-bindings" version = "0.81.0" @@ -1666,7 +471,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0cade7bc92e092138e3b726ce57162b3e0f4f3099c616b32af740a13ca18cb2a" dependencies = [ "base64", - "bitflags 2.6.0", + "bitflags", "lazy_static", "percent-encoding", "skia-bindings", @@ -1681,58 +486,7 @@ checksum = "044dd2233c9717a74f75197f3e7f0a966db2127c0ffb5e05013b480a9b75b2c7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.82", -] - -[[package]] -name = "slab" -version = "0.4.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" -dependencies = [ - "autocfg", -] - -[[package]] -name = "static_assertions" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" - -[[package]] -name = "stderrlog" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61c910772f992ab17d32d6760e167d2353f4130ed50e796752689556af07dc6b" -dependencies = [ - "chrono", - "is-terminal", - "log", - "termcolor", - "thread_local", -] - -[[package]] -name = "strsim" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" - -[[package]] -name = "strsim" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" - -[[package]] -name = "syn" -version = "1.0.109" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", + "syn", ] [[package]] @@ -1757,110 +511,6 @@ dependencies = [ "xattr", ] -[[package]] -name = "tauri-winrt-notification" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f89f5fb70d6f62381f5d9b2ba9008196150b40b75f3068eb24faeddf1c686871" -dependencies = [ - "quick-xml", - "windows", - "windows-version", -] - -[[package]] -name = "tempfile" -version = "3.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0f2c9fc62d0beef6951ccffd757e241266a2c833136efbe35af6cd2567dca5b" -dependencies = [ - "cfg-if 1.0.0", - "fastrand", - "once_cell", - "rustix", - "windows-sys 0.59.0", -] - -[[package]] -name = "termcolor" -version = "1.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bab24d30b911b2376f3a13cc2cd443142f0c81dda04c118693e35b3835757755" -dependencies = [ - "winapi-util", -] - -[[package]] -name = "terminfo" -version = "0.7.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da31aef70da0f6352dbcb462683eb4dd2bfad01cf3fc96cf204547b9a839a585" -dependencies = [ - "dirs", - "fnv", - "nom 5.1.3", - "phf", - "phf_codegen", -] - -[[package]] -name = "textwrap" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" -dependencies = [ - "unicode-width", -] - -[[package]] -name = "thiserror" -version = "1.0.65" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d11abd9594d9b38965ef50805c5e469ca9cc6f197f883f717e0269a3057b3d5" -dependencies = [ - "thiserror-impl", -] - -[[package]] -name = "thiserror-impl" -version = "1.0.65" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae71770322cbd277e69d762a16c444af02aa0575ac0d174f0b9562d3b37f8602" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.82", -] - -[[package]] -name = "thread_local" -version = "1.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b9ef9bad013ada3808854ceac7b46812a6465ba368859a37e2100283d2d719c" -dependencies = [ - "cfg-if 1.0.0", - "once_cell", -] - -[[package]] -name = "time" -version = "0.3.37" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35e7868883861bd0e56d9ac6efcaaca0d6d5d82a2a7ec8209ff492c07cf37b21" -dependencies = [ - "deranged", - "num-conv", - "powerfmt", - "serde", - "time-core", -] - -[[package]] -name = "time-core" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" - [[package]] name = "toml" version = "0.8.19" @@ -1895,60 +545,12 @@ dependencies = [ "winnow", ] -[[package]] -name = "tracing" -version = "0.1.41" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "784e0ac535deb450455cbfa28a6f0df145ea1bb7ae51b821cf5e7927fdcfbdd0" -dependencies = [ - "pin-project-lite", - "tracing-attributes", - "tracing-core", -] - -[[package]] -name = "tracing-attributes" -version = "0.1.28" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "395ae124c09f9e6918a2310af6038fba074bcf474ac352496d5910dd59a2226d" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.82", -] - -[[package]] -name = "tracing-core" -version = "0.1.33" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e672c95779cf947c5311f83787af4fa8fffd12fb27e4993211a84bdfd9610f9c" -dependencies = [ - "once_cell", -] - -[[package]] -name = "uds_windows" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89daebc3e6fd160ac4aa9fc8b3bf71e1f74fbf92367ae71fb83a037e8bf164b9" -dependencies = [ - "memoffset 0.9.1", - "tempfile", - "winapi 0.3.9", -] - [[package]] name = "unicode-ident" version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" -[[package]] -name = "unicode-width" -version = "0.1.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7dd6e30e90baa6f72411720665d41d89b9a3d039dc45b8faea1ddd07f617f6af" - [[package]] name = "uuid" version = "1.11.0" @@ -1958,235 +560,19 @@ dependencies = [ "getrandom", ] -[[package]] -name = "vec_map" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" - -[[package]] -name = "version_check" -version = "0.9.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" - -[[package]] -name = "walkdir" -version = "2.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b" -dependencies = [ - "same-file", - "winapi-util", -] - [[package]] name = "wasi" version = "0.11.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" -[[package]] -name = "wasm-bindgen" -version = "0.2.100" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1edc8929d7499fc4e8f0be2262a241556cfc54a0bea223790e71446f2aab1ef5" -dependencies = [ - "cfg-if 1.0.0", - "once_cell", - "rustversion", - "wasm-bindgen-macro", -] - -[[package]] -name = "wasm-bindgen-backend" -version = "0.2.100" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f0a0651a5c2bc21487bde11ee802ccaf4c51935d0d3d42a6101f98161700bc6" -dependencies = [ - "bumpalo", - "log", - "proc-macro2", - "quote", - "syn 2.0.82", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-macro" -version = "0.2.100" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fe63fc6d09ed3792bd0897b314f53de8e16568c2b3f7982f468c0bf9bd0b407" -dependencies = [ - "quote", - "wasm-bindgen-macro-support", -] - -[[package]] -name = "wasm-bindgen-macro-support" -version = "0.2.100" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ae87ea40c9f689fc23f209965b6fb8a99ad69aeeb0231408be24920604395de" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.82", - "wasm-bindgen-backend", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-shared" -version = "0.2.100" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a05d73b933a847d6cccdda8f838a22ff101ad9bf93e33684f39c1f5f0eece3d" -dependencies = [ - "unicode-ident", -] - -[[package]] -name = "watchexec" -version = "1.17.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38928d7ff5274e31594da2d46453a2c741fa340d1bf0ef6f2cb3e43537361265" -dependencies = [ - "clearscreen", - "command-group", - "derive_builder", - "glob", - "globset", - "lazy_static", - "log", - "nix 0.22.3", - "notify", - "walkdir", - "winapi 0.3.9", -] - -[[package]] -name = "which" -version = "4.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87ba24419a2078cd2b0f2ede2691b6c66d8e47836da3b6db8265ebad47afbfc7" -dependencies = [ - "either", - "home", - "once_cell", - "rustix", -] - -[[package]] -name = "winapi" -version = "0.2.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" - -[[package]] -name = "winapi" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" -dependencies = [ - "winapi-i686-pc-windows-gnu", - "winapi-x86_64-pc-windows-gnu", -] - -[[package]] -name = "winapi-build" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" - -[[package]] -name = "winapi-i686-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" - -[[package]] -name = "winapi-util" -version = "0.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" -dependencies = [ - "windows-sys 0.59.0", -] - -[[package]] -name = "winapi-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" - -[[package]] -name = "windows" -version = "0.56.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1de69df01bdf1ead2f4ac895dc77c9351aefff65b2f3db429a343f9cbf05e132" -dependencies = [ - "windows-core 0.56.0", - "windows-targets 0.52.6", -] - -[[package]] -name = "windows-core" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9" -dependencies = [ - "windows-targets 0.52.6", -] - -[[package]] -name = "windows-core" -version = "0.56.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4698e52ed2d08f8658ab0c39512a7c00ee5fe2688c65f8c0a4f06750d729f2a6" -dependencies = [ - "windows-implement", - "windows-interface", - "windows-result", - "windows-targets 0.52.6", -] - -[[package]] -name = "windows-implement" -version = "0.56.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6fc35f58ecd95a9b71c4f2329b911016e6bec66b3f2e6a4aad86bd2e99e2f9b" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.82", -] - -[[package]] -name = "windows-interface" -version = "0.56.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08990546bf4edef8f431fa6326e032865f27138718c587dc21bc0265bbcb57cc" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.82", -] - -[[package]] -name = "windows-result" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e383302e8ec8515204254685643de10811af0ed97ea37210dc26fb0032647f8" -dependencies = [ - "windows-targets 0.52.6", -] - [[package]] name = "windows-sys" version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" dependencies = [ - "windows-targets 0.52.6", + "windows-targets", ] [[package]] @@ -2195,7 +581,7 @@ version = "0.59.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" dependencies = [ - "windows-targets 0.52.6", + "windows-targets", ] [[package]] @@ -2204,39 +590,14 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" dependencies = [ - "windows_aarch64_gnullvm 0.52.6", - "windows_aarch64_msvc 0.52.6", - "windows_i686_gnu 0.52.6", - "windows_i686_gnullvm 0.52.6", - "windows_i686_msvc 0.52.6", - "windows_x86_64_gnu 0.52.6", - "windows_x86_64_gnullvm 0.52.6", - "windows_x86_64_msvc 0.52.6", -] - -[[package]] -name = "windows-targets" -version = "0.53.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1e4c7e8ceaaf9cb7d7507c974735728ab453b67ef8f18febdd7c11fe59dca8b" -dependencies = [ - "windows_aarch64_gnullvm 0.53.0", - "windows_aarch64_msvc 0.53.0", - "windows_i686_gnu 0.53.0", - "windows_i686_gnullvm 0.53.0", - "windows_i686_msvc 0.53.0", - "windows_x86_64_gnu 0.53.0", - "windows_x86_64_gnullvm 0.53.0", - "windows_x86_64_msvc 0.53.0", -] - -[[package]] -name = "windows-version" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c12476c23a74725c539b24eae8bfc0dac4029c39cdb561d9f23616accd4ae26d" -dependencies = [ - "windows-targets 0.53.0", + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_gnullvm", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", ] [[package]] @@ -2245,96 +606,48 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.53.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86b8d5f90ddd19cb4a147a5fa63ca848db3df085e25fee3cc10b39b6eebae764" - [[package]] name = "windows_aarch64_msvc" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" -[[package]] -name = "windows_aarch64_msvc" -version = "0.53.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7651a1f62a11b8cbd5e0d42526e55f2c99886c77e007179efff86c2b137e66c" - [[package]] name = "windows_i686_gnu" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" -[[package]] -name = "windows_i686_gnu" -version = "0.53.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1dc67659d35f387f5f6c479dc4e28f1d4bb90ddd1a5d3da2e5d97b42d6272c3" - [[package]] name = "windows_i686_gnullvm" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" -[[package]] -name = "windows_i686_gnullvm" -version = "0.53.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ce6ccbdedbf6d6354471319e781c0dfef054c81fbc7cf83f338a4296c0cae11" - [[package]] name = "windows_i686_msvc" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" -[[package]] -name = "windows_i686_msvc" -version = "0.53.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "581fee95406bb13382d2f65cd4a908ca7b1e4c2f1917f143ba16efe98a589b5d" - [[package]] name = "windows_x86_64_gnu" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" -[[package]] -name = "windows_x86_64_gnu" -version = "0.53.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e55b5ac9ea33f2fc1716d1742db15574fd6fc8dadc51caab1c16a3d3b4190ba" - [[package]] name = "windows_x86_64_gnullvm" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.53.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a6e035dd0599267ce1ee132e51c27dd29437f63325753051e71dd9e42406c57" - [[package]] name = "windows_x86_64_msvc" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" -[[package]] -name = "windows_x86_64_msvc" -version = "0.53.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "271414315aff87387382ec3d271b52d7ae78726f5d44ac98b4f4030c91880486" - [[package]] name = "winnow" version = "0.6.20" @@ -2344,16 +657,6 @@ dependencies = [ "memchr", ] -[[package]] -name = "ws2_32-sys" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d59cefebd0c892fa2dd6de581e937301d8552cb44489cdff035c6187cb63fa5e" -dependencies = [ - "winapi 0.2.8", - "winapi-build", -] - [[package]] name = "xattr" version = "1.3.1" @@ -2365,123 +668,8 @@ dependencies = [ "rustix", ] -[[package]] -name = "xdg-home" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec1cdab258fb55c0da61328dc52c8764709b249011b2cad0454c72f0bf10a1f6" -dependencies = [ - "libc", - "windows-sys 0.59.0", -] - [[package]] name = "xml-rs" version = "0.8.22" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "af4e2e2f7cba5a093896c1e150fbfe177d1883e7448200efb81d40b9d339ef26" - -[[package]] -name = "zbus" -version = "5.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2494e4b3f44d8363eef79a8a75fc0649efb710eef65a66b5e688a5eb4afe678a" -dependencies = [ - "async-broadcast", - "async-executor", - "async-fs", - "async-io", - "async-lock", - "async-process", - "async-recursion", - "async-task", - "async-trait", - "blocking", - "enumflags2", - "event-listener", - "futures-core", - "futures-util", - "hex", - "nix 0.29.0", - "ordered-stream", - "serde", - "serde_repr", - "static_assertions", - "tracing", - "uds_windows", - "windows-sys 0.59.0", - "winnow", - "xdg-home", - "zbus_macros", - "zbus_names", - "zvariant", -] - -[[package]] -name = "zbus_macros" -version = "5.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "445efc01929302aee95e2b25bbb62a301ea8a6369466e4278e58e7d1dfb23631" -dependencies = [ - "proc-macro-crate", - "proc-macro2", - "quote", - "syn 2.0.82", - "zbus_names", - "zvariant", - "zvariant_utils", -] - -[[package]] -name = "zbus_names" -version = "4.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "519629a3f80976d89c575895b05677cbc45eaf9f70d62a364d819ba646409cc8" -dependencies = [ - "serde", - "static_assertions", - "winnow", - "zvariant", -] - -[[package]] -name = "zvariant" -version = "5.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "55e6b9b5f1361de2d5e7d9fd1ee5f6f7fcb6060618a1f82f3472f58f2b8d4be9" -dependencies = [ - "endi", - "enumflags2", - "serde", - "static_assertions", - "winnow", - "zvariant_derive", - "zvariant_utils", -] - -[[package]] -name = "zvariant_derive" -version = "5.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "573a8dd76961957108b10f7a45bac6ab1ea3e9b7fe01aff88325dc57bb8f5c8b" -dependencies = [ - "proc-macro-crate", - "proc-macro2", - "quote", - "syn 2.0.82", - "zvariant_utils", -] - -[[package]] -name = "zvariant_utils" -version = "3.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ddd46446ea2a1f353bfda53e35f17633afa79f4fe290a611c94645c69fe96a50" -dependencies = [ - "proc-macro2", - "quote", - "serde", - "static_assertions", - "syn 2.0.82", - "winnow", -] diff --git a/render-wasm/Cargo.toml b/render-wasm/Cargo.toml index 72570a127..1968d4d6a 100644 --- a/render-wasm/Cargo.toml +++ b/render-wasm/Cargo.toml @@ -20,11 +20,13 @@ path = "src/main.rs" base64 = "0.22.1" gl = "0.14.0" indexmap = "2.7.1" -skia-safe = { version = "0.81.0", default-features = false, features = ["gl", "svg", "textlayout", "binary-cache"]} +skia-safe = { version = "0.81.0", default-features = false, features = [ + "gl", + "svg", + "textlayout", + "binary-cache", +] } uuid = { version = "1.11.0", features = ["v4"] } -[dev-dependencies] -cargo-watch = "8.5.3" - [profile.release] opt-level = "s" diff --git a/render-wasm/lint b/render-wasm/lint index 2d0cd8564..cd72c33f9 100755 --- a/render-wasm/lint +++ b/render-wasm/lint @@ -10,45 +10,30 @@ fi . ./_build_env -ALLOWED_RULES=" - -A clippy::box_collection \ - -A clippy::clone_on_copy \ - -A clippy::derivable_impls \ - -A clippy::enum_variant_names \ - -A clippy::field_reassign_with_default \ - -A clippy::from_over_into \ - -A clippy::len_zero \ - -A clippy::manual_map \ - -A clippy::map_entry \ - -A clippy::missing_safety_doc \ - -A clippy::missing_transmute_annotations \ - -A clippy::needless_borrow \ - -A clippy::needless_borrows_for_generic_args \ - -A clippy::needless_range_loop \ - -A clippy::needless_return \ - -A clippy::redundant_closure \ - -A clippy::redundant_field_names \ - -A clippy::single_match \ - -A clippy::slow_vector_initialization \ - -A clippy::too_many_arguments \ - -A clippy::unnecessary_to_owned \ - -A clippy::unused_unit \ - -A clippy::unwrap_or_default \ - -A clippy::useless_format \ - -A clippy::wrong_self_convention \ - -D static_mut_refs" +export CARGO_BUILD_TARGET=${CARGO_BUILD_TARGET:-"wasm32-unknown-emscripten"}; +export SKIA_BINARIES_URL=${SKIA_BINARIES_URL:-"https://github.com/penpot/skia-binaries/releases/download/0.81.0-3/skia-binaries-24dee32a277b6c7b5357-wasm32-unknown-emscripten-gl-svg-textlayout-binary-cache.tar.gz"} + + +ALLOWED_RULES="-D static_mut_refs" # ./lint --fix if [[ "$1" == "--fix" ]]; then cargo clippy \ --fix --allow-dirty \ --target=wasm32-unknown-emscripten \ + --all-targets \ -- -D warnings \ $ALLOWED_RULES else cargo clippy \ --target=wasm32-unknown-emscripten \ + --all-targets \ -- -D warnings \ $ALLOWED_RULES fi -popd \ No newline at end of file + +RESULT=$? + +popd + +exit $RESULT diff --git a/render-wasm/src/main.rs b/render-wasm/src/main.rs index 9e6129f72..d3534eb22 100644 --- a/render-wasm/src/main.rs +++ b/render-wasm/src/main.rs @@ -435,8 +435,7 @@ pub extern "C" fn propagate_apply() -> *mut u8 { let center = result_bound.center(); let transform = result_bound.transform_matrix().unwrap_or(Matrix::default()); - let mut bytes = Vec::::with_capacity(40); - bytes.resize(40, 0); + let mut bytes = vec![0; 40]; bytes[0..4].clone_from_slice(&width.to_le_bytes()); bytes[4..8].clone_from_slice(&height.to_le_bytes()); bytes[8..12].clone_from_slice(¢er.x.to_le_bytes()); @@ -447,8 +446,9 @@ pub extern "C" fn propagate_apply() -> *mut u8 { bytes[28..32].clone_from_slice(&transform[4].to_le_bytes()); bytes[32..36].clone_from_slice(&transform[2].to_le_bytes()); bytes[36..40].clone_from_slice(&transform[5].to_le_bytes()); - return mem::write_bytes(bytes); - }); + + mem::write_bytes(bytes) + }) } #[no_mangle] diff --git a/render-wasm/src/math.rs b/render-wasm/src/math.rs index 4f0213a62..298bc895a 100644 --- a/render-wasm/src/math.rs +++ b/render-wasm/src/math.rs @@ -64,7 +64,7 @@ impl Bounds { Self { nw, ne, se, sw } } - pub fn join_bounds(bounds: &Vec<&Bounds>) -> Self { + pub fn join_bounds(bounds: &[&Bounds]) -> Self { let (min_x, min_y, max_x, max_y) = bounds .iter() @@ -133,11 +133,13 @@ impl Bounds { self.sw = mtx.map_point(self.sw); } + // FIXME: this looks like this should be a try_from static method or similar pub fn box_bounds(&self, other: &Self) -> Option { - self.from_points(other.points()) + self.with_points(other.points()) } - pub fn from_points(&self, points: Vec) -> Option { + // FIXME: this looks like this should be a try_from static method or similar + pub fn with_points(&self, points: Vec) -> Option { let hv = self.horizontal_vec(); let vv = self.vertical_vec(); @@ -312,17 +314,17 @@ impl Bounds { // TODO: Probably we can improve performance here removing the access pub fn flip_x(&self) -> bool { - let m = self.transform_matrix().unwrap_or(Matrix::default()); + let m = self.transform_matrix().unwrap_or_default(); m.scale_x() < 0.0 } // TODO: Probably we can improve performance here removing the access pub fn flip_y(&self) -> bool { - let m = self.transform_matrix().unwrap_or(Matrix::default()); + let m = self.transform_matrix().unwrap_or_default(); m.scale_y() < 0.0 } - pub fn to_rect(&self) -> Rect { + pub fn to_rect(self) -> Rect { Rect::from_ltrb(self.min_x(), self.min_y(), self.max_x(), self.max_y()) } @@ -387,11 +389,7 @@ pub fn intersect_rays_t(ray1: &Ray, ray2: &Ray) -> Option { } pub fn intersect_rays(ray1: &Ray, ray2: &Ray) -> Option { - if let Some(t) = intersect_rays_t(ray1, ray2) { - Some(ray1.t(t)) - } else { - None - } + intersect_rays_t(ray1, ray2).map(|t| ray1.t(t)) } /* @@ -409,9 +407,7 @@ pub fn resize_matrix( let scale_height = new_height / child_bounds.height(); let center = child_bounds.center(); - let mut parent_transform = parent_bounds - .transform_matrix() - .unwrap_or(Matrix::default()); + let mut parent_transform = parent_bounds.transform_matrix().unwrap_or_default(); parent_transform.post_translate(center); parent_transform.pre_translate(-center); @@ -423,7 +419,7 @@ pub fn resize_matrix( scale.post_translate(origin); scale.post_concat(&parent_transform); scale.pre_translate(-origin); - scale.pre_concat(&parent_transform_inv); + scale.pre_concat(parent_transform_inv); result.post_concat(&scale); result } diff --git a/render-wasm/src/mem.rs b/render-wasm/src/mem.rs index 0b0edfd9c..bf5ce418b 100644 --- a/render-wasm/src/mem.rs +++ b/render-wasm/src/mem.rs @@ -4,7 +4,7 @@ use std::sync::Mutex; const LAYOUT_ALIGN: usize = 4; -static BUFFERU8: Mutex>>> = Mutex::new(None); +static BUFFERU8: Mutex>> = Mutex::new(None); #[no_mangle] pub extern "C" fn alloc_bytes(len: usize) -> *mut u8 { @@ -16,28 +16,27 @@ pub extern "C" fn alloc_bytes(len: usize) -> *mut u8 { unsafe { let layout = Layout::from_size_align_unchecked(len, LAYOUT_ALIGN); - let ptr = alloc(layout) as *mut u8; + let ptr = alloc(layout); if ptr.is_null() { panic!("Allocation failed"); } // TODO: Maybe this could be removed. ptr::write_bytes(ptr, 0, len); - *guard = Some(Box::new(Vec::from_raw_parts(ptr, len, len))); + *guard = Some(Vec::from_raw_parts(ptr, len, len)); ptr } } -pub fn write_bytes(bytes: Vec) -> *mut u8 { +pub fn write_bytes(mut bytes: Vec) -> *mut u8 { let mut guard = BUFFERU8.lock().unwrap(); if guard.is_some() { panic!("Bytes already allocated"); } - let mut new_buffer = Box::new(bytes); - let ptr = new_buffer.as_mut_ptr(); + let ptr = bytes.as_mut_ptr(); - *guard = Some(new_buffer); + *guard = Some(bytes); ptr } @@ -50,16 +49,12 @@ pub extern "C" fn free_bytes() { pub fn bytes() -> Vec { let mut guard = BUFFERU8.lock().unwrap(); - - guard - .take() - .map_or_else(|| panic!("Buffer is not initialized"), |buffer| *buffer) + guard.take().expect("Buffer is not initialized") } pub fn bytes_or_empty() -> Vec { let mut guard = BUFFERU8.lock().unwrap(); - - guard.take().map_or_else(|| Vec::new(), |buffer| *buffer) + guard.take().unwrap_or_default() } pub trait SerializableResult { @@ -77,14 +72,13 @@ pub trait SerializableResult { pub fn write_vec(result: Vec) -> *mut u8 { let elem_size = size_of::(); let bytes_len = 4 + result.len() * elem_size; - let mut result_bytes = Vec::::with_capacity(bytes_len); + let mut result_bytes = vec![0; bytes_len]; - result_bytes.resize(bytes_len, 0); result_bytes[0..4].clone_from_slice(&result.len().to_le_bytes()); - for i in 0..result.len() { + for (i, item) in result.iter().enumerate() { let base = 4 + i * elem_size; - result[i].clone_to_slice(&mut result_bytes[base..base + elem_size]); + item.clone_to_slice(&mut result_bytes[base..base + elem_size]); } write_bytes(result_bytes) diff --git a/render-wasm/src/performance.rs b/render-wasm/src/performance.rs index b19fafa0e..0d508b1b8 100644 --- a/render-wasm/src/performance.rs +++ b/render-wasm/src/performance.rs @@ -20,7 +20,7 @@ macro_rules! mark { ($name:expr) => { #[cfg(all(feature = "profile-macros", target_arch = "wasm32"))] { - use crate::run_script; + use $crate::run_script; run_script!(format!("performance.mark('{}')", $name)); } }; @@ -31,14 +31,14 @@ macro_rules! measure { ($name:expr) => { #[cfg(all(feature = "profile-macros", target_arch = "wasm32"))] { - use crate::run_script; + use $crate::run_script; run_script!(format!("performance.measure('{}')", $name)); } }; ($name:expr, $mark_begin:expr) => { #[cfg(all(feature = "profile-macros", target_arch = "wasm32"))] { - use crate::run_script; + use $crate::run_script; run_script!(format!( "performance.measure('{}','{}')", $name, $mark_begin @@ -48,7 +48,7 @@ macro_rules! measure { ($name:expr, $mark_begin:expr, $mark_end:expr) => { #[cfg(all(feature = "profile-macros", target_arch = "wasm32"))] { - use crate::run_script; + use $crate::run_script; run_script!(format!( "performance.measure('{}','{}','{}')", $name, $mark_begin, $mark_end @@ -76,7 +76,7 @@ macro_rules! measure_marks { ($name:expr) => { #[cfg(all(feature = "profile-macros", target_arch = "wasm32"))] { - use crate::{begin_mark_name, end_mark_name, measure}; + use $crate::{begin_mark_name, end_mark_name, measure}; measure!($name, begin_mark_name!($name), end_mark_name!($name)); } }; @@ -85,7 +85,7 @@ macro_rules! measure_marks { #[macro_export] macro_rules! clear_marks { () => { - use crate::run_script; + use $crate::run_script; run_script!("performance.clearMarks()"); }; ($($name:expr),*) => { @@ -96,7 +96,7 @@ macro_rules! clear_marks { #[macro_export] macro_rules! clear_measures { () => { - use crate::run_script; + use $crate::run_script; run_script!("performance.clearMeasures()"); }; ($($name:expr),*) => { @@ -109,14 +109,14 @@ macro_rules! begin_measure { ($name:expr) => { #[cfg(all(feature = "profile-macros", target_arch = "wasm32"))] { - use crate::{begin_mark_name, mark}; + use $crate::{begin_mark_name, mark}; mark!(begin_mark_name!($name)); } }; ($name:expr, $clear_marks:expr) => { #[cfg(all(feature = "profile-macros", target_arch = "wasm32"))] { - use crate::{begin_mark_name, clear_marks, end_mark_name, mark}; + use $crate::{begin_mark_name, clear_marks, end_mark_name, mark}; if $clear_marks { clear_marks!(begin_mark_name!($name), end_mark_name($name)); } @@ -130,7 +130,7 @@ macro_rules! end_measure { ($name:expr) => { #[cfg(all(feature = "profile-macros", target_arch = "wasm32"))] { - use crate::{end_mark_name, mark, measure_marks}; + use $crate::{end_mark_name, mark, measure_marks}; mark!(end_mark_name!($name)); measure_marks!($name); } @@ -138,7 +138,7 @@ macro_rules! end_measure { ($name:expr, $clear_marks:expr) => { #[cfg(all(feature = "profile-macros", target_arch = "wasm32"))] { - use crate::{begin_mark_name, clear_marks, end_mark_name, mark, measure_marks}; + use $crate::{begin_mark_name, clear_marks, end_mark_name, mark, measure_marks}; mark!(end_mark_name!($name)); measure_marks!($name); if $clear_marks { diff --git a/render-wasm/src/render.rs b/render-wasm/src/render.rs index ec78d510a..3c9d93383 100644 --- a/render-wasm/src/render.rs +++ b/render-wasm/src/render.rs @@ -343,7 +343,7 @@ impl RenderState { let mut shape = shape.clone(); if let Some(modifiers) = modifiers { - shape.apply_transform(&modifiers); + shape.apply_transform(modifiers); } let center = shape.center(); @@ -354,14 +354,14 @@ impl RenderState { match &shape.shape_type { Type::SVGRaw(sr) => { if let Some(modifiers) = modifiers { - self.surfaces.canvas(SurfaceId::Fills).concat(&modifiers); + self.surfaces.canvas(SurfaceId::Fills).concat(modifiers); } self.surfaces.canvas(SurfaceId::Fills).concat(&matrix); if let Some(svg) = shape.svg.as_ref() { svg.render(self.surfaces.canvas(SurfaceId::Fills)) } else { let font_manager = skia::FontMgr::from(self.fonts().font_provider().clone()); - let dom_result = skia::svg::Dom::from_str(sr.content.to_string(), font_manager); + let dom_result = skia::svg::Dom::from_str(&sr.content, font_manager); match dom_result { Ok(dom) => { dom.render(self.surfaces.canvas(SurfaceId::Fills)); @@ -380,7 +380,7 @@ impl RenderState { }); let text_content = text_content.new_bounds(shape.selrect()); - let paragraphs = text_content.get_skia_paragraphs(&self.fonts.font_collection()); + let paragraphs = text_content.get_skia_paragraphs(self.fonts.font_collection()); shadows::render_text_drop_shadows(self, &shape, ¶graphs, antialias); text::render(self, &shape, ¶graphs, None, None); @@ -390,9 +390,9 @@ impl RenderState { if let Fill::Image(image_fill) = &stroke.fill { image = self.images.get(&image_fill.id()).cloned(); } - let stroke_paints = shape.get_text_stroke_paint(&stroke, image.as_ref()); + let stroke_paints = shape.get_text_stroke_paint(stroke, image.as_ref()); let stroke_paragraphs = text_content - .get_skia_stroke_paragraphs(&self.fonts.font_collection(), &stroke_paints); + .get_skia_stroke_paragraphs(self.fonts.font_collection(), &stroke_paints); shadows::render_text_drop_shadows(self, &shape, &stroke_paragraphs, antialias); text::render( self, @@ -602,17 +602,14 @@ impl RenderState { // the content and the second one rendering the mask so we need to do // an extra save_layer to keep all the masked group separate from // other already drawn elements. - match element.shape_type { - Type::Group(group) => { - if group.masked { - let paint = skia::Paint::default(); - let layer_rec = skia::canvas::SaveLayerRec::default().paint(&paint); - self.surfaces - .canvas(SurfaceId::Current) - .save_layer(&layer_rec); - } + if let Type::Group(group) = element.shape_type { + if group.masked { + let paint = skia::Paint::default(); + let layer_rec = skia::canvas::SaveLayerRec::default().paint(&paint); + self.surfaces + .canvas(SurfaceId::Current) + .save_layer(&layer_rec); } - _ => {} } let mut paint = skia::Paint::default(); @@ -646,13 +643,10 @@ impl RenderState { // Because masked groups needs two rendering passes (first drawing // the content and then drawing the mask), we need to do an // extra restore. - match element.shape_type { - Type::Group(group) => { - if group.masked { - self.surfaces.canvas(SurfaceId::Current).restore(); - } + if let Type::Group(group) = element.shape_type { + if group.masked { + self.surfaces.canvas(SurfaceId::Current).restore(); } - _ => {} } } self.surfaces.canvas(SurfaceId::Current).restore(); @@ -746,39 +740,36 @@ impl RenderState { // If the shape is not in the tile set, then we update // it. - if let None = self.tiles.get_tiles_of(node_id) { + if self.tiles.get_tiles_of(node_id).is_none() { self.update_tile_for(element); } if visited_children { if !visited_mask { - match element.shape_type { - Type::Group(group) => { - // When we're dealing with masked groups we need to - // do a separate extra step to draw the mask (the last - // element of a masked group) and blend (using - // the blend mode 'destination-in') the content - // of the group and the mask. - if group.masked { + if let Type::Group(group) = element.shape_type { + // When we're dealing with masked groups we need to + // do a separate extra step to draw the mask (the last + // element of a masked group) and blend (using + // the blend mode 'destination-in') the content + // of the group and the mask. + if group.masked { + self.pending_nodes.push(NodeRenderState { + id: node_id, + visited_children: true, + clip_bounds: None, + visited_mask: true, + mask: false, + }); + if let Some(&mask_id) = element.mask_id() { self.pending_nodes.push(NodeRenderState { - id: node_id, - visited_children: true, + id: mask_id, + visited_children: false, clip_bounds: None, - visited_mask: true, - mask: false, + visited_mask: false, + mask: true, }); - if let Some(&mask_id) = element.mask_id() { - self.pending_nodes.push(NodeRenderState { - id: mask_id, - visited_children: false, - clip_bounds: None, - visited_mask: false, - mask: true, - }); - } } } - _ => {} } } self.render_shape_exit(element, visited_mask); @@ -806,7 +797,7 @@ impl RenderState { if !node_render_state.id.is_nil() { self.render_shape(element, modifiers.get(&element.id), clip_bounds); } else { - self.apply_drawing_to_render_canvas(Some(&element)); + self.apply_drawing_to_render_canvas(Some(element)); } // Set the node as visited_children before processing children @@ -815,7 +806,7 @@ impl RenderState { visited_children: true, clip_bounds: None, visited_mask: false, - mask: mask, + mask, }); if element.is_recursive() { @@ -874,7 +865,7 @@ impl RenderState { let Some(root) = tree.get(&Uuid::nil()) else { return Err(String::from("Root shape not found")); }; - let root_ids = modified_children_ids(&root, structure.get(&root.id)); + let root_ids = modified_children_ids(root, structure.get(&root.id)); // If we finish processing every node rendering is complete // let's check if there are more pending nodes @@ -912,7 +903,7 @@ impl RenderState { self.render_in_progress = false; // Cache target surface in a texture - self.cached_viewbox = self.viewbox.clone(); + self.cached_viewbox = self.viewbox; self.cached_target_snapshot = Some(self.surfaces.snapshot(SurfaceId::Cache)); if self.options.is_debug_visible() { diff --git a/render-wasm/src/render/blend.rs b/render-wasm/src/render/blend.rs index 3fb98b7f3..b54283a01 100644 --- a/render-wasm/src/render/blend.rs +++ b/render-wasm/src/render/blend.rs @@ -12,17 +12,17 @@ impl Default for BlendMode { impl From for BlendMode { fn from(value: i32) -> Self { if value <= skia::BlendMode::Luminosity as i32 { - unsafe { Self(std::mem::transmute(value)) } + unsafe { Self(std::mem::transmute::(value)) } } else { Self::default() } } } -impl Into for BlendMode { - fn into(self) -> skia::BlendMode { - match self { - Self(skia_blend) => skia_blend, +impl From for skia::BlendMode { + fn from(val: BlendMode) -> Self { + match val { + BlendMode(skia_blend) => skia_blend, } } } diff --git a/render-wasm/src/render/debug.rs b/render-wasm/src/render/debug.rs index 368ad0dbd..cf9b2b33d 100644 --- a/render-wasm/src/render/debug.rs +++ b/render-wasm/src/render/debug.rs @@ -23,7 +23,7 @@ fn render_debug_view(render_state: &mut RenderState) { paint.set_color(skia::Color::from_rgb(255, 0, 255)); paint.set_stroke_width(1.); - let rect = get_debug_rect(render_state.viewbox.area.clone()); + let rect = get_debug_rect(render_state.viewbox.area); render_state .surfaces .canvas(SurfaceId::Debug) @@ -55,7 +55,7 @@ pub fn render_wasm_label(render_state: &mut RenderState) { let p = skia::Point::new(width as f32 - 25.0 - scalar, height as f32 - 25.0); let debug_font = render_state.fonts.debug_font(); - canvas.draw_str(str, p, &debug_font, &paint); + canvas.draw_str(str, p, debug_font, &paint); } pub fn render_debug_shape(render_state: &mut RenderState, element: &Shape, intersected: bool) { @@ -90,12 +90,7 @@ pub fn render_debug_tiles_for_viewbox( let str_rect = format!("{} {} {} {}", sx, sy, ex, ey); let debug_font = render_state.fonts.debug_font(); - canvas.draw_str( - str_rect, - skia::Point::new(100.0, 150.0), - &debug_font, - &paint, - ); + canvas.draw_str(str_rect, skia::Point::new(100.0, 150.0), debug_font, &paint); } // Renders the tiles in the viewbox @@ -111,12 +106,7 @@ pub fn render_debug_viewbox_tiles(render_state: &mut RenderState) { let str_rect = format!("{} {} {} {}", sx, sy, ex, ey); let debug_font = render_state.fonts.debug_font(); - canvas.draw_str( - str_rect, - skia::Point::new(100.0, 100.0), - &debug_font, - &paint, - ); + canvas.draw_str(str_rect, skia::Point::new(100.0, 100.0), debug_font, &paint); let tile_size = tiles::get_tile_size(scale); for y in sy..=ey { @@ -131,8 +121,8 @@ pub fn render_debug_viewbox_tiles(render_state: &mut RenderState) { let p = skia::Point::new(debug_rect.x(), debug_rect.y() - 1.); let str = format!("{}:{}", x, y); let debug_font = render_state.fonts.debug_font(); - canvas.draw_str(str, p, &debug_font, &paint); - canvas.draw_rect(&debug_rect, &paint); + canvas.draw_str(str, p, debug_font, &paint); + canvas.draw_rect(debug_rect, &paint); } } } @@ -166,8 +156,8 @@ pub fn render_debug_tiles(render_state: &mut RenderState) { let str = format!("{}:{} {}", x, y, shape_count); let debug_font = render_state.fonts.debug_font(); - canvas.draw_str(str, p, &debug_font, &paint); - canvas.draw_rect(&debug_rect, &paint); + canvas.draw_str(str, p, debug_font, &paint); + canvas.draw_rect(debug_rect, &paint); } } } @@ -219,11 +209,11 @@ pub fn render_workspace_current_tile( let mut p = skia::Paint::default(); p.set_stroke_width(1.); p.set_style(skia::PaintStyle::Stroke); - canvas.draw_rect(&rect, &p); + canvas.draw_rect(rect, &p); let point = skia::Point::new(rect.x() + 10., rect.y() + 20.); p.set_stroke_width(1.); let str = format!("{prefix} {}:{}", tile.0, tile.1); let debug_font = render_state.fonts.debug_font(); - canvas.draw_str(str, point, &debug_font, &p); + canvas.draw_str(str, point, debug_font, &p); } diff --git a/render-wasm/src/render/fills.rs b/render-wasm/src/render/fills.rs index 3bdf61d33..ad508f899 100644 --- a/render-wasm/src/render/fills.rs +++ b/render-wasm/src/render/fills.rs @@ -62,7 +62,7 @@ fn draw_image_fill( corners: Some(corners), .. }) => { - let rrect: RRect = RRect::new_rect_radii(container, &corners); + let rrect: RRect = RRect::new_rect_radii(container, corners); canvas.clip_rrect(rrect, skia::ClipOp::Intersect, antialias); } Type::Rect(_) | Type::Frame(_) => { @@ -77,7 +77,7 @@ fn draw_image_fill( if let Some(path) = shape_type.path() { if let Some(path_transform) = path_transform { canvas.clip_path( - &path.to_skia_path().transform(&path_transform), + path.to_skia_path().transform(&path_transform), skia::ClipOp::Intersect, antialias, ); @@ -98,7 +98,7 @@ fn draw_image_fill( None, dest_rect, render_state.sampling_options, - &paint, + paint, ); } diff --git a/render-wasm/src/render/fonts.rs b/render-wasm/src/render/fonts.rs index 7738ca611..e21205f23 100644 --- a/render-wasm/src/render/fonts.rs +++ b/render-wasm/src/render/fonts.rs @@ -3,7 +3,7 @@ use skia_safe::{self as skia, textlayout, Font, FontMgr}; use crate::shapes::{FontFamily, FontStyle}; use crate::uuid::Uuid; -pub static DEFAULT_EMOJI_FONT: &'static str = "noto-color-emoji"; +pub static DEFAULT_EMOJI_FONT: &str = "noto-color-emoji"; const DEFAULT_FONT_BYTES: &[u8] = include_bytes!("../fonts/sourcesanspro-regular.ttf"); diff --git a/render-wasm/src/render/options.rs b/render-wasm/src/render/options.rs index fc80bf201..74fb1cf70 100644 --- a/render-wasm/src/render/options.rs +++ b/render-wasm/src/render/options.rs @@ -1,20 +1,11 @@ use crate::options; -#[derive(Debug, Copy, Clone, PartialEq)] +#[derive(Debug, Copy, Clone, PartialEq, Default)] pub struct RenderOptions { pub flags: u32, pub dpr: Option, } -impl Default for RenderOptions { - fn default() -> Self { - Self { - flags: 0x00, - dpr: None, - } - } -} - impl RenderOptions { pub fn is_debug_visible(&self) -> bool { self.flags & options::DEBUG_VISIBLE == options::DEBUG_VISIBLE diff --git a/render-wasm/src/render/shadows.rs b/render-wasm/src/render/shadows.rs index 5f4b80a3d..d5819c8d7 100644 --- a/render-wasm/src/render/shadows.rs +++ b/render-wasm/src/render/shadows.rs @@ -8,7 +8,7 @@ use skia_safe::{textlayout::Paragraph, Paint}; pub fn render_fill_drop_shadows(render_state: &mut RenderState, shape: &Shape, antialias: bool) { if shape.has_fills() { for shadow in shape.drop_shadows().rev().filter(|s| !s.hidden()) { - render_fill_drop_shadow(render_state, &shape, &shadow, antialias); + render_fill_drop_shadow(render_state, shape, shadow, antialias); } } } @@ -26,7 +26,7 @@ fn render_fill_drop_shadow( pub fn render_fill_inner_shadows(render_state: &mut RenderState, shape: &Shape, antialias: bool) { if shape.has_fills() { for shadow in shape.inner_shadows().rev().filter(|s| !s.hidden()) { - render_fill_inner_shadow(render_state, &shape, &shadow, antialias); + render_fill_inner_shadow(render_state, shape, shadow, antialias); } } } @@ -52,7 +52,7 @@ pub fn render_stroke_drop_shadows( let filter = shadow.get_drop_shadow_filter(); strokes::render( render_state, - &shape, + shape, stroke, Some(SurfaceId::Strokes), // FIXME filter.as_ref(), @@ -73,7 +73,7 @@ pub fn render_stroke_inner_shadows( let filter = shadow.get_inner_shadow_filter(); strokes::render( render_state, - &shape, + shape, stroke, Some(SurfaceId::Strokes), // FIXME filter.as_ref(), @@ -90,7 +90,7 @@ pub fn render_text_drop_shadows( antialias: bool, ) { for shadow in shape.drop_shadows().rev().filter(|s| !s.hidden()) { - render_text_drop_shadow(render_state, &shape, &shadow, ¶graphs, antialias); + render_text_drop_shadow(render_state, shape, shadow, paragraphs, antialias); } } @@ -101,12 +101,12 @@ pub fn render_text_drop_shadow( paragraphs: &[Vec], antialias: bool, ) { - let paint = &shadow.get_drop_shadow_paint(antialias); + let paint = shadow.get_drop_shadow_paint(antialias); text::render( render_state, shape, - ¶graphs, + paragraphs, Some(SurfaceId::DropShadows), Some(paint), ); @@ -119,7 +119,7 @@ pub fn render_text_inner_shadows( antialias: bool, ) { for shadow in shape.inner_shadows().rev().filter(|s| !s.hidden()) { - render_text_inner_shadow(render_state, &shape, &shadow, ¶graphs, antialias); + render_text_inner_shadow(render_state, shape, shadow, paragraphs, antialias); } } @@ -130,12 +130,12 @@ pub fn render_text_inner_shadow( paragraphs: &[Vec], antialias: bool, ) { - let paint = &shadow.get_inner_shadow_paint(antialias); + let paint = shadow.get_inner_shadow_paint(antialias); text::render( render_state, shape, - ¶graphs, + paragraphs, Some(SurfaceId::InnerShadows), Some(paint), ); diff --git a/render-wasm/src/render/strokes.rs b/render-wasm/src/render/strokes.rs index b906685ec..36748a8df 100644 --- a/render-wasm/src/render/strokes.rs +++ b/render-wasm/src/render/strokes.rs @@ -7,6 +7,8 @@ use skia_safe::{self as skia, ImageFilter, RRect}; use super::{RenderState, SurfaceId}; +// FIXME: See if we can simplify these arguments +#[allow(clippy::too_many_arguments)] fn draw_stroke_on_rect( canvas: &skia::Canvas, stroke: &Stroke, @@ -36,11 +38,13 @@ fn draw_stroke_on_rect( canvas.draw_rrect(rrect, &paint); } None => { - canvas.draw_rect(&stroke_rect, &paint); + canvas.draw_rect(stroke_rect, &paint); } } } +// FIXME: See if we can simplify these arguments +#[allow(clippy::too_many_arguments)] fn draw_stroke_on_circle( canvas: &skia::Canvas, stroke: &Stroke, @@ -62,9 +66,11 @@ fn draw_stroke_on_circle( paint.set_image_filter(filter.clone()); } - canvas.draw_oval(&stroke_rect, &paint); + canvas.draw_oval(stroke_rect, &paint); } +// FIXME: See if we can simplify these arguments +#[allow(clippy::too_many_arguments)] pub fn draw_stroke_on_path( canvas: &skia::Canvas, stroke: &Stroke, @@ -90,18 +96,18 @@ pub fn draw_stroke_on_path( // Draw the different kind of strokes for a path requires different strategies: match stroke.render_kind(is_open) { // For inner stroke we draw a center stroke (with double width) and clip to the original path (that way the extra outer stroke is removed) - StrokeKind::InnerStroke => { + StrokeKind::Inner => { canvas.save(); // As we are using clear for surfaces we use save and restore here to still be able to clean the full surface canvas.clip_path(&skia_path, skia::ClipOp::Intersect, antialias); canvas.draw_path(&skia_path, &paint); canvas.restore(); } // For center stroke we don't need to do anything extra - StrokeKind::CenterStroke => { + StrokeKind::Center => { canvas.draw_path(&skia_path, &paint); } // For outer stroke we draw a center stroke (with double width) and use another path with blend mode clear to remove the inner stroke added - StrokeKind::OuterStroke => { + StrokeKind::Outer => { let mut outer_paint = skia::Paint::default(); outer_paint.set_blend_mode(skia::BlendMode::SrcOver); outer_paint.set_anti_alias(antialias); @@ -121,7 +127,7 @@ pub fn draw_stroke_on_path( handle_stroke_caps( &mut skia_path, stroke, - &selrect, + selrect, canvas, is_open, svg_attrs, @@ -144,31 +150,33 @@ fn handle_stroke_cap( StrokeCap::None => {} StrokeCap::Line => { // We also draw this square cap to fill the gap between the path and the arrow - draw_square_cap(canvas, &paint, p1, p2, width, 0.); + draw_square_cap(canvas, paint, p1, p2, width, 0.); paint.set_style(skia::PaintStyle::Stroke); - draw_arrow_cap(canvas, &paint, p1, p2, width * 4.); + draw_arrow_cap(canvas, paint, p1, p2, width * 4.); } StrokeCap::Triangle => { - draw_triangle_cap(canvas, &paint, p1, p2, width * 4.); + draw_triangle_cap(canvas, paint, p1, p2, width * 4.); } StrokeCap::Rectangle => { - draw_square_cap(canvas, &paint, p1, p2, width * 4., 0.); + draw_square_cap(canvas, paint, p1, p2, width * 4., 0.); } StrokeCap::Circle => { - canvas.draw_circle((p1.x, p1.y), width * 2., &paint); + canvas.draw_circle((p1.x, p1.y), width * 2., paint); } StrokeCap::Diamond => { - draw_square_cap(canvas, &paint, p1, p2, width * 4., 45.); + draw_square_cap(canvas, paint, p1, p2, width * 4., 45.); } StrokeCap::Round => { - canvas.draw_circle((p1.x, p1.y), width / 2.0, &paint); + canvas.draw_circle((p1.x, p1.y), width / 2.0, paint); } StrokeCap::Square => { - draw_square_cap(canvas, &paint, p1, p2, width, 0.); + draw_square_cap(canvas, paint, p1, p2, width, 0.); } } } +// FIXME: See if we can simplify these arguments +#[allow(clippy::too_many_arguments)] fn handle_stroke_caps( path: &mut skia::Path, stroke: &Stroke, @@ -238,7 +246,7 @@ fn draw_square_cap( Point::new(rect.left(), rect.bottom()), ]; - let mut transformed_points = points.clone(); + let mut transformed_points = points; matrix.map_points(&mut transformed_points, &points); let mut path = skia::Path::new(); @@ -272,7 +280,7 @@ fn draw_arrow_cap( Point::new(center.x + size, center.y + half_height), ]; - let mut transformed_points = points.clone(); + let mut transformed_points = points; matrix.map_points(&mut transformed_points, &points); let mut path = skia::Path::new(); @@ -306,7 +314,7 @@ fn draw_triangle_cap( Point::new(center.x + size, center.y + half_height), ]; - let mut transformed_points = points.clone(); + let mut transformed_points = points; matrix.map_points(&mut transformed_points, &points); let mut path = skia::Path::new(); @@ -406,11 +414,11 @@ fn draw_image_stroke_in_container( path.transform(&path_transform.unwrap()); let stroke_kind = stroke.render_kind(p.is_open()); match stroke_kind { - StrokeKind::InnerStroke => { + StrokeKind::Inner => { canvas.clip_path(&path, skia::ClipOp::Intersect, antialias); } - StrokeKind::CenterStroke => {} - StrokeKind::OuterStroke => { + StrokeKind::Center => {} + StrokeKind::Outer => { canvas.clip_path(&path, skia::ClipOp::Difference, antialias); } } @@ -418,7 +426,7 @@ fn draw_image_stroke_in_container( let mut paint = stroke.to_stroked_paint(is_open, &outer_rect, svg_attrs, scale, antialias); canvas.draw_path(&path, &paint); - if stroke.render_kind(is_open) == StrokeKind::OuterStroke { + if stroke.render_kind(is_open) == StrokeKind::Outer { // Small extra inner stroke to overlap with the fill // and avoid unnecesary artifacts. paint.set_stroke_width(1. / scale); @@ -461,7 +469,7 @@ fn draw_image_stroke_in_container( // Clear outer stroke for paths if necessary. When adding an outer stroke we need to empty the stroke added too in the inner area. if let Type::Path(p) = &shape.shape_type { - if stroke.render_kind(p.is_open()) == StrokeKind::OuterStroke { + if stroke.render_kind(p.is_open()) == StrokeKind::Outer { let mut path = p.to_skia_path(); path.transform(&path_transform.unwrap()); let mut clear_paint = skia::Paint::default(); @@ -494,7 +502,7 @@ pub fn render( let path_transform = shape.to_path_transform(); let svg_attrs = &shape.svg_attrs; - if !shadow.is_some() && matches!(stroke.fill, Fill::Image(_)) { + if shadow.is_none() && matches!(stroke.fill, Fill::Image(_)) { if let Fill::Image(image_fill) = &stroke.fill { draw_image_stroke_in_container(render_state, shape, stroke, image_fill, antialias); } diff --git a/render-wasm/src/render/surfaces.rs b/render-wasm/src/render/surfaces.rs index 61589419d..5e4204ec0 100644 --- a/render-wasm/src/render/surfaces.rs +++ b/render-wasm/src/render/surfaces.rs @@ -105,7 +105,7 @@ impl Surfaces { let encoded_image = image .encode(context.as_mut(), skia::EncodedImageFormat::PNG, None) .unwrap(); - general_purpose::STANDARD.encode(&encoded_image.as_bytes()) + general_purpose::STANDARD.encode(encoded_image.as_bytes()) } pub fn base64_snapshot_rect(&mut self, id: SurfaceId, irect: skia::IRect) -> Option { @@ -115,7 +115,7 @@ impl Surfaces { let encoded_image = image .encode(context.as_mut(), skia::EncodedImageFormat::PNG, None) .unwrap(); - return Some(general_purpose::STANDARD.encode(&encoded_image.as_bytes())); + return Some(general_purpose::STANDARD.encode(encoded_image.as_bytes())); } None } @@ -137,7 +137,7 @@ impl Surfaces { .draw(self.canvas(to), (0.0, 0.0), sampling_options, paint); } - pub fn apply_mut(&mut self, ids: &[SurfaceId], mut f: impl FnMut(&mut skia::Surface) -> ()) { + pub fn apply_mut(&mut self, ids: &[SurfaceId], mut f: impl FnMut(&mut skia::Surface)) { for id in ids { let surface = self.get_mut(*id); f(surface); @@ -257,10 +257,10 @@ impl Surfaces { self.current.height() - TILE_SIZE_MULTIPLIER * self.margins.height, ); - if let Some(snapshot) = self.current.image_snapshot_with_bounds(&rect) { + if let Some(snapshot) = self.current.image_snapshot_with_bounds(rect) { self.tiles.add(tile, snapshot.clone()); self.cache.canvas().draw_image_rect( - &snapshot.clone(), + snapshot.clone(), None, tile_rect, &skia::Paint::default(), @@ -302,7 +302,7 @@ impl TileTextureCache { } pub fn has(&mut self, tile: Tile) -> bool { - return self.grid.contains_key(&tile); + self.grid.contains_key(&tile) } fn remove_list(&mut self, marked: Vec) { @@ -318,7 +318,7 @@ impl TileTextureCache { .iter_mut() .filter_map(|(tile, _)| { if !self.visited.contains_key(tile) { - Some(tile.clone()) + Some(*tile) } else { None } diff --git a/render-wasm/src/render/text.rs b/render-wasm/src/render/text.rs index a52e13c66..0bec6887d 100644 --- a/render-wasm/src/render/text.rs +++ b/render-wasm/src/render/text.rs @@ -1,15 +1,15 @@ use super::{RenderState, Shape, SurfaceId}; -use skia_safe::{self as skia, canvas::SaveLayerRec, paint, textlayout::Paragraph}; +use skia_safe::{self as skia, canvas::SaveLayerRec, textlayout::Paragraph}; pub fn render( render_state: &mut RenderState, shape: &Shape, paragraphs: &[Vec], surface_id: Option, - paint: Option<&paint::Paint>, + paint: Option, ) { - let default_paint = skia::Paint::default(); - let mask = SaveLayerRec::default().paint(&paint.unwrap_or(&default_paint)); + let mask_paint = paint.unwrap_or_default(); + let mask = SaveLayerRec::default().paint(&mask_paint); let canvas = render_state .surfaces .canvas(surface_id.unwrap_or(SurfaceId::Fills)); diff --git a/render-wasm/src/render/tiles.rs b/render-wasm/src/render/tiles.rs index 7895cc138..3bac5bb3b 100644 --- a/render-wasm/src/render/tiles.rs +++ b/render-wasm/src/render/tiles.rs @@ -74,7 +74,7 @@ impl TileHashMap { } pub fn get_shapes_at(&mut self, tile: Tile) -> Option<&IndexSet> { - return self.grid.get(&tile); + self.grid.get(&tile) } pub fn remove_shape_at(&mut self, tile: Tile, id: Uuid) { @@ -92,13 +92,8 @@ impl TileHashMap { } pub fn add_shape_at(&mut self, tile: Tile, shape_id: Uuid) { - if !self.grid.contains_key(&tile) { - self.grid.insert(tile, IndexSet::new()); - } - - if !self.index.contains_key(&shape_id) { - self.index.insert(shape_id, HashSet::new()); - } + self.grid.entry(tile).or_default(); + self.index.entry(shape_id).or_default(); let tile_set = self.grid.get_mut(&tile).unwrap(); tile_set.insert(shape_id); diff --git a/render-wasm/src/shapes.rs b/render-wasm/src/shapes.rs index 036a76944..45ff3bb13 100644 --- a/render-wasm/src/shapes.rs +++ b/render-wasm/src/shapes.rs @@ -224,30 +224,25 @@ impl Shape { } pub fn has_layout(&self) -> bool { - match self.shape_type { + matches!( + self.shape_type, Type::Frame(Frame { - layout: Some(_), .. - }) => true, - _ => false, - } + layout: Some(_), + .. + }) + ) } pub fn set_selrect(&mut self, left: f32, top: f32, right: f32, bottom: f32) { self.selrect.set_ltrb(left, top, right, bottom); - match self.shape_type { - Type::Text(ref mut text) => { - text.set_xywh(left, top, right - left, bottom - top); - } - _ => {} + if let Type::Text(ref mut text) = self.shape_type { + text.set_xywh(left, top, right - left, bottom - top); } } pub fn set_masked(&mut self, masked: bool) { - match &mut self.shape_type { - Type::Group(data) => { - data.masked = masked; - } - _ => {} + if let Type::Group(data) = &mut self.shape_type { + data.masked = masked; } } @@ -272,7 +267,7 @@ impl Shape { } pub fn constraint_h(&self, default: ConstraintH) -> ConstraintH { - self.constraint_h.clone().unwrap_or(default) + self.constraint_h.unwrap_or(default) } pub fn set_constraint_v(&mut self, constraint: Option) { @@ -280,13 +275,15 @@ impl Shape { } pub fn constraint_v(&self, default: ConstraintV) -> ConstraintV { - self.constraint_v.clone().unwrap_or(default) + self.constraint_v.unwrap_or(default) } pub fn set_hidden(&mut self, value: bool) { self.hidden = value; } + // FIXME: These arguments could be grouped or simplified + #[allow(clippy::too_many_arguments)] pub fn set_flex_layout_child_data( &mut self, margin_top: f32, @@ -320,6 +317,8 @@ impl Shape { }); } + // FIXME: These arguments could be grouped or simplified + #[allow(clippy::too_many_arguments)] pub fn set_flex_layout_data( &mut self, direction: FlexDirection, @@ -335,32 +334,31 @@ impl Shape { padding_bottom: f32, padding_left: f32, ) { - match &mut self.shape_type { - Type::Frame(data) => { - let layout_data = LayoutData { - align_items, - align_content, - justify_items, - justify_content, - padding_top, - padding_right, - padding_bottom, - padding_left, - row_gap, - column_gap, - }; + if let Type::Frame(data) = &mut self.shape_type { + let layout_data = LayoutData { + align_items, + align_content, + justify_items, + justify_content, + padding_top, + padding_right, + padding_bottom, + padding_left, + row_gap, + column_gap, + }; - let flex_data = FlexData { - direction, - wrap_type, - }; + let flex_data = FlexData { + direction, + wrap_type, + }; - data.layout = Some(Layout::FlexLayout(layout_data, flex_data)); - } - _ => {} + data.layout = Some(Layout::FlexLayout(layout_data, flex_data)); } } + // FIXME: These arguments could be grouped or simplified + #[allow(clippy::too_many_arguments)] pub fn set_grid_layout_data( &mut self, direction: GridDirection, @@ -375,26 +373,23 @@ impl Shape { padding_bottom: f32, padding_left: f32, ) { - match &mut self.shape_type { - Type::Frame(data) => { - let layout_data = LayoutData { - align_items, - align_content, - justify_items, - justify_content, - padding_top, - padding_right, - padding_bottom, - padding_left, - row_gap, - column_gap, - }; + if let Type::Frame(data) = &mut self.shape_type { + let layout_data = LayoutData { + align_items, + align_content, + justify_items, + justify_content, + padding_top, + padding_right, + padding_bottom, + padding_left, + row_gap, + column_gap, + }; - let mut grid_data = GridData::default(); - grid_data.direction = direction; - data.layout = Some(Layout::GridLayout(layout_data, grid_data)); - } - _ => {} + let mut grid_data = GridData::default(); + grid_data.direction = direction; + data.layout = Some(Layout::GridLayout(layout_data, grid_data)); } } @@ -578,7 +573,7 @@ impl Shape { ); let center = self.center(); - let mut matrix = self.transform.clone(); + let mut matrix = self.transform; matrix.post_translate(center); matrix.pre_translate(-center); @@ -595,7 +590,7 @@ impl Shape { let mut rect = self.bounds().to_rect(); for shadow in self.shadows.iter() { let (x, y) = shadow.offset; - let mut shadow_rect = rect.clone(); + let mut shadow_rect = rect; shadow_rect.left += x; shadow_rect.right += x; shadow_rect.top += y; @@ -717,12 +712,9 @@ impl Shape { } pub fn clear_text(&mut self) { - match &self.shape_type { - Type::Text(old_text_content) => { - let new_text_content = TextContent::new(self.selrect, old_text_content.grow_type()); - self.shape_type = Type::Text(new_text_content); - } - _ => {} + if let Type::Text(old_text_content) = &self.shape_type { + let new_text_content = TextContent::new(self.selrect, old_text_content.grow_type()); + self.shape_type = Type::Text(new_text_content); } } @@ -745,8 +737,8 @@ impl Shape { let mut center = self.selrect.center(); center = transform.map_point(center); - let bounds = self.bounds().transform(&transform); - self.transform = bounds.transform_matrix().unwrap_or(Matrix::default()); + let bounds = self.bounds().transform(transform); + self.transform = bounds.transform_matrix().unwrap_or_default(); let width = bounds.width(); let height = bounds.height(); @@ -761,14 +753,11 @@ impl Shape { } pub fn apply_transform(&mut self, transform: &Matrix) { - self.transform_selrect(&transform); - match &mut self.shape_type { - shape_type @ (Type::Path(_) | Type::Bool(_)) => { - if let Some(path) = shape_type.path_mut() { - path.transform(&transform); - } + self.transform_selrect(transform); + if let shape_type @ (Type::Path(_) | Type::Bool(_)) = &mut self.shape_type { + if let Some(path) = shape_type.path_mut() { + path.transform(transform); } - _ => {} } } @@ -852,7 +841,7 @@ impl Shape { let mut paints = Vec::new(); match stroke.kind { - StrokeKind::InnerStroke => { + StrokeKind::Inner => { let mut paint = skia::Paint::default(); paint.set_blend_mode(skia::BlendMode::DstOver); paint.set_anti_alias(true); @@ -868,7 +857,7 @@ impl Shape { paints.push(paint); } - StrokeKind::CenterStroke => { + StrokeKind::Center => { let mut paint = skia::Paint::default(); paint.set_style(skia::PaintStyle::Stroke); paint.set_anti_alias(true); @@ -878,7 +867,7 @@ impl Shape { paints.push(paint); } - StrokeKind::OuterStroke => { + StrokeKind::Outer => { let mut paint = skia::Paint::default(); paint.set_style(skia::PaintStyle::Stroke); paint.set_blend_mode(skia::BlendMode::DstOver); @@ -908,7 +897,7 @@ pub fn modified_children_ids( structure: Option<&Vec>, ) -> IndexSet { if let Some(structure) = structure { - let mut result: Vec = Vec::from_iter(element.children_ids().iter().map(|id| *id)); + let mut result: Vec = Vec::from_iter(element.children_ids().iter().copied()); let mut to_remove = HashSet::<&Uuid>::new(); for st in structure { @@ -925,7 +914,7 @@ pub fn modified_children_ids( let ret: IndexSet = result .iter() .filter(|id| !to_remove.contains(id)) - .map(|id| *id) + .copied() .collect(); ret @@ -949,7 +938,7 @@ mod tests { shape.add_fill(Fill::Solid(SolidColor(Color::TRANSPARENT))); assert_eq!( - shape.fills.get(0), + shape.fills.first(), Some(&Fill::Solid(SolidColor(Color::TRANSPARENT))) ) } @@ -969,7 +958,7 @@ mod tests { ]) ); } else { - assert!(false); + unreachable!(); } } @@ -980,9 +969,9 @@ mod tests { shape.set_masked(true); if let Type::Group(Group { masked, .. }) = shape.shape_type { - assert_eq!(masked, true); + assert!(masked); } else { - assert!(false); + unreachable!() } } diff --git a/render-wasm/src/shapes/layouts.rs b/render-wasm/src/shapes/layouts.rs index b6fea8b85..fd9fc9a84 100644 --- a/render-wasm/src/shapes/layouts.rs +++ b/render-wasm/src/shapes/layouts.rs @@ -312,26 +312,23 @@ pub struct FlexData { impl FlexData { pub fn is_reverse(&self) -> bool { - match &self.direction { - FlexDirection::RowReverse | FlexDirection::ColumnReverse => true, - _ => false, - } + matches!( + &self.direction, + FlexDirection::RowReverse | FlexDirection::ColumnReverse + ) } pub fn is_row(&self) -> bool { - match &self.direction { - FlexDirection::RowReverse | FlexDirection::Row => true, - _ => false, - } + matches!( + &self.direction, + FlexDirection::RowReverse | FlexDirection::Row + ) } } impl FlexData { pub fn is_wrap(&self) -> bool { - match self.wrap_type { - WrapType::Wrap => true, - _ => false, - } + matches!(self.wrap_type, WrapType::Wrap) } } diff --git a/render-wasm/src/shapes/modifiers.rs b/render-wasm/src/shapes/modifiers.rs index d7cf4af1d..a1d5cd00d 100644 --- a/render-wasm/src/shapes/modifiers.rs +++ b/render-wasm/src/shapes/modifiers.rs @@ -25,7 +25,7 @@ fn propagate_children( ) -> VecDeque { let children_ids = modified_children_ids(shape, structure.get(&shape.id)); - if children_ids.len() == 0 || identitish(transform) { + if children_ids.is_empty() || identitish(transform) { return VecDeque::new(); } @@ -67,8 +67,8 @@ fn propagate_children( }; let transform = constraints::propagate_shape_constraints( - &parent_bounds_before, - &parent_bounds_after, + parent_bounds_before, + parent_bounds_after, &child_bounds, constraint_h, constraint_v, @@ -87,7 +87,7 @@ fn calculate_group_bounds( bounds: &HashMap, structure: &HashMap>, ) -> Option { - let shape_bounds = bounds.find(&shape); + let shape_bounds = bounds.find(shape); let mut result = Vec::::new(); let children_ids = modified_children_ids(shape, structure.get(&shape.id)); @@ -100,12 +100,12 @@ fn calculate_group_bounds( result.append(&mut child_bounds.points()); } - shape_bounds.from_points(result) + shape_bounds.with_points(result) } pub fn propagate_modifiers( state: &State, - modifiers: &Vec, + modifiers: &[TransformEntry], ) -> (Vec, HashMap) { let shapes = &state.shapes; @@ -115,7 +115,7 @@ pub fn propagate_modifiers( .map(|entry| Modifier::Transform(entry.clone())) .collect(); - for (id, _) in &state.structure { + for id in state.structure.keys() { if id != &Uuid::nil() { entries.push_back(Modifier::Reflow(*id)); } @@ -140,7 +140,7 @@ pub fn propagate_modifiers( continue; }; - let shape_bounds_before = bounds.find(&shape); + let shape_bounds_before = bounds.find(shape); let mut shape_bounds_after = shape_bounds_before.transform(&entry.transform); let mut transform = entry.transform; @@ -176,9 +176,7 @@ pub fn propagate_modifiers( bounds.insert(shape.id, shape_bounds_after); - let default_matrix = Matrix::default(); - let mut shape_modif = - modifiers.get(&shape.id).unwrap_or(&default_matrix).clone(); + let mut shape_modif = modifiers.get(&shape.id).copied().unwrap_or_default(); shape_modif.post_concat(&transform); modifiers.insert(shape.id, shape_modif); @@ -230,7 +228,7 @@ pub fn propagate_modifiers( let children_ids = modified_children_ids(shape, state.structure.get(&shape.id)); if let Some(child) = shapes.get(&children_ids[0]) { - let child_bounds = bounds.find(&child); + let child_bounds = bounds.find(child); bounds.insert(shape.id, child_bounds); reflow_parent = true; } @@ -269,11 +267,11 @@ pub fn propagate_modifiers( } for id in layout_reflows.iter() { - if reflown.contains(&id) { + if reflown.contains(id) { continue; } - let Some(shape) = state.shapes.get(&id) else { + let Some(shape) = state.shapes.get(id) else { continue; }; diff --git a/render-wasm/src/shapes/modifiers/common.rs b/render-wasm/src/shapes/modifiers/common.rs index 8b071ee54..475e8812f 100644 --- a/render-wasm/src/shapes/modifiers/common.rs +++ b/render-wasm/src/shapes/modifiers/common.rs @@ -10,8 +10,6 @@ pub trait GetBounds { impl GetBounds for HashMap { fn find(&self, shape: &Shape) -> Bounds { - self.get(&shape.id) - .map(|b| b.clone()) - .unwrap_or(shape.bounds()) + self.get(&shape.id).copied().unwrap_or(shape.bounds()) } } diff --git a/render-wasm/src/shapes/modifiers/constraints.rs b/render-wasm/src/shapes/modifiers/constraints.rs index ae59cf8cd..f38b5daf8 100644 --- a/render-wasm/src/shapes/modifiers/constraints.rs +++ b/render-wasm/src/shapes/modifiers/constraints.rs @@ -120,16 +120,14 @@ pub fn propagate_shape_constraints( if let Some((scale_width, scale_height)) = calculate_resize( constraint_h, constraint_v, - &parent_bounds_before, - &parent_bounds_after, - &child_bounds_before, + parent_bounds_before, + parent_bounds_after, + child_bounds_before, &child_bounds_after, ) { let center = child_bounds_before.center(); - let mut parent_transform = parent_bounds_after - .transform_matrix() - .unwrap_or(Matrix::default()); + let mut parent_transform = parent_bounds_after.transform_matrix().unwrap_or_default(); parent_transform.post_translate(center); parent_transform.pre_translate(-center); @@ -140,7 +138,7 @@ pub fn propagate_shape_constraints( scale.post_translate(origin); scale.post_concat(&parent_transform); scale.pre_translate(-origin); - scale.pre_concat(&parent_transform_inv); + scale.pre_concat(parent_transform_inv); child_bounds_after.transform_mut(&scale); transform.post_concat(&scale); @@ -150,9 +148,9 @@ pub fn propagate_shape_constraints( if let Some((delta_x, delta_y)) = calculate_displacement( constraint_h, constraint_v, - &parent_bounds_before, - &parent_bounds_after, - &child_bounds_before, + parent_bounds_before, + parent_bounds_after, + child_bounds_before, &child_bounds_after, ) { let th = parent_bounds_after.hv(delta_x); diff --git a/render-wasm/src/shapes/modifiers/flex_layout.rs b/render-wasm/src/shapes/modifiers/flex_layout.rs index 93a34cb0a..2dcccda1d 100644 --- a/render-wasm/src/shapes/modifiers/flex_layout.rs +++ b/render-wasm/src/shapes/modifiers/flex_layout.rs @@ -141,7 +141,7 @@ impl ChildAxis { is_fill_main: child.is_layout_horizontal_fill(), is_fill_across: child.is_layout_vertical_fill(), z_index: layout_item.map(|i| i.z_index).unwrap_or(0), - bounds: child_bounds.clone(), + bounds: *child_bounds, } } else { Self { @@ -159,7 +159,7 @@ impl ChildAxis { is_fill_main: child.is_layout_vertical_fill(), is_fill_across: child.is_layout_horizontal_fill(), z_index: layout_item.map(|i| i.z_index).unwrap_or(0), - bounds: child_bounds.clone(), + bounds: *child_bounds, } }; @@ -267,7 +267,7 @@ fn initialize_tracks( } // Resize main axis fill -fn distribute_fill_main_space(layout_axis: &LayoutAxis, tracks: &mut Vec) { +fn distribute_fill_main_space(layout_axis: &LayoutAxis, tracks: &mut [TrackData]) { for track in tracks.iter_mut() { let mut left_space = layout_axis.main_space() - track.main_size; let mut to_resize_children: Vec<&mut ChildAxis> = Vec::new(); @@ -284,9 +284,9 @@ fn distribute_fill_main_space(layout_axis: &LayoutAxis, tracks: &mut Vec) { +fn distribute_fill_across_space(layout_axis: &LayoutAxis, tracks: &mut [TrackData]) { let total_across_size = tracks.iter().map(|t| t.across_size).sum::() + (tracks.len() - 1) as f32 * layout_axis.gap_across; let mut left_space = layout_axis.across_space() - total_across_size; @@ -314,8 +314,8 @@ fn distribute_fill_across_space(layout_axis: &LayoutAxis, tracks: &mut Vec, + tracks: &mut [TrackData], total_across_size: f32, ) { let total_across_size = total_across_size + (tracks.len() - 1) as f32 * layout_axis.gap_across; @@ -350,7 +350,7 @@ fn stretch_tracks_sizes( let delta = left_space / tracks.len() as f32; for track in tracks.iter_mut() { - track.across_size = track.across_size + delta; + track.across_size += delta; } } @@ -358,7 +358,7 @@ fn calculate_track_positions( layout_data: &LayoutData, layout_axis: &LayoutAxis, layout_bounds: &Bounds, - tracks: &mut Vec, + tracks: &mut [TrackData], total_across_size: f32, ) { let mut align_content = &layout_data.align_content; @@ -411,7 +411,7 @@ fn calculate_track_positions( for track in tracks.iter_mut() { track.anchor = next_anchor; - next_anchor = next_anchor + layout_axis.across_v * real_gap; + next_anchor += layout_axis.across_v * real_gap; } } @@ -450,7 +450,7 @@ fn calculate_track_data( } calculate_track_positions( - &layout_data, + layout_data, &layout_axis, layout_bounds, &mut tracks, @@ -556,7 +556,7 @@ pub fn reflow_flex_layout( structure: &HashMap>, ) -> VecDeque { let mut result = VecDeque::new(); - let layout_bounds = &bounds.find(&shape); + let layout_bounds = &bounds.find(shape); let layout_axis = LayoutAxis::new(shape, layout_bounds, layout_data, flex_data); let tracks = calculate_track_data( shape, @@ -570,7 +570,7 @@ pub fn reflow_flex_layout( for track in tracks.iter() { let total_shapes_size = track.shapes.iter().map(|s| s.main_size).sum::(); - let mut shape_anchor = first_anchor(&layout_data, &layout_axis, track, total_shapes_size); + let mut shape_anchor = first_anchor(layout_data, &layout_axis, track, total_shapes_size); for child_axis in track.shapes.iter() { let child_id = child_axis.id; @@ -602,7 +602,7 @@ pub fn reflow_flex_layout( { transform.post_concat(&math::resize_matrix( layout_bounds, - &child_bounds, + child_bounds, new_width, new_height, )); @@ -615,10 +615,10 @@ pub fn reflow_flex_layout( result.push_back(Modifier::transform(child.id, transform)); shape_anchor = next_anchor( - &layout_data, + layout_data, &layout_axis, - &child_axis, - &track, + child_axis, + track, shape_anchor, total_shapes_size, ); @@ -681,9 +681,7 @@ pub fn reflow_flex_layout( ) }; - let parent_transform = layout_bounds - .transform_matrix() - .unwrap_or(Matrix::default()); + let parent_transform = layout_bounds.transform_matrix().unwrap_or_default(); let parent_transform_inv = &parent_transform.invert().unwrap(); let origin = parent_transform_inv.map_point(layout_bounds.nw); @@ -692,7 +690,7 @@ pub fn reflow_flex_layout( scale.post_translate(origin); scale.post_concat(&parent_transform); scale.pre_translate(-origin); - scale.pre_concat(&parent_transform_inv); + scale.pre_concat(parent_transform_inv); let layout_bounds_after = layout_bounds.transform(&scale); result.push_back(Modifier::parent(shape.id, scale)); diff --git a/render-wasm/src/shapes/modifiers/grid_layout.rs b/render-wasm/src/shapes/modifiers/grid_layout.rs index 496d038e2..92aeda55a 100644 --- a/render-wasm/src/shapes/modifiers/grid_layout.rs +++ b/render-wasm/src/shapes/modifiers/grid_layout.rs @@ -33,6 +33,8 @@ struct TrackData { anchor_end: Point, } +// FIXME: We might be able to simplify these arguments +#[allow(clippy::too_many_arguments)] fn calculate_tracks( is_column: bool, shape: &Shape, @@ -61,11 +63,12 @@ fn calculate_tracks( set_flex_multi_span(is_column, &mut tracks, cells, shapes, bounds); set_fr_value(is_column, shape, layout_data, &mut tracks, layout_size); stretch_tracks(is_column, shape, layout_data, &mut tracks, layout_size); - assign_anchors(is_column, layout_data, &layout_bounds, &mut tracks); - return tracks; + assign_anchors(is_column, layout_data, layout_bounds, &mut tracks); + + tracks } -fn init_tracks(track: &Vec, size: f32) -> Vec { +fn init_tracks(track: &[GridTrack], size: f32) -> Vec { track .iter() .map(|t| { @@ -103,7 +106,7 @@ fn min_size(column: bool, shape: &Shape, bounds: &HashMap) -> f32 // Go through cells to adjust auto sizes for span=1. Base is the max of its children fn set_auto_base_size( column: bool, - tracks: &mut Vec, + tracks: &mut [TrackData], cells: &Vec, shapes: &HashMap, bounds: &HashMap, @@ -146,7 +149,7 @@ fn track_index(is_column: bool, c: &GridCell) -> (usize, usize) { } } -fn has_flex(is_column: bool, cell: &GridCell, tracks: &mut Vec) -> bool { +fn has_flex(is_column: bool, cell: &GridCell, tracks: &mut [TrackData]) -> bool { let (start, end) = track_index(is_column, cell); (start..end).any(|i| tracks[i].track_type == GridTrackType::Flex) } @@ -154,8 +157,8 @@ fn has_flex(is_column: bool, cell: &GridCell, tracks: &mut Vec) -> bo // Adjust multi-spaned cells with no flex columns fn set_auto_multi_span( column: bool, - tracks: &mut Vec, - cells: &Vec, + tracks: &mut [TrackData], + cells: &[GridCell], shapes: &HashMap, bounds: &HashMap, ) { @@ -193,11 +196,11 @@ fn set_auto_multi_span( let (start, end) = track_index(column, cell); // Distribute the size between the tracks that already have a set value - for i in start..end { - dist = dist - tracks[i].size; + for track in tracks[start..end].iter() { + dist -= track.size; - if tracks[i].track_type == GridTrackType::Auto { - num_auto = num_auto + 1; + if track.track_type == GridTrackType::Auto { + num_auto += 1; } } @@ -206,19 +209,19 @@ fn set_auto_multi_span( let rest = dist / num_auto as f32; // Distribute the space between auto tracks - for i in start..end { - if tracks[i].track_type == GridTrackType::Auto { + for track in tracks[start..end].iter_mut() { + if track.track_type == GridTrackType::Auto { // dist = dist - track[i].size; - let new_size = if tracks[i].size + rest < tracks[i].max_size { - tracks[i].size + rest + let new_size = if track.size + rest < track.max_size { + track.size + rest } else { - num_auto = num_auto - 1; - tracks[i].max_size + num_auto -= 1; + track.max_size }; - let aloc = new_size - tracks[i].size; - dist = dist - aloc; - tracks[i].size = tracks[i].size + aloc; + let aloc = new_size - track.size; + dist -= aloc; + track.size += aloc; } } } @@ -228,8 +231,8 @@ fn set_auto_multi_span( // Adjust multi-spaned cells with flex columns fn set_flex_multi_span( column: bool, - tracks: &mut Vec, - cells: &Vec, + tracks: &mut [TrackData], + cells: &[GridCell], shapes: &HashMap, bounds: &HashMap, ) { @@ -269,16 +272,16 @@ fn set_flex_multi_span( let (start, end) = track_index(column, cell); // Distribute the size between the tracks that already have a set value - for i in start..end { - dist = dist - tracks[i].size; + for track in tracks[start..end].iter() { + dist -= track.size; - match tracks[i].track_type { + match track.track_type { GridTrackType::Flex => { - num_flex = num_flex + tracks[i].value; - num_auto = num_auto + 1; + num_flex += track.value; + num_auto += 1; } GridTrackType::Auto => { - num_auto = num_auto + 1; + num_auto += 1; } _ => {} } @@ -289,15 +292,15 @@ fn set_flex_multi_span( continue; } - let rest = dist / num_flex as f32; + let rest = dist / num_flex; // Distribute the space between flex tracks in proportion to the division - for i in start..end { - if tracks[i].track_type == GridTrackType::Flex { - let new_size = f32::min(tracks[i].size + rest, tracks[i].max_size); - let aloc = new_size - tracks[i].size; - dist = dist - aloc; - tracks[i].size = tracks[i].size + aloc; + for track in tracks[start..end].iter_mut() { + if track.track_type == GridTrackType::Flex { + let new_size = f32::min(track.size + rest, track.max_size); + let aloc = new_size - track.size; + dist -= aloc; + track.size += aloc; } } @@ -305,20 +308,20 @@ fn set_flex_multi_span( while dist > MIN_SIZE && num_auto > 0 { let rest = dist / num_auto as f32; - for i in start..end { - if tracks[i].track_type == GridTrackType::Auto - || tracks[i].track_type == GridTrackType::Flex + for track in tracks[start..end].iter_mut() { + if track.track_type == GridTrackType::Auto + || track.track_type == GridTrackType::Flex { - let new_size = if tracks[i].size + rest < tracks[i].max_size { - tracks[i].size + rest + let new_size = if track.size + rest < track.max_size { + track.size + rest } else { - num_auto = num_auto - 1; - tracks[i].max_size + num_auto -= 1; + track.max_size }; - let aloc = new_size - tracks[i].size; - dist = dist - aloc; - tracks[i].size = tracks[i].size + aloc; + let aloc = new_size - track.size; + dist -= aloc; + track.size += aloc; } } } @@ -330,7 +333,7 @@ fn set_fr_value( column: bool, shape: &Shape, layout_data: &LayoutData, - tracks: &mut Vec, + tracks: &mut [TrackData], layout_size: f32, ) { let tot_gap: f32 = if column { @@ -380,7 +383,7 @@ fn stretch_tracks( column: bool, shape: &Shape, layout_data: &LayoutData, - tracks: &mut Vec, + tracks: &mut [TrackData], layout_size: f32, ) { if (column @@ -481,7 +484,7 @@ fn assign_anchors( _ => (padding_start + 0.0, gap), }; - cursor = cursor + (v * real_margin); + cursor += v * real_margin; for track in tracks { track.anchor_start = cursor; @@ -511,8 +514,8 @@ fn create_cell_data<'a>( children: &IndexSet, shapes: &'a HashMap, cells: &Vec, - column_tracks: &Vec, - row_tracks: &Vec, + column_tracks: &[TrackData], + row_tracks: &[TrackData], ) -> Vec> { let mut result = Vec::>::new(); @@ -614,11 +617,11 @@ fn child_position( cell.anchor + vv * vpos + hv * hpos } -pub fn reflow_grid_layout<'a>( +pub fn reflow_grid_layout( shape: &Shape, layout_data: &LayoutData, grid_data: &GridData, - shapes: &'a HashMap, + shapes: &HashMap, bounds: &mut HashMap, structure: &HashMap>, ) -> VecDeque { @@ -693,9 +696,9 @@ pub fn reflow_grid_layout<'a>( } let position = child_position( - &child, + child, &layout_bounds, - &layout_data, + layout_data, &child_bounds, child.layout_item, cell, @@ -733,9 +736,7 @@ pub fn reflow_grid_layout<'a>( scale_height = auto_height / height; } - let parent_transform = layout_bounds - .transform_matrix() - .unwrap_or(Matrix::default()); + let parent_transform = layout_bounds.transform_matrix().unwrap_or_default(); let parent_transform_inv = &parent_transform.invert().unwrap(); let origin = parent_transform_inv.map_point(layout_bounds.nw); @@ -744,7 +745,7 @@ pub fn reflow_grid_layout<'a>( scale.post_translate(origin); scale.post_concat(&parent_transform); scale.pre_translate(-origin); - scale.pre_concat(&parent_transform_inv); + scale.pre_concat(parent_transform_inv); let layout_bounds_after = layout_bounds.transform(&scale); result.push_back(Modifier::parent(shape.id, scale)); diff --git a/render-wasm/src/shapes/paths.rs b/render-wasm/src/shapes/paths.rs index 6ad5e5075..ce815c1fe 100644 --- a/render-wasm/src/shapes/paths.rs +++ b/render-wasm/src/shapes/paths.rs @@ -4,7 +4,7 @@ use std::array::TryFromSliceError; type Point = (f32, f32); fn stringify_slice_err(_: TryFromSliceError) -> String { - format!("Error deserializing path") + "Error deserializing path".to_string() } #[derive(Debug)] @@ -89,7 +89,7 @@ impl TryFrom> for Path { let mut open = true; let segments = value .into_iter() - .map(|raw| Segment::try_from(raw)) + .map(Segment::try_from) .collect::, String>>()?; let mut skia_path = skia::Path::new(); diff --git a/render-wasm/src/shapes/strokes.rs b/render-wasm/src/shapes/strokes.rs index ffa1e4062..e389b627c 100644 --- a/render-wasm/src/shapes/strokes.rs +++ b/render-wasm/src/shapes/strokes.rs @@ -52,9 +52,9 @@ impl From for StrokeCap { #[derive(Debug, Clone, Copy, PartialEq)] pub enum StrokeKind { - InnerStroke, - OuterStroke, - CenterStroke, + Inner, + Outer, + Center, } #[derive(Debug, Clone, PartialEq)] @@ -71,7 +71,7 @@ impl Stroke { // Strokes for open shapes should be rendered as if they were centered. pub fn render_kind(&self, is_open: bool) -> StrokeKind { if is_open { - StrokeKind::CenterStroke + StrokeKind::Center } else { self.kind } @@ -84,7 +84,7 @@ impl Stroke { style: StrokeStyle::from(style), cap_end: StrokeCap::from(cap_end), cap_start: StrokeCap::from(cap_start), - kind: StrokeKind::CenterStroke, + kind: StrokeKind::Center, } } @@ -95,7 +95,7 @@ impl Stroke { style: StrokeStyle::from(style), cap_end: StrokeCap::from(cap_end), cap_start: StrokeCap::from(cap_start), - kind: StrokeKind::InnerStroke, + kind: StrokeKind::Inner, } } @@ -106,30 +106,28 @@ impl Stroke { style: StrokeStyle::from(style), cap_end: StrokeCap::from(cap_end), cap_start: StrokeCap::from(cap_start), - kind: StrokeKind::OuterStroke, + kind: StrokeKind::Outer, } } pub fn delta(&self) -> f32 { match self.kind { - StrokeKind::InnerStroke => 0., - StrokeKind::CenterStroke => self.width, - StrokeKind::OuterStroke => self.width * 2., + StrokeKind::Inner => 0., + StrokeKind::Center => self.width, + StrokeKind::Outer => self.width * 2., } } pub fn outer_rect(&self, rect: &Rect) -> Rect { match self.kind { - StrokeKind::InnerStroke => Rect::from_xywh( + StrokeKind::Inner => Rect::from_xywh( rect.left + (self.width / 2.), rect.top + (self.width / 2.), rect.width() - self.width, rect.height() - self.width, ), - StrokeKind::CenterStroke => { - Rect::from_xywh(rect.left, rect.top, rect.width(), rect.height()) - } - StrokeKind::OuterStroke => Rect::from_xywh( + StrokeKind::Center => Rect::from_xywh(rect.left, rect.top, rect.width(), rect.height()), + StrokeKind::Outer => Rect::from_xywh( rect.left - (self.width / 2.), rect.top - (self.width / 2.), rect.width() + self.width, @@ -140,12 +138,12 @@ impl Stroke { pub fn outer_corners(&self, corners: &Corners) -> Corners { let offset = match self.kind { - StrokeKind::CenterStroke => 0.0, - StrokeKind::InnerStroke => -self.width / 2.0, - StrokeKind::OuterStroke => self.width / 2.0, + StrokeKind::Center => 0.0, + StrokeKind::Inner => -self.width / 2.0, + StrokeKind::Outer => self.width / 2.0, }; - let mut outer = corners.clone(); + let mut outer = *corners; for corner in outer.iter_mut() { corner.offset((offset, offset)) } @@ -163,9 +161,9 @@ impl Stroke { paint.set_style(skia::PaintStyle::Stroke); let width = match self.kind { - StrokeKind::InnerStroke => self.width, - StrokeKind::CenterStroke => self.width, - StrokeKind::OuterStroke => self.width + (1. / scale), + StrokeKind::Inner => self.width, + StrokeKind::Center => self.width, + StrokeKind::Outer => self.width + (1. / scale), }; paint.set_stroke_width(width); @@ -184,9 +182,9 @@ impl Stroke { StrokeStyle::Dotted => { let mut circle_path = skia::Path::new(); let width = match self.kind { - StrokeKind::InnerStroke => self.width, - StrokeKind::CenterStroke => self.width / 2.0, - StrokeKind::OuterStroke => self.width, + StrokeKind::Inner => self.width, + StrokeKind::Center => self.width / 2.0, + StrokeKind::Outer => self.width, }; circle_path.add_circle((0.0, 0.0), width, None); let advance = self.width + 5.0; @@ -227,11 +225,11 @@ impl Stroke { ) -> skia::Paint { let mut paint = self.to_paint(rect, svg_attrs, scale, antialias); match self.render_kind(is_open) { - StrokeKind::InnerStroke => { + StrokeKind::Inner => { paint.set_stroke_width(2. * paint.stroke_width()); } - StrokeKind::CenterStroke => {} - StrokeKind::OuterStroke => { + StrokeKind::Center => {} + StrokeKind::Outer => { paint.set_stroke_width(2. * paint.stroke_width()); } } diff --git a/render-wasm/src/shapes/svgraw.rs b/render-wasm/src/shapes/svgraw.rs index c89f66819..230612a1b 100644 --- a/render-wasm/src/shapes/svgraw.rs +++ b/render-wasm/src/shapes/svgraw.rs @@ -1,4 +1,4 @@ -#[derive(Debug, Clone, PartialEq)] +#[derive(Debug, Clone, PartialEq, Default)] pub struct SVGRaw { pub content: String, } @@ -8,11 +8,3 @@ impl SVGRaw { SVGRaw { content: svg } } } - -impl Default for SVGRaw { - fn default() -> Self { - Self { - content: String::from(""), - } - } -} diff --git a/render-wasm/src/shapes/text.rs b/render-wasm/src/shapes/text.rs index 808d5d104..d207eb616 100644 --- a/render-wasm/src/shapes/text.rs +++ b/render-wasm/src/shapes/text.rs @@ -51,10 +51,11 @@ pub fn set_paragraphs_width(width: f32, paragraphs: &mut Vec Self { - let mut res = Self::default(); - res.bounds = bounds; - res.grow_type = grow_type; - res + Self { + bounds, + grow_type, + ..Self::default() + } } pub fn new_bounds(&self, bounds: Rect) -> Self { @@ -125,7 +126,7 @@ impl TextContent { let paragraph_style = paragraph.paragraph_to_style(); let mut builder = ParagraphBuilder::new(¶graph_style, fonts); for leaf in ¶graph.children { - let stroke_style = leaf.to_stroke_style(paragraph, &stroke_paint); + let stroke_style = leaf.to_stroke_style(paragraph, stroke_paint); let text: String = leaf.apply_text_transform(paragraph.text_transform); builder.push_style(&stroke_style); builder.add_text(&text); @@ -217,6 +218,8 @@ impl Default for Paragraph { } impl Paragraph { + // FIXME: These arguments could be grouped or simplified + #[allow(clippy::too_many_arguments)] pub fn new( text_align: u8, text_decoration: u8, @@ -542,13 +545,13 @@ impl From<&Vec> for RawTextData { } } -pub fn auto_width(paragraphs: &Vec>) -> f32 { +pub fn auto_width(paragraphs: &[Vec]) -> f32 { paragraphs.iter().flatten().fold(0.0, |auto_width, p| { f32::max(p.max_intrinsic_width(), auto_width) }) } -pub fn auto_height(paragraphs: &Vec>) -> f32 { +pub fn auto_height(paragraphs: &[Vec]) -> f32 { paragraphs .iter() .flatten() diff --git a/render-wasm/src/state.rs b/render-wasm/src/state.rs index dac8915a7..dce678f73 100644 --- a/render-wasm/src/state.rs +++ b/render-wasm/src/state.rs @@ -1,4 +1,4 @@ -use std::collections::HashMap; +use std::collections::{hash_map::Entry, HashMap}; use skia_safe as skia; @@ -24,6 +24,8 @@ use crate::uuid::Uuid; /// state shapes attribute pub(crate) struct ShapesPool { // We need a box so that pushing here doesn't invalidate state.shapes references + // FIXME: See if we can avoid this + #[allow(clippy::vec_box)] shapes: Vec>, counter: usize, } @@ -116,9 +118,9 @@ impl<'a> State<'a> { } pub fn use_shape(&'a mut self, id: Uuid) { - if !self.shapes.contains_key(&id) { + if let Entry::Vacant(e) = self.shapes.entry(id) { let new_shape = self.shapes_pool.add_shape(id); - self.shapes.insert(id, new_shape); + e.insert(new_shape); } self.current_id = Some(id); self.current_shape = self.shapes.get_mut(&id).map(|r| &mut **r); @@ -127,7 +129,7 @@ impl<'a> State<'a> { pub fn delete_shape(&mut self, id: Uuid) { // We don't really do a self.shapes.remove so that redo/undo keep working if let Some(shape) = self.shapes.get(&id) { - let (rsx, rsy, rex, rey) = self.render_state.get_tiles_for_shape(&shape); + let (rsx, rsy, rex, rey) = self.render_state.get_tiles_for_shape(shape); for x in rsx..=rex { for y in rsy..=rey { let tile = (x, y); @@ -152,7 +154,7 @@ impl<'a> State<'a> { shape.set_selrect(left, top, right, bottom); // We don't need to update the tile for the root shape. if !shape.id.is_nil() { - self.render_state.update_tile_for(&shape); + self.render_state.update_tile_for(shape); } } None => panic!("Invalid current shape"), @@ -165,7 +167,7 @@ impl<'a> State<'a> { // We don't need to update the tile for the root shape. // We can also have deleted the selected shape if !shape.id.is_nil() && self.shapes.contains_key(&shape.id) { - self.render_state.update_tile_for(&shape); + self.render_state.update_tile_for(shape); } } None => panic!("Invalid current shape"), diff --git a/render-wasm/src/uuid.rs b/render-wasm/src/uuid.rs index 7c2d64ec0..519d2e158 100644 --- a/render-wasm/src/uuid.rs +++ b/render-wasm/src/uuid.rs @@ -63,7 +63,7 @@ impl SerializableResult for Uuid { fn as_bytes(&self) -> Self::BytesType { let mut result: Self::BytesType = [0; 16]; - let (a, b, c, d) = uuid_to_u32_quartet(&self); + let (a, b, c, d) = uuid_to_u32_quartet(self); result[0..4].clone_from_slice(&a.to_le_bytes()); result[4..8].clone_from_slice(&b.to_le_bytes()); result[8..12].clone_from_slice(&c.to_le_bytes()); diff --git a/render-wasm/src/view.rs b/render-wasm/src/view.rs index eeb7aa858..a78c11f6a 100644 --- a/render-wasm/src/view.rs +++ b/render-wasm/src/view.rs @@ -25,12 +25,13 @@ impl Default for Viewbox { impl Viewbox { pub fn new(width: f32, height: f32) -> Self { - let mut res = Self::default(); - res.width = width; - res.height = height; - res.area.set_xywh(0., 0., width, height); - - res + let area = Rect::from_xywh(0., 0., width, height); + Self { + width, + height, + area, + ..Self::default() + } } pub fn set_all(&mut self, zoom: f32, pan_x: f32, pan_y: f32) { diff --git a/render-wasm/src/wapi.rs b/render-wasm/src/wapi.rs index 92e03d82c..1947f7e3c 100644 --- a/render-wasm/src/wapi.rs +++ b/render-wasm/src/wapi.rs @@ -24,12 +24,13 @@ macro_rules! cancel_animation_frame { } { + let frame_id = $frame_id; #[cfg(target_arch = "wasm32")] unsafe { - wapi_cancelAnimationFrame($frame_id) + wapi_cancelAnimationFrame(frame_id) }; #[cfg(not(target_arch = "wasm32"))] - let _ = $frame_id; + let _ = frame_id; } }; } diff --git a/render-wasm/src/wasm/fonts.rs b/render-wasm/src/wasm/fonts.rs index 8de9a12d4..17f4b96b1 100644 --- a/render-wasm/src/wasm/fonts.rs +++ b/render-wasm/src/wasm/fonts.rs @@ -24,11 +24,8 @@ pub extern "C" fn store_font( .fonts_mut() .add(family, &font_bytes, is_emoji); - match res { - Err(msg) => { - eprintln!("{}", msg); - } - _ => {} + if let Err(msg) = res { + eprintln!("{}", msg); } }); } @@ -40,6 +37,6 @@ pub extern "C" fn is_font_uploaded(a: u32, b: u32, c: u32, d: u32, weight: u32, let family = FontFamily::new(id, weight, style.into()); let res = state.render_state().fonts().has_family(&family); - return res; - }); + res + }) } diff --git a/render-wasm/src/wasm/text.rs b/render-wasm/src/wasm/text.rs index 7a4e6ea56..7642216da 100644 --- a/render-wasm/src/wasm/text.rs +++ b/render-wasm/src/wasm/text.rs @@ -49,17 +49,13 @@ pub extern "C" fn get_text_dimensions() -> *mut u8 { if let Type::Text(content) = &shape.shape_type { let paragraphs = content.get_skia_paragraphs(font_col); height = auto_height(¶graphs).ceil(); - match content.grow_type() { - GrowType::AutoWidth => { - width = auto_width(¶graphs).ceil(); - } - _ => {} + if content.grow_type() == GrowType::AutoWidth { + width = auto_width(¶graphs).ceil(); } } }); - let mut bytes = Vec::::with_capacity(8); - bytes.resize(8, 0); + let mut bytes = vec![0; 8]; bytes[0..4].clone_from_slice(&width.to_le_bytes()); bytes[4..8].clone_from_slice(&height.to_le_bytes()); mem::write_bytes(bytes)