aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFuwn <[email protected]>2026-01-21 01:21:41 -0800
committerFuwn <[email protected]>2026-01-21 01:21:41 -0800
commit972e2e613f5a65039cf87b5d54092ac21a0828d2 (patch)
treea35deac79dd043fd45f4a8e97c281f5227bb2369
parentfeat: Template footer year (diff)
downloadlocus-972e2e613f5a65039cf87b5d54092ac21a0828d2.tar.xz
locus-972e2e613f5a65039cf87b5d54092ac21a0828d2.zip
refactor: Bump nightlky Rust toolchain channel and fix lints
-rw-r--r--Cargo.lock219
-rw-r--r--Cargo.toml4
-rw-r--r--rust-toolchain.toml2
-rw-r--r--rustfmt.toml2
-rw-r--r--src/main.rs15
-rw-r--r--src/modules/blog/config.rs26
-rw-r--r--src/modules/blog/module.rs34
-rw-r--r--src/modules/finger.rs8
-rw-r--r--src/modules/index.rs4
9 files changed, 136 insertions, 178 deletions
diff --git a/Cargo.lock b/Cargo.lock
index 7809bd4..578d6b6 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -34,7 +34,7 @@ version = "0.7.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cc936419f96fa211c1b9166887b38e5e40b19958e5b895be7c1f93adec7071ac"
dependencies = [
- "memchr 2.6.3",
+ "memchr",
]
[[package]]
@@ -43,7 +43,7 @@ version = "1.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ea5d730647d4fadd988536d06fecce94b7b4f2a7efdae548f1cf4b63205518ab"
dependencies = [
- "memchr 2.6.3",
+ "memchr",
]
[[package]]
@@ -122,7 +122,7 @@ checksum = "2089b7e3f35b9dd2d0ed921ead4f6d318c27680d4a5bd167b3ee120edb105837"
dependencies = [
"addr2line",
"cc",
- "cfg-if 1.0.0",
+ "cfg-if",
"libc",
"miniz_oxide",
"object",
@@ -168,7 +168,7 @@ version = "1.6.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4c2f7349907b712260e64b0afe2f84692af14a454be26187d9df565c7f69266a"
dependencies = [
- "memchr 2.6.3",
+ "memchr",
"regex-automata 0.3.8",
"serde",
]
@@ -217,12 +217,6 @@ checksum = "4f4c707c6a209cbe82d10abd08e1ea8995e9ea937d2550646e02798948992be0"
[[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"
@@ -233,9 +227,9 @@ version = "0.1.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "14b8f0b65b7b08ae3c8187e8d77174de20cb6777864c6b832d8ad365999cf1ea"
dependencies = [
- "cfg-if 1.0.0",
+ "cfg-if",
"encoding_rs",
- "memchr 2.6.3",
+ "memchr",
]
[[package]]
@@ -253,15 +247,6 @@ dependencies = [
]
[[package]]
-name = "cloudabi"
-version = "0.0.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f"
-dependencies = [
- "bitflags 1.3.2",
-]
-
-[[package]]
name = "clru"
version = "0.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -273,7 +258,7 @@ version = "4.6.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ba5a308b75df32fe02788e748662718f03fde005016435c444eea572398219fd"
dependencies = [
- "memchr 2.6.3",
+ "memchr",
]
[[package]]
@@ -304,7 +289,7 @@ version = "1.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d"
dependencies = [
- "cfg-if 1.0.0",
+ "cfg-if",
]
[[package]]
@@ -313,7 +298,7 @@ version = "0.5.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a33c2bf77f2df06183c3aa30d1e96c0695a313d4f9c453cc3762a6db39f99200"
dependencies = [
- "cfg-if 1.0.0",
+ "cfg-if",
"crossbeam-utils",
]
@@ -323,7 +308,7 @@ version = "0.8.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ce6fd6f855243022dcecf8702fef0c297d4338e226845fe067f6341ad9fa0cef"
dependencies = [
- "cfg-if 1.0.0",
+ "cfg-if",
"crossbeam-epoch",
"crossbeam-utils",
]
@@ -335,7 +320,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ae211234986c545741a7dc064309f67ee1e5ad243d0e48335adc0484d960bcc7"
dependencies = [
"autocfg",
- "cfg-if 1.0.0",
+ "cfg-if",
"crossbeam-utils",
"memoffset",
"scopeguard",
@@ -347,7 +332,7 @@ version = "0.8.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5a22b2d63d4d1dc0b7f1b6b2747dd0088008a9be28b6ddf0b1e7d335e3037294"
dependencies = [
- "cfg-if 1.0.0",
+ "cfg-if",
]
[[package]]
@@ -426,7 +411,7 @@ version = "0.8.33"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7268b386296a025e474d5140678f75d6de9493ae55a5d709eeb9dd08149945e1"
dependencies = [
- "cfg-if 1.0.0",
+ "cfg-if",
]
[[package]]
@@ -507,17 +492,17 @@ version = "0.2.22"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d4029edd3e734da6fe05b6cd7bd2960760a616bd2ddd0d59a0124746d6272af0"
dependencies = [
- "cfg-if 1.0.0",
+ "cfg-if",
"libc",
- "redox_syscall 0.3.5",
+ "redox_syscall",
"windows-sys 0.48.0",
]
[[package]]
name = "fixedbitset"
-version = "0.2.0"
+version = "0.5.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "37ab347416e802de484e4d03c7316c48f1ecb56574dfd4a46a80f173ce1de04d"
+checksum = "1d674e81391d1e1ab681a28d99df07927c6d4aa5b027d7da16ba32d1d21ecd99"
[[package]]
name = "flate2"
@@ -536,6 +521,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"
[[package]]
+name = "foldhash"
+version = "0.1.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2"
+
+[[package]]
name = "foreign-types"
version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -613,7 +604,7 @@ dependencies = [
"futures-io",
"futures-sink",
"futures-task",
- "memchr 2.6.3",
+ "memchr",
"pin-project-lite",
"pin-utils",
"slab",
@@ -644,7 +635,7 @@ version = "0.2.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "be4136b2a15dd319360be1c07d9933517ccf0be8f16bf62a3bee4f0d618df427"
dependencies = [
- "cfg-if 1.0.0",
+ "cfg-if",
"libc",
"wasi",
]
@@ -691,7 +682,7 @@ dependencies = [
"gix-utils",
"gix-validate",
"once_cell",
- "parking_lot 0.12.1",
+ "parking_lot",
"signal-hook",
"smallvec",
"thiserror",
@@ -757,7 +748,7 @@ dependencies = [
"gix-path",
"gix-ref",
"gix-sec",
- "memchr 2.6.3",
+ "memchr",
"once_cell",
"smallvec",
"thiserror",
@@ -874,7 +865,7 @@ checksum = "7ddf80e16f3c19ac06ce415a38b8591993d3f73aede049cb561becb5b3a8e242"
dependencies = [
"gix-hash",
"hashbrown 0.14.0",
- "parking_lot 0.12.1",
+ "parking_lot",
]
[[package]]
@@ -957,7 +948,7 @@ dependencies = [
"gix-pack",
"gix-path",
"gix-quote",
- "parking_lot 0.12.1",
+ "parking_lot",
"tempfile",
"thiserror",
]
@@ -977,7 +968,7 @@ dependencies = [
"gix-path",
"gix-tempfile",
"memmap2 0.9.4",
- "parking_lot 0.12.1",
+ "parking_lot",
"smallvec",
"thiserror",
]
@@ -1093,7 +1084,7 @@ dependencies = [
"gix-fs",
"libc",
"once_cell",
- "parking_lot 0.12.1",
+ "parking_lot",
"signal-hook",
"signal-hook-registry",
"tempfile",
@@ -1167,7 +1158,7 @@ dependencies = [
"futures-core",
"futures-sink",
"http",
- "indexmap 2.0.1",
+ "indexmap",
"slab",
"tokio",
"tokio-util",
@@ -1190,6 +1181,21 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2c6201b9ff9fd90a5a3bac2e56a830d0caa509576f0e503818ee82c181b3437a"
[[package]]
+name = "hashbrown"
+version = "0.15.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1"
+dependencies = [
+ "foldhash",
+]
+
+[[package]]
+name = "hashbrown"
+version = "0.16.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "841d1cc9bed7f9236f321df977030373f4a4163ae1a7dbfe1a51a2c1a51d9100"
+
+[[package]]
name = "hermit-abi"
version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -1467,22 +1473,12 @@ dependencies = [
[[package]]
name = "indexmap"
-version = "1.9.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99"
-dependencies = [
- "autocfg",
- "hashbrown 0.12.3",
-]
-
-[[package]]
-name = "indexmap"
-version = "2.0.1"
+version = "2.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ad227c3af19d4914570ad36d30409928b75967c298feb9ea1969db3a610bb14e"
+checksum = "7714e70437a7dc3ac8eb7e6f8df75fd8eb422675fc7678aff7364301092b1017"
dependencies = [
"equivalent",
- "hashbrown 0.14.0",
+ "hashbrown 0.16.1",
]
[[package]]
@@ -1491,7 +1487,7 @@ version = "0.1.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c"
dependencies = [
- "cfg-if 1.0.0",
+ "cfg-if",
"js-sys",
"wasm-bindgen",
"web-sys",
@@ -1570,15 +1566,6 @@ checksum = "643cb0b8d4fcc284004d5fd0d67ccf61dfffadb7f75e1e71bc420f4688a3a704"
[[package]]
name = "lock_api"
-version = "0.3.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c4da24a77a3d8a6d4862d95f72e6fdb9c09a643ecdb402d754004a557f2bec75"
-dependencies = [
- "scopeguard",
-]
-
-[[package]]
-name = "lock_api"
version = "0.4.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c1cc9717a20b1bb222f333e6a92fd32f7d8a18ddc5a3191a11af45dcbf4dcd16"
@@ -1626,7 +1613,7 @@ version = "0.5.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ff50ecb28bb86013e935fb6683ab1f6d3a20016f123c76fd4c27470076ac30f5"
dependencies = [
- "cfg-if 1.0.0",
+ "cfg-if",
"generator",
"pin-utils",
"scoped-tls",
@@ -1676,15 +1663,6 @@ dependencies = [
[[package]]
name = "memchr"
-version = "1.0.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "148fab2e51b4f1cfc66da2a7c32981d1d3c083a803978268bb11fe4b86925e7a"
-dependencies = [
- "libc",
-]
-
-[[package]]
-name = "memchr"
version = "2.6.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8f232d6ef707e1956a43342693d2a31e72989554d58299d7a88738cc95b0d35c"
@@ -1771,11 +1749,11 @@ dependencies = [
[[package]]
name = "nom"
-version = "3.2.1"
+version = "8.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "05aec50c70fd288702bcd93284a8444607f3292dbdf2a30de5ea5dcdbe72287b"
+checksum = "df9761775871bdef83bee530e60050f7e54b1105350d6884eb0fb4f46c2f9405"
dependencies = [
- "memchr 1.0.2",
+ "memchr",
]
[[package]]
@@ -1828,7 +1806,7 @@ version = "0.32.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9cf5f9dd3933bd50a9e1f149ec995f39ae2c496d31fd772c1fd45ebc27e902b0"
dependencies = [
- "memchr 2.6.3",
+ "memchr",
]
[[package]]
@@ -1853,7 +1831,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bac25ee399abb46215765b1cb35bc0212377e58a061560d8b29b024fd0430e7c"
dependencies = [
"bitflags 2.4.0",
- "cfg-if 1.0.0",
+ "cfg-if",
"foreign-types",
"libc",
"once_cell",
@@ -1907,36 +1885,12 @@ dependencies = [
[[package]]
name = "parking_lot"
-version = "0.10.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d3a704eb390aafdc107b0e392f56a82b668e3a71366993b5340f5833fd62505e"
-dependencies = [
- "lock_api 0.3.4",
- "parking_lot_core 0.7.3",
-]
-
-[[package]]
-name = "parking_lot"
version = "0.12.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f"
dependencies = [
- "lock_api 0.4.10",
- "parking_lot_core 0.9.8",
-]
-
-[[package]]
-name = "parking_lot_core"
-version = "0.7.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b93f386bb233083c799e6e642a9d73db98c24a5deeb95ffc85bf281255dffc98"
-dependencies = [
- "cfg-if 0.1.10",
- "cloudabi",
- "libc",
- "redox_syscall 0.1.57",
- "smallvec",
- "winapi",
+ "lock_api",
+ "parking_lot_core",
]
[[package]]
@@ -1945,9 +1899,9 @@ version = "0.9.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "93f00c865fe7cabf650081affecd3871070f26767e7b2070a3ffae14c654b447"
dependencies = [
- "cfg-if 1.0.0",
+ "cfg-if",
"libc",
- "redox_syscall 0.3.5",
+ "redox_syscall",
"smallvec",
"windows-targets 0.48.5",
]
@@ -1966,12 +1920,13 @@ checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e"
[[package]]
name = "petgraph"
-version = "0.5.1"
+version = "0.8.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "467d164a6de56270bd7c4d070df81d07beace25012d5103ced4e9ff08d6afdb7"
+checksum = "8701b58ea97060d5e5b155d383a69952a60943f0e6dfe30b04c287beb0b27455"
dependencies = [
"fixedbitset",
- "indexmap 1.9.3",
+ "hashbrown 0.15.5",
+ "indexmap",
]
[[package]]
@@ -2130,12 +2085,6 @@ dependencies = [
[[package]]
name = "redox_syscall"
-version = "0.1.57"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce"
-
-[[package]]
-name = "redox_syscall"
version = "0.3.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29"
@@ -2150,7 +2099,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "697061221ea1b4a94a624f67d0ae2bfe4e22b8a17b6a192afb11046542cc8c47"
dependencies = [
"aho-corasick 1.1.1",
- "memchr 2.6.3",
+ "memchr",
"regex-automata 0.3.8",
"regex-syntax 0.7.5",
]
@@ -2171,7 +2120,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c2f401f4955220693b56f8ec66ee9c78abffd8d1c4f23dc41a23839eb88f0795"
dependencies = [
"aho-corasick 1.1.1",
- "memchr 2.6.3",
+ "memchr",
"regex-syntax 0.7.5",
]
@@ -2625,7 +2574,7 @@ version = "3.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "85b77fafb263dd9d05cbeac119526425676db3784113aa9295c88498cbf8bff1"
dependencies = [
- "cfg-if 1.0.0",
+ "cfg-if",
"fastrand",
"rustix",
"windows-sys 0.52.0",
@@ -2666,7 +2615,7 @@ version = "1.1.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3fdd6f064ccff2d6567adcb3873ca630700f00b5ad3f060c25b5dcfd9a4ce152"
dependencies = [
- "cfg-if 1.0.0",
+ "cfg-if",
"once_cell",
]
@@ -2745,7 +2694,7 @@ dependencies = [
"libc",
"mio",
"num_cpus",
- "parking_lot 0.12.1",
+ "parking_lot",
"pin-project-lite",
"signal-hook-registry",
"socket2",
@@ -2842,7 +2791,7 @@ version = "0.1.37"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8ce8c33a8d48bd45d624a6e523445fd21ec13d3653cd51f681abf67418f54eb8"
dependencies = [
- "cfg-if 1.0.0",
+ "cfg-if",
"pin-project-lite",
"tracing-attributes",
"tracing-core",
@@ -2899,15 +2848,13 @@ dependencies = [
]
[[package]]
-name = "tree_magic"
-version = "0.2.3"
+name = "tree_magic_mini"
+version = "3.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b1d99367ce3e553a84738f73bd626ccca541ef90ae757fdcdc4cbe728e6cb629"
+checksum = "b8765b90061cba6c22b5831f675da109ae5561588290f9fa2317adab2714d5a6"
dependencies = [
- "fnv",
- "lazy_static",
+ "memchr",
"nom",
- "parking_lot 0.10.2",
"petgraph",
]
@@ -3024,7 +2971,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e27d6bdd219887a9eadd19e1c34f32e47fa332301184935c6d9bca26f3cca525"
dependencies = [
"anyhow",
- "cfg-if 1.0.0",
+ "cfg-if",
"gix",
"rustversion",
"time",
@@ -3067,7 +3014,7 @@ version = "0.2.87"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7706a72ab36d8cb1f80ffbf0e071533974a60d0a308d01a5d0375bf60499a342"
dependencies = [
- "cfg-if 1.0.0",
+ "cfg-if",
"wasm-bindgen-macro",
]
@@ -3092,7 +3039,7 @@ version = "0.4.37"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c02dbc21516f9f1f04f187958890d7e6026df8d16540b7ad9492bc34a67cea03"
dependencies = [
- "cfg-if 1.0.0",
+ "cfg-if",
"js-sys",
"wasm-bindgen",
"web-sys",
@@ -3170,9 +3117,9 @@ checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
[[package]]
name = "windmark"
-version = "0.3.11"
+version = "0.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c7b578dcc6d73004ef8c8c4d4adfb8a4bad8d0c14280f4e19f5f66b084832191"
+checksum = "18d3c55196a89991e4717c6b6c01184256229d557b120d6bf3130abca7f3a08f"
dependencies = [
"async-trait",
"log",
@@ -3182,7 +3129,7 @@ dependencies = [
"pretty_env_logger",
"tokio",
"tokio-openssl",
- "tree_magic",
+ "tree_magic_mini",
"url",
]
@@ -3340,7 +3287,7 @@ version = "0.5.40"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f593a95398737aeed53e489c785df13f3618e41dbcd6718c6addbf1395aa6876"
dependencies = [
- "memchr 2.6.3",
+ "memchr",
]
[[package]]
@@ -3349,7 +3296,7 @@ version = "0.52.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a277a57398d4bfa075df44f501a17cfdf8542d224f0d36095a2adc7aee4ef0a5"
dependencies = [
- "cfg-if 1.0.0",
+ "cfg-if",
"windows-sys 0.48.0",
]
diff --git a/Cargo.toml b/Cargo.toml
index f09e785..0cdf580 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -4,7 +4,7 @@
name = "locus"
version = "0.0.0"
authors = ["Fuwn <[email protected]>"]
-edition = "2021"
+edition = "2024"
description = "Fuwn's Gemini Capsule"
readme = "README.txt"
homepage = "https://github.com/gemrest/locus"
@@ -28,7 +28,7 @@ tokio = { version = "1.38.0", features = ["full"] } # Asynchronous Runtime
chrono = "0.4.38" # Date and Time
pickledb = "0.5.1" # Database
tantivy = "0.19.2" # Full-text Search Engine
-windmark = { version = "0.3.11", features = [
+windmark = { version = "0.4.2", features = [
"logger",
"auto-deduce-mime",
"response-macros",
diff --git a/rust-toolchain.toml b/rust-toolchain.toml
index 5a1fbab..56908ea 100644
--- a/rust-toolchain.toml
+++ b/rust-toolchain.toml
@@ -1,2 +1,2 @@
[toolchain]
-channel = "nightly-2024-07-17"
+channel = "nightly-2025-01-21"
diff --git a/rustfmt.toml b/rustfmt.toml
index 27653e1..13ea463 100644
--- a/rustfmt.toml
+++ b/rustfmt.toml
@@ -20,5 +20,5 @@ tab_spaces = 2
use_field_init_shorthand = true
use_small_heuristics = "Max"
use_try_shorthand = true
-version = "Two"
+style_edition = "2024"
wrap_comments = true
diff --git a/src/main.rs b/src/main.rs
index 0153b04..dd130b7 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -1,4 +1,3 @@
-#![feature(const_extern_fn, async_closure)]
#![deny(
warnings,
nonstandard_style,
@@ -20,14 +19,13 @@ mod xml;
#[macro_use] extern crate log;
-use std::alloc::System;
-
use {
// dotenv::var,
pickledb::PickleDb,
std::sync::{LazyLock, Mutex},
tokio::time::Instant,
};
+use {std::alloc::System, windmark::router_option::RouterOption};
#[global_allocator]
static A: System = System;
@@ -56,8 +54,9 @@ static DATABASE: LazyLock<Mutex<PickleDb>> = LazyLock::new(|| {
#[windmark::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
- std::env::set_var("RUST_LOG", "windmark,locus=trace");
- pretty_env_logger::init();
+ pretty_env_logger::formatted_builder()
+ .parse_filters("windmark,locus=trace")
+ .init();
dotenv::dotenv().ok();
let mut time_mount = Instant::now();
@@ -70,7 +69,11 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
router.set_error_handler(|_| {
windmark::response::Response::not_found(ERROR_HANDLER_RESPONSE)
});
- router.set_fix_path(true);
+ router.add_options(&[
+ RouterOption::RemoveExtraTrailingSlash,
+ RouterOption::AddMissingTrailingSlash,
+ RouterOption::AllowCaseInsensitiveLookup,
+ ]);
timing::time_section(&mut time_mount, "creating router");
timing::time_mounts("module", &mut time_mount, || {
diff --git a/src/modules/blog/config.rs b/src/modules/blog/config.rs
index c2e4cc9..c4c7ced 100644
--- a/src/modules/blog/config.rs
+++ b/src/modules/blog/config.rs
@@ -12,15 +12,19 @@ pub struct Entry {
name: Option<String>,
}
impl Entry {
- pub const fn description(&self) -> &Option<String> { &self.description }
+ pub const fn description(&self) -> Option<&String> {
+ self.description.as_ref()
+ }
- pub const fn author(&self) -> &Option<String> { &self.author }
+ pub const fn author(&self) -> Option<&String> { self.author.as_ref() }
- pub const fn name(&self) -> &Option<String> { &self.name }
+ pub const fn name(&self) -> Option<&String> { self.name.as_ref() }
- pub const fn created(&self) -> &Option<String> { &self.created }
+ pub const fn created(&self) -> Option<&String> { self.created.as_ref() }
- pub const fn last_modified(&self) -> &Option<String> { &self.last_modified }
+ pub const fn last_modified(&self) -> Option<&String> {
+ self.last_modified.as_ref()
+ }
}
#[derive(Serialize, Deserialize, Clone, Default)]
@@ -31,13 +35,17 @@ pub struct Blog {
priority: Option<u8>,
}
impl Blog {
- pub const fn description(&self) -> &Option<String> { &self.description }
+ pub const fn description(&self) -> Option<&String> {
+ self.description.as_ref()
+ }
- pub const fn name(&self) -> &Option<String> { &self.name }
+ pub const fn name(&self) -> Option<&String> { self.name.as_ref() }
- pub const fn posts(&self) -> &Option<HashMap<String, Entry>> { &self.posts }
+ pub const fn posts(&self) -> Option<&HashMap<String, Entry>> {
+ self.posts.as_ref()
+ }
- pub const fn priority(&self) -> &Option<u8> { &self.priority }
+ pub const fn priority(&self) -> Option<&u8> { self.priority.as_ref() }
pub fn from_string(string: &str) -> serde_json::Result<Self> {
serde_json::from_str(string)
diff --git a/src/modules/blog/module.rs b/src/modules/blog/module.rs
index 8ffff90..2fda040 100644
--- a/src/modules/blog/module.rs
+++ b/src/modules/blog/module.rs
@@ -39,7 +39,7 @@ pub fn module(router: &mut windmark::router::Router) {
if std::path::Path::new(&entry_key)
.extension()
- .map_or(false, |extension| extension.eq_ignore_ascii_case("gmi"))
+ .is_some_and(|extension| extension.eq_ignore_ascii_case("gmi"))
{
entry_key.truncate(entry_key.len() - 4);
}
@@ -99,11 +99,12 @@ pub fn module(router: &mut windmark::router::Router) {
.map(|(blog, entries)| {
(
blog,
- *entries
+ entries
.get("blog.json")
.and_then(|content| Blog::from_string(content).ok())
.unwrap_or_default()
- .priority(),
+ .priority()
+ .copied(),
entries,
)
})
@@ -125,11 +126,11 @@ pub fn module(router: &mut windmark::router::Router) {
.and_then(|content| Blog::from_string(content).ok());
let name = config
.as_ref()
- .and_then(|c| c.name().as_ref())
+ .and_then(|c| c.name())
.cloned()
.unwrap_or_else(|| title.clone());
let description =
- config.as_ref().and_then(|c| c.description().as_ref()).cloned();
+ config.as_ref().and_then(|c| c.description()).cloned();
format!(
"=> {} {}{}",
@@ -158,11 +159,10 @@ pub fn module(router: &mut windmark::router::Router) {
let entries_clone = entries.clone();
let name = config
.as_ref()
- .and_then(|c| c.name().as_ref())
+ .and_then(|c| c.name())
.cloned()
.unwrap_or_else(|| blog.clone());
- let description =
- config.as_ref().and_then(|c| c.description().as_ref()).cloned();
+ let description = config.as_ref().and_then(|c| c.description()).cloned();
let config_clone = config.clone();
let mut xml = XmlWriter::builder();
@@ -197,13 +197,13 @@ pub fn module(router: &mut windmark::router::Router) {
{0}'s RSS feed\n\n=> {} here!",
blog,
entries_clone.len(),
- description.as_deref().unwrap_or(""),
+ description.as_deref().map_or("", |v| v),
entries_clone
.keys()
.map(|title| {
let postish = config_clone
.as_ref()
- .and_then(|c| c.posts().as_ref())
+ .and_then(|c| c.posts())
.and_then(|posts| posts.get(title))
.cloned()
.unwrap_or_default();
@@ -215,10 +215,10 @@ pub fn module(router: &mut windmark::router::Router) {
fixed_blog_name,
title.to_lowercase()
),
- { postish.name().clone().unwrap_or_else(|| title.clone()) },
+ { postish.name().cloned().unwrap_or_else(|| title.clone()) },
{
let post =
- postish.description().clone().unwrap_or_default();
+ postish.description().cloned().unwrap_or_default();
if post.is_empty() {
String::new()
@@ -238,7 +238,7 @@ pub fn module(router: &mut windmark::router::Router) {
);
for (title, contents) in entries {
- let header = construct_header(&config, &title)
+ let header = construct_header(config.as_ref(), &title)
.unwrap_or_else(|()| (String::new(), String::new()));
let fixed_blog_name = fixed_blog_name_clone_2.clone();
let mut real_title = "Unknown";
@@ -326,11 +326,11 @@ pub fn module(router: &mut windmark::router::Router) {
}
fn construct_header(
- config: &Option<Blog>,
+ config: Option<&Blog>,
name: &str,
) -> Result<(String, String), ()> {
let post =
- if let Some(posts) = config.clone().unwrap_or_default().posts().clone() {
+ if let Some(posts) = config.cloned().unwrap_or_default().posts().cloned() {
if let Some(post) = posts.get(name) {
post.clone()
} else {
@@ -359,7 +359,7 @@ fn construct_header(
Ok((
format!(
"# {}\n{}{}{}{}{}",
- post.name().clone().unwrap_or_else(|| name.to_string()),
+ post.name().cloned().unwrap_or_else(|| name.to_string()),
if any_is_some![author, created, last_modified, description] {
"\n"
} else {
@@ -370,6 +370,6 @@ fn construct_header(
field!(last_modified, " (last modified on {})\n"),
field!(description, "\n{}\n"),
),
- post.description().clone().unwrap_or_default(),
+ post.description().cloned().unwrap_or_default(),
))
}
diff --git a/src/modules/finger.rs b/src/modules/finger.rs
index 59c07a0..4e41d16 100644
--- a/src/modules/finger.rs
+++ b/src/modules/finger.rs
@@ -24,19 +24,19 @@ To visit my personal Finger server, <finger://fuwn.me>, you would visit <gemini:
|context| async move {
if let Some(uri) = context.parameters.get("uri") {
let path;
- let url = url::Url::parse({
+ let original_url = {
let mut parts = uri.split('/');
let host = parts.next().unwrap();
path = parts.collect::<Vec<&str>>().join("/");
- &if host.contains(':') {
+ if host.contains(':') {
host.to_string()
} else {
format!("{host}:79")
}
- })
- .unwrap();
+ };
+ let url = url::Url::parse(&original_url).unwrap();
let mut stream =
tokio::net::TcpStream::connect(url.to_string()).await.unwrap();
diff --git a/src/modules/index.rs b/src/modules/index.rs
index 0f7749a..1dfa66f 100644
--- a/src/modules/index.rs
+++ b/src/modules/index.rs
@@ -8,7 +8,7 @@ pub fn module(router: &mut windmark::router::Router) {
move |context| {
crate::response::success(
&format!(
- r#"# Fuwn[.me]
+ r"# Fuwn[.me]
I enjoy writing for archaic systems in dated languages and with artificially imposed constraints, all while aiming for peak performance and minimal design.
@@ -30,7 +30,7 @@ I write a lot of software and tooling for the Gemini protocol, the backbone of t
Don't know where to start? Check out The Directory or test your luck!
=> /directory The Directory
-=> /random I'm Feeling Lucky"#,
+=> /random I'm Feeling Lucky",
{
(*POSTS).lock().map_or_else(
|_| "...".to_string(),