From c4a941b29f622c41e42c6475880384a1084a94ea Mon Sep 17 00:00:00 2001 From: Emmie Maeda Date: Fri, 29 Sep 2023 02:24:35 -0400 Subject: [PATCH 1/3] Replace void crate with std::convert::Infallible. --- deepwell/Cargo.lock | 1 - deepwell/Cargo.toml | 1 - deepwell/src/services/blob/mime.rs | 15 ++++++++++++--- deepwell/src/services/job/service.rs | 4 ++-- deepwell/src/services/page_query/service.rs | 4 ++-- 5 files changed, 16 insertions(+), 9 deletions(-) diff --git a/deepwell/Cargo.lock b/deepwell/Cargo.lock index d9c0dadcd1..7591a150c5 100644 --- a/deepwell/Cargo.lock +++ b/deepwell/Cargo.lock @@ -1263,7 +1263,6 @@ dependencies = [ "typenum", "unic-langid", "unicase", - "void", "wikidot-normalize", "wikidot-path", ] diff --git a/deepwell/Cargo.toml b/deepwell/Cargo.toml index ef5ce7aa25..f209fea1f1 100644 --- a/deepwell/Cargo.toml +++ b/deepwell/Cargo.toml @@ -56,7 +56,6 @@ toml = { version = "0.8", features = ["parse"] } typenum = "1" unic-langid = "0.9" unicase = "2" -void = "1" wikidot-normalize = "0.11" wikidot-path = "0.5" diff --git a/deepwell/src/services/blob/mime.rs b/deepwell/src/services/blob/mime.rs index 4ce6295ad4..8c844efca2 100644 --- a/deepwell/src/services/blob/mime.rs +++ b/deepwell/src/services/blob/mime.rs @@ -30,9 +30,9 @@ use super::prelude::*; use crossfire::mpsc; use filemagic::{FileMagicError, Flags as MagicFlags, Magic}; +use std::convert::Infallible; use std::sync::Once; use std::{process, thread}; -use void::{ResultVoidErrExt, Void}; type ResponsePayload = StdResult; type ResponseSender = mpsc::TxBlocking; @@ -58,7 +58,7 @@ macro_rules! source { }; } -fn main_loop() -> Result { +fn main_loop() -> Result { const MAGIC_FLAGS: MagicFlags = MagicFlags::MIME; const MAGIC_PATHS: &[&str] = &[]; // Empty indicates using the default magic database @@ -81,11 +81,20 @@ fn main_loop() -> Result { pub fn spawn_magic_thread() { static START: Once = Once::new(); + macro_rules! unwrap_err { + ($result:expr) => { + match $result { + Ok(_) => unreachable!(), + Err(error) => error, + } + }; + } + START.call_once(|| { thread::spawn(|| { // Since this is an infinite loop, no success case can return. // Only the initialization can fail, individual requests just pass back the result. - let error = main_loop().void_unwrap_err(); + let error = unwrap_err!(main_loop()); tide::log::error!("Failed to spawn magic thread: {error}"); process::exit(1); }); diff --git a/deepwell/src/services/job/service.rs b/deepwell/src/services/job/service.rs index aa6743e8d3..f9ffaf909b 100644 --- a/deepwell/src/services/job/service.rs +++ b/deepwell/src/services/job/service.rs @@ -24,8 +24,8 @@ use crate::services::{PageRevisionService, SessionService, TextService}; use async_std::task; use crossfire::mpsc; use sea_orm::TransactionTrait; +use std::convert::Infallible; use std::sync::Arc; -use void::Void; lazy_static! { static ref QUEUE: (mpsc::TxUnbounded, mpsc::RxUnbounded) = @@ -109,7 +109,7 @@ impl JobRunner { // see config.refill_name_change } - async fn main_loop(mut self) -> Void { + async fn main_loop(mut self) -> Infallible { tide::log::info!("Starting job runner"); let delay = self.state.config.job_delay; diff --git a/deepwell/src/services/page_query/service.rs b/deepwell/src/services/page_query/service.rs index f686ef3f61..d7fdfb0fdd 100644 --- a/deepwell/src/services/page_query/service.rs +++ b/deepwell/src/services/page_query/service.rs @@ -28,7 +28,7 @@ use crate::models::page_parent::{self, Entity as PageParent}; use crate::models::{page_revision, text}; use crate::services::{PageService, ParentService}; use sea_query::{Expr, Query}; -use void::Void; +use std::convert::Infallible; #[derive(Debug)] pub struct PageQueryService; @@ -68,7 +68,7 @@ impl PageQueryService { pagination, variables, }: PageQuery<'_>, - ) -> Result { + ) -> Result { tide::log::info!("Building ListPages query from specification"); let txn = ctx.transaction(); From 78b8fc250b60553f2159c8a8584328906f341179 Mon Sep 17 00:00:00 2001 From: Emmie Maeda Date: Fri, 29 Sep 2023 02:27:39 -0400 Subject: [PATCH 2/3] Bump ftml version to v1.22.2 --- ftml/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ftml/Cargo.toml b/ftml/Cargo.toml index 96a361481d..72762511a5 100644 --- a/ftml/Cargo.toml +++ b/ftml/Cargo.toml @@ -8,7 +8,7 @@ keywords = ["wikidot", "wikijump", "ftml", "parsing", "html"] categories = ["parser-implementations"] exclude = [".gitignore", ".editorconfig"] -version = "1.22.1" +version = "1.22.2" authors = ["Emmie Maeda "] edition = "2021" # this is *not* the same as the current year From 1716e05cfda918a836da1997054c44094f36562f Mon Sep 17 00:00:00 2001 From: Emmie Maeda Date: Fri, 29 Sep 2023 02:33:02 -0400 Subject: [PATCH 3/3] Update dependencies. Removes void dependency. --- deepwell/Cargo.lock | 181 +++++++++++++++----------------------------- deepwell/Cargo.toml | 2 +- 2 files changed, 61 insertions(+), 122 deletions(-) diff --git a/deepwell/Cargo.lock b/deepwell/Cargo.lock index 7591a150c5..7958bb6e65 100644 --- a/deepwell/Cargo.lock +++ b/deepwell/Cargo.lock @@ -138,9 +138,9 @@ dependencies = [ [[package]] name = "anstream" -version = "0.5.0" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1f58811cfac344940f1a400b6e6231ce35171f614f26439e80f8c1465c5cc0c" +checksum = "f6cd65a4b849ace0b7f6daeebcc1a1d111282227ca745458c61dbf670e52a597" dependencies = [ "anstyle", "anstyle-parse", @@ -152,15 +152,15 @@ dependencies = [ [[package]] name = "anstyle" -version = "1.0.3" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b84bf0a05bbb2a83e5eb6fa36bb6e87baa08193c35ff52bbf6b38d8af2890e46" +checksum = "7079075b41f533b8c61d2a4d073c4676e1f8b249ff94a393b0595db304e0dd87" [[package]] name = "anstyle-parse" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "938874ff5980b03a87c5524b3ae5b59cf99b1d6bc836848df7bc5ada9643c333" +checksum = "317b9a89c1868f5ea6ff1d9539a69f45dffc21ce321ac1fd1160dfa48c8e2140" dependencies = [ "utf8parse", ] @@ -176,9 +176,9 @@ dependencies = [ [[package]] name = "anstyle-wincon" -version = "2.1.0" +version = "3.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58f54d10c6dfa51283a066ceab3ec1ab78d13fae00aa49243a45e4571fb79dfd" +checksum = "0238ca56c96dfa37bdf7c373c8886dd591322500aceeeccdb2216fe06dc2f796" dependencies = [ "anstyle", "windows-sys", @@ -261,9 +261,9 @@ dependencies = [ [[package]] name = "async-executor" -version = "1.5.3" +version = "1.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78f2db9467baa66a700abce2a18c5ad793f6f83310aca1284796fc3921d113fd" +checksum = "2c1da3ae8dabd9c00f453a329dfe1fb28da3c0a72e2478cdcd93171740c20499" dependencies = [ "async-lock", "async-task", @@ -373,9 +373,9 @@ dependencies = [ [[package]] name = "async-signal" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4af361a844928cb7d36590d406709473a1b574f443094422ef166daa3b493208" +checksum = "c99f3cb3f9ff89f7d718fbb942c9eb91bedff12e396adf09a622dfe7ffec2bc2" dependencies = [ "async-io", "async-lock", @@ -701,11 +701,10 @@ dependencies = [ [[package]] name = "built" -version = "0.6.1" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b99c4cdc7b2c2364182331055623bdf45254fcb679fea565c40c3c11c101889a" +checksum = "1462f4ab147e1378c64dacd28f03a56d4771d93eab6c325265a35355ce47213d" dependencies = [ - "cargo-lock", "chrono", "git2", ] @@ -756,18 +755,6 @@ version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223" -[[package]] -name = "cargo-lock" -version = "9.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e11c675378efb449ed3ce8de78d75d0d80542fc98487c26aba28eb3b82feac72" -dependencies = [ - "semver 1.0.19", - "serde", - "toml 0.7.8", - "url", -] - [[package]] name = "cc" version = "1.0.83" @@ -816,18 +803,18 @@ dependencies = [ [[package]] name = "clap" -version = "4.4.5" +version = "4.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "824956d0dca8334758a5b7f7e50518d66ea319330cbceedcf76905c2f6ab30e3" +checksum = "d04704f56c2cde07f43e8e2c154b43f216dc5c92fc98ada720177362f953b956" dependencies = [ "clap_builder", ] [[package]] name = "clap_builder" -version = "4.4.5" +version = "4.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "122ec64120a49b4563ccaedcbea7818d069ed8e9aa6d829b82d8a4128936b2ab" +checksum = "0e231faeaca65ebd1ea3c737966bf858971cd38c3849107aa3ea7de90a804e45" dependencies = [ "anstream", "anstyle", @@ -1251,15 +1238,15 @@ dependencies = [ "sha2 0.10.8", "sqlx 0.7.2", "str-macro", - "strum 0.25.0", - "strum_macros 0.25.2", + "strum", + "strum_macros", "subtle", "surf", "thiserror", "tide", "time 0.3.29", "tiny-keccak", - "toml 0.8.1", + "toml", "typenum", "unic-langid", "unicase", @@ -1575,7 +1562,7 @@ dependencies = [ "intl-memoizer", "intl_pluralrules", "rustc-hash", - "self_cell", + "self_cell 0.10.2", "smallvec", "unic-langid", ] @@ -1637,9 +1624,9 @@ dependencies = [ [[package]] name = "ftml" -version = "1.22.1" +version = "1.22.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4551c4e44a6d3e0bf1dad446a4d11c58da9514e2f287bf1428bbcc65e4f7eba9" +checksum = "66be61386787a47353524bd03d4828d3fe33950b368adf007739363d549b26d6" dependencies = [ "built", "cfg-if 1.0.0", @@ -1647,9 +1634,9 @@ dependencies = [ "enum-map", "getrandom 0.2.10", "latex2mathml", - "lazy_static", "log", "maplit", + "once_cell", "parcel_css", "parcel_selectors", "pest", @@ -1657,18 +1644,17 @@ dependencies = [ "rand 0.8.5", "ref-map", "regex", - "self_cell", + "self_cell 1.0.1", "serde", "serde-wasm-bindgen", "serde_json", "serde_repr", "str-macro", - "strum 0.24.1", - "strum_macros 0.24.3", + "strum", + "strum_macros", "time 0.3.29", "tinyvec", "unicase", - "void", "wasm-bindgen", "web-sys", "wikidot-normalize", @@ -1878,11 +1864,11 @@ checksum = "6fb8d784f27acf97159b40fc4db5ecd8aa23b9ad5ef69cdd136d3bc80665f0c0" [[package]] name = "git2" -version = "0.17.2" +version = "0.18.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b989d6a7ca95a362cf2cfc5ad688b3a467be1f87e480b8dad07fee8c79b0044" +checksum = "fbf97ba92db08df386e10c8ede66a2a0369bd277090afd8710e19e38de9ec0cd" dependencies = [ - "bitflags 1.3.2", + "bitflags 2.4.0", "libc", "libgit2-sys", "log", @@ -2131,9 +2117,9 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.0.0" +version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d5477fe2230a79769d8dc68e0eabf5437907c0457a5614a9e8dddb67f65eb65d" +checksum = "ad227c3af19d4914570ad36d30409928b75967c298feb9ea1969db3a610bb14e" dependencies = [ "equivalent", "hashbrown 0.14.0", @@ -2303,9 +2289,9 @@ checksum = "9cdc71e17332e86d2e1d38c1f99edcb6288ee11b815fb1a4b049eaa2114d369b" [[package]] name = "libgit2-sys" -version = "0.15.2+1.6.4" +version = "0.16.1+1.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a80df2e11fb4a61f4ba2ab42dbe7f74468da143f1a75c74e11dee7c813f694fa" +checksum = "f2a2bb3680b094add03bb3732ec520ece34da31a8cd2d633d1389d0f0fb60d0c" dependencies = [ "cc", "libc", @@ -3696,6 +3682,12 @@ version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1ef965a420fe14fdac7dd018862966a4c14094f900e1650bbc71ddd7d580c8af" +[[package]] +name = "self_cell" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c309e515543e67811222dbc9e3dd7e1056279b782e1dacffe4242b718734fb6" + [[package]] name = "semver" version = "0.9.0" @@ -3710,9 +3702,6 @@ name = "semver" version = "1.0.19" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ad977052201c6de01a8ef2aa3378c4bd23217a056337d1d6da40468d267a4fb0" -dependencies = [ - "serde", -] [[package]] name = "semver-parser" @@ -3731,9 +3720,9 @@ dependencies = [ [[package]] name = "serde-wasm-bindgen" -version = "0.5.0" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3b143e2833c57ab9ad3ea280d21fd34e285a42837aeb0ee301f4f41890fa00e" +checksum = "30c9933e5689bd420dc6c87b7a1835701810cbc10cd86a26e4da45b73e6b1d78" dependencies = [ "js-sys", "serde", @@ -4106,7 +4095,7 @@ dependencies = [ "futures-util", "hashlink", "hex", - "indexmap 2.0.0", + "indexmap 2.0.1", "log", "memchr", "once_cell", @@ -4379,31 +4368,12 @@ version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" -[[package]] -name = "strum" -version = "0.24.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "063e6045c0e62079840579a7e47a355ae92f60eb74daaf156fb1e84ba164e63f" - [[package]] name = "strum" version = "0.25.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "290d54ea6f91c969195bdbcd7442c8c2a2ba87da8bf60a7ee86a235d4bc1e125" -[[package]] -name = "strum_macros" -version = "0.24.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e385be0d24f186b4ce2f9982191e7101bb737312ad61c1f2f984f34bcf85d59" -dependencies = [ - "heck 0.4.1", - "proc-macro2", - "quote", - "rustversion", - "syn 1.0.109", -] - [[package]] name = "strum_macros" version = "0.25.2" @@ -4449,15 +4419,15 @@ dependencies = [ [[package]] name = "sval" -version = "2.8.0" +version = "2.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05d11eec9fbe2bc8bc71e7349f0e7534db9a96d961fb9f302574275b7880ad06" +checksum = "53219a43817adbb1d53e6d0dd8ba8242f9a8f144b876945f3cbca6282cc0f603" [[package]] name = "sval_buffer" -version = "2.8.0" +version = "2.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b7451f69a93c5baf2653d5aa8bb4178934337f16c22830a50b06b386f72d761" +checksum = "2ea974e4cf17f8eedd11c8bcbdddad28a65f9faadeea62e0f092f031518a6e01" dependencies = [ "sval", "sval_ref", @@ -4465,18 +4435,18 @@ dependencies = [ [[package]] name = "sval_dynamic" -version = "2.8.0" +version = "2.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c34f5a2cc12b4da2adfb59d5eedfd9b174a23cc3fae84cec71dcbcd9302068f5" +checksum = "fb8bf9bfe769973b5ab924d3da1bc0e0f6b40c877c25cdd8eadba7b9bd32319a" dependencies = [ "sval", ] [[package]] name = "sval_fmt" -version = "2.8.0" +version = "2.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f578b2301341e246d00b35957f2952c4ec554ad9c7cfaee10bc86bc92896578" +checksum = "856e81b22a368aa8be4ba32c13301d2f350f0026b94126ebc41b0fcf14a4d89d" dependencies = [ "itoa", "ryu", @@ -4485,9 +4455,9 @@ dependencies = [ [[package]] name = "sval_json" -version = "2.8.0" +version = "2.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8346c00f5dc6efe18bea8d13c1f7ca4f112b20803434bf3657ac17c0f74cbc4b" +checksum = "3afe2fd273a8b25b7f924ed8bfaaf54812d81d27b300d5c4f890f41bba96f7e5" dependencies = [ "itoa", "ryu", @@ -4496,18 +4466,18 @@ dependencies = [ [[package]] name = "sval_ref" -version = "2.8.0" +version = "2.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6617cc89952f792aebc0f4a1a76bc51e80c70b18c491bd52215c7989c4c3dd06" +checksum = "416a04f4aa4be4fea8badd65a92a18f7a1082447513616866c0bd2c84c7d86aa" dependencies = [ "sval", ] [[package]] name = "sval_serde" -version = "2.8.0" +version = "2.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe3d1e59f023341d9af75d86f3bc148a6704f3f831eef0dd90bbe9cb445fa024" +checksum = "60e14464ea11b8e017b21481f7f5982d49a150bb8c27bf4edc1eb8694a61cf50" dependencies = [ "serde", "sval", @@ -4729,18 +4699,6 @@ dependencies = [ "pin-project-lite 0.2.13", ] -[[package]] -name = "toml" -version = "0.7.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd79e69d3b627db300ff956027cc6c3798cef26d22526befdfcd12feeb6d2257" -dependencies = [ - "serde", - "serde_spanned", - "toml_datetime", - "toml_edit 0.19.15", -] - [[package]] name = "toml" version = "0.8.1" @@ -4750,7 +4708,7 @@ dependencies = [ "serde", "serde_spanned", "toml_datetime", - "toml_edit 0.20.1", + "toml_edit", ] [[package]] @@ -4762,26 +4720,13 @@ dependencies = [ "serde", ] -[[package]] -name = "toml_edit" -version = "0.19.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" -dependencies = [ - "indexmap 2.0.0", - "serde", - "serde_spanned", - "toml_datetime", - "winnow", -] - [[package]] name = "toml_edit" version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ca676d9ba1a322c1b64eb8045a5ec5c0cfb0c9d08e15e9ff622589ad5221c8fe" dependencies = [ - "indexmap 2.0.0", + "indexmap 2.0.1", "serde", "serde_spanned", "toml_datetime", @@ -5021,12 +4966,6 @@ version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "65dd7eed29412da847b0f78bcec0ac98588165988a8cfe41d4ea1d429f8ccfff" -[[package]] -name = "void" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" - [[package]] name = "waker-fn" version = "1.1.1" diff --git a/deepwell/Cargo.toml b/deepwell/Cargo.toml index f209fea1f1..7da3eaaeaf 100644 --- a/deepwell/Cargo.toml +++ b/deepwell/Cargo.toml @@ -65,7 +65,7 @@ wikidot-path = "0.5" # https://github.com/tkaitchuck/aHash/issues/95 [build-dependencies] -built = { version = "0.6", features = ["git2"] } +built = { version = "0.7", features = ["git2"] } # Performance options