diff --git a/.rustfmt.toml b/.rustfmt.toml
index f3efdc308..59528c80b 100644
--- a/.rustfmt.toml
+++ b/.rustfmt.toml
@@ -1,5 +1,5 @@
tab_spaces = 2
edition="2018"
imports_layout="HorizontalVertical"
-merge_imports=true
+imports_granularity="Crate"
reorder_imports=true
diff --git a/Cargo.lock b/Cargo.lock
index 2edcca8d7..ea7fdca3a 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -8,7 +8,7 @@ checksum = "fe7ceed015dfca322d3bcec3653909c77557e7e57df72e98cb8806e2c93cc919"
dependencies = [
"chrono",
"mime",
- "serde 1.0.123",
+ "serde",
"serde_json",
"thiserror",
"url",
@@ -21,7 +21,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bb8e19a0810cc25df3535061a08b7d8f8a734d309ea4411c57a9767e4a2ffa0e"
dependencies = [
"activitystreams",
- "serde 1.0.123",
+ "serde",
"serde_json",
]
@@ -128,7 +128,7 @@ dependencies = [
"pin-project 1.0.4",
"rand 0.7.3",
"regex",
- "serde 1.0.123",
+ "serde",
"serde_json",
"serde_urlencoded",
"sha-1 0.9.3",
@@ -156,7 +156,7 @@ dependencies = [
"http",
"log",
"regex",
- "serde 1.0.123",
+ "serde",
]
[[package]]
@@ -300,7 +300,7 @@ dependencies = [
"pin-project 1.0.4",
"regex",
"rustls",
- "serde 1.0.123",
+ "serde",
"serde_json",
"serde_urlencoded",
"socket2",
@@ -389,12 +389,6 @@ version = "1.0.38"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "afddf7f520a80dbf76e6f50a35bca42a2331ef227a28b3b6dc5c2e2338d114b1"
-[[package]]
-name = "arrayvec"
-version = "0.5.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b"
-
[[package]]
name = "async-mutex"
version = "1.4.0"
@@ -464,7 +458,7 @@ dependencies = [
"percent-encoding",
"rand 0.7.3",
"rustls",
- "serde 1.0.123",
+ "serde",
"serde_json",
"serde_urlencoded",
]
@@ -494,7 +488,7 @@ dependencies = [
"log",
"num_cpus",
"rand 0.7.3",
- "serde 1.0.123",
+ "serde",
"serde_json",
"thiserror",
"tokio 0.2.25",
@@ -513,7 +507,7 @@ dependencies = [
"async-trait",
"chrono",
"log",
- "serde 1.0.123",
+ "serde",
"serde_json",
"thiserror",
"tokio 0.2.25",
@@ -733,8 +727,8 @@ checksum = "670ad68c9088c2a963aaa298cb369688cf3f9465ce5e2d4ca10e6e0098a1ce73"
dependencies = [
"libc",
"num-integer",
- "num-traits 0.2.14",
- "serde 1.0.123",
+ "num-traits",
+ "serde",
"time 0.1.44",
"winapi 0.3.9",
]
@@ -781,18 +775,6 @@ dependencies = [
"xdg",
]
-[[package]]
-name = "config"
-version = "0.10.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "19b076e143e1d9538dde65da30f8481c2a6c44040edb8e02b9bf1351edb92ce3"
-dependencies = [
- "lazy_static",
- "nom 5.1.2",
- "serde 1.0.123",
- "serde-hjson",
-]
-
[[package]]
name = "const_fn"
version = "0.4.5"
@@ -995,6 +977,15 @@ dependencies = [
"syn",
]
+[[package]]
+name = "deser-hjson"
+version = "0.1.12"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d995b60ff81bc6af01a98f0bf5db70a7418a1ac8bd74ada633968f388139da5e"
+dependencies = [
+ "serde",
+]
+
[[package]]
name = "diesel"
version = "1.4.5"
@@ -1590,7 +1581,7 @@ dependencies = [
"jpeg-decoder",
"num-iter",
"num-rational",
- "num-traits 0.2.14",
+ "num-traits",
"png",
"scoped_threadpool",
"tiff",
@@ -1684,7 +1675,7 @@ dependencies = [
"base64 0.12.3",
"pem",
"ring",
- "serde 1.0.123",
+ "serde",
"serde_json",
"simple_asn1",
]
@@ -1745,7 +1736,7 @@ dependencies = [
"openssl",
"rand 0.8.3",
"reqwest",
- "serde 1.0.123",
+ "serde",
"serde_json",
"sha2",
"strum",
@@ -1792,7 +1783,7 @@ dependencies = [
"percent-encoding",
"rand 0.8.3",
"reqwest",
- "serde 1.0.123",
+ "serde",
"serde_json",
"sha2",
"strum",
@@ -1816,7 +1807,7 @@ dependencies = [
"lemmy_utils",
"log",
"regex",
- "serde 1.0.123",
+ "serde",
"serde_json",
"sha2",
"strum",
@@ -1831,7 +1822,7 @@ dependencies = [
"chrono",
"diesel",
"log",
- "serde 1.0.123",
+ "serde",
"serde_json",
"url",
]
@@ -1844,7 +1835,7 @@ dependencies = [
"lemmy_db_queries",
"lemmy_db_schema",
"log",
- "serde 1.0.123",
+ "serde",
"url",
]
@@ -1855,7 +1846,7 @@ dependencies = [
"diesel",
"lemmy_db_queries",
"lemmy_db_schema",
- "serde 1.0.123",
+ "serde",
]
[[package]]
@@ -1865,7 +1856,7 @@ dependencies = [
"diesel",
"lemmy_db_queries",
"lemmy_db_schema",
- "serde 1.0.123",
+ "serde",
]
[[package]]
@@ -1889,7 +1880,7 @@ dependencies = [
"lemmy_websocket",
"log",
"rss",
- "serde 1.0.123",
+ "serde",
"sha2",
"strum",
"url",
@@ -1925,7 +1916,7 @@ dependencies = [
"log",
"openssl",
"reqwest",
- "serde 1.0.123",
+ "serde",
"serde_json",
"strum",
"tokio 0.3.7",
@@ -1946,7 +1937,7 @@ dependencies = [
"lemmy_db_views_moderator",
"lemmy_utils",
"log",
- "serde 1.0.123",
+ "serde",
"serde_json",
"url",
]
@@ -1960,7 +1951,7 @@ dependencies = [
"anyhow",
"chrono",
"comrak",
- "config",
+ "deser-hjson",
"diesel",
"futures",
"http",
@@ -1969,12 +1960,13 @@ dependencies = [
"lazy_static",
"lettre",
"log",
+ "merge",
"openssl",
"percent-encoding",
"rand 0.8.3",
"regex",
"reqwest",
- "serde 1.0.123",
+ "serde",
"serde_json",
"strum",
"strum_macros",
@@ -2001,7 +1993,7 @@ dependencies = [
"log",
"rand 0.8.3",
"reqwest",
- "serde 1.0.123",
+ "serde",
"serde_json",
"strum",
"strum_macros",
@@ -2020,46 +2012,23 @@ dependencies = [
"idna",
"mime",
"native-tls",
- "nom 6.1.0",
+ "nom",
"once_cell",
"quoted_printable",
"r2d2",
"rand 0.8.3",
"regex",
- "serde 1.0.123",
+ "serde",
"serde_json",
"uuid",
]
-[[package]]
-name = "lexical-core"
-version = "0.7.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "db65c6da02e61f55dae90a0ae427b2a5f6b3e8db09f58d10efab23af92592616"
-dependencies = [
- "arrayvec",
- "bitflags",
- "cfg-if 0.1.10",
- "ryu",
- "static_assertions",
-]
-
[[package]]
name = "libc"
version = "0.2.84"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1cca32fa0182e8c0989459524dc356b8f2b5c10f1b9eb521b7d182c03cf8c5ff"
-[[package]]
-name = "linked-hash-map"
-version = "0.3.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6d262045c5b87c0861b3f004610afd0e2c851e2908d08b6c870cbb9d5f494ecd"
-dependencies = [
- "serde 0.8.23",
- "serde_test",
-]
-
[[package]]
name = "linked-hash-map"
version = "0.5.4"
@@ -2102,7 +2071,7 @@ version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "31e24f1ad8321ca0e8a1e0ac13f23cb668e6f5466c2c57319f6a5cf1cc8e3b1c"
dependencies = [
- "linked-hash-map 0.5.4",
+ "linked-hash-map",
]
[[package]]
@@ -2144,6 +2113,28 @@ dependencies = [
"autocfg",
]
+[[package]]
+name = "merge"
+version = "0.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "10bbef93abb1da61525bbc45eeaff6473a41907d19f8f9aa5168d214e10693e9"
+dependencies = [
+ "merge_derive",
+ "num-traits",
+]
+
+[[package]]
+name = "merge_derive"
+version = "0.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "209d075476da2e63b4b29e72a2ef627b840589588e71400a25e3565c4f849d07"
+dependencies = [
+ "proc-macro-error",
+ "proc-macro2",
+ "quote",
+ "syn",
+]
+
[[package]]
name = "migrations_internals"
version = "1.4.1"
@@ -2271,17 +2262,6 @@ dependencies = [
"winapi 0.3.9",
]
-[[package]]
-name = "nom"
-version = "5.1.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ffb4262d26ed83a1c0a33a38fe2bb15797329c85770da05e6b828ddb782627af"
-dependencies = [
- "lexical-core",
- "memchr",
- "version_check",
-]
-
[[package]]
name = "nom"
version = "6.1.0"
@@ -2301,7 +2281,7 @@ checksum = "090c7f9998ee0ff65aa5b723e4009f7b217707f1fb5ea551329cc4d6231fb304"
dependencies = [
"autocfg",
"num-integer",
- "num-traits 0.2.14",
+ "num-traits",
]
[[package]]
@@ -2311,7 +2291,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d2cc698a63b549a70bc047073d2949cce27cd1c7b0a4a862d08a8031bc2801db"
dependencies = [
"autocfg",
- "num-traits 0.2.14",
+ "num-traits",
]
[[package]]
@@ -2322,7 +2302,7 @@ checksum = "b2021c8337a54d21aca0d59a92577a029af9431cb59b909b03252b9c164fad59"
dependencies = [
"autocfg",
"num-integer",
- "num-traits 0.2.14",
+ "num-traits",
]
[[package]]
@@ -2333,16 +2313,7 @@ checksum = "12ac428b1cb17fce6f731001d307d351ec70a6d202fc2e60f7d4c5e42d8f4f07"
dependencies = [
"autocfg",
"num-integer",
- "num-traits 0.2.14",
-]
-
-[[package]]
-name = "num-traits"
-version = "0.1.43"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "92e5113e9fd4cc14ded8e499429f396a20f98c772a47cc8622a736e1ec843c31"
-dependencies = [
- "num-traits 0.2.14",
+ "num-traits",
]
[[package]]
@@ -2597,6 +2568,30 @@ dependencies = [
"vcpkg",
]
+[[package]]
+name = "proc-macro-error"
+version = "1.0.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c"
+dependencies = [
+ "proc-macro-error-attr",
+ "proc-macro2",
+ "quote",
+ "syn",
+ "version_check",
+]
+
+[[package]]
+name = "proc-macro-error-attr"
+version = "1.0.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "version_check",
+]
+
[[package]]
name = "proc-macro-hack"
version = "0.5.19"
@@ -2838,7 +2833,7 @@ dependencies = [
"native-tls",
"percent-encoding",
"pin-project-lite 0.2.4",
- "serde 1.0.123",
+ "serde",
"serde_json",
"serde_urlencoded",
"tokio 0.2.25",
@@ -3008,12 +3003,6 @@ version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3"
-[[package]]
-name = "serde"
-version = "0.8.23"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9dad3f759919b92c3068c696c15c3d17238234498bbdcc80f2c469606f948ac8"
-
[[package]]
name = "serde"
version = "1.0.123"
@@ -3023,19 +3012,6 @@ dependencies = [
"serde_derive",
]
-[[package]]
-name = "serde-hjson"
-version = "0.9.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6a3a4e0ea8a88553209f6cc6cfe8724ecad22e1acf372793c27d995290fe74f8"
-dependencies = [
- "lazy_static",
- "linked-hash-map 0.3.0",
- "num-traits 0.1.43",
- "regex",
- "serde 0.8.23",
-]
-
[[package]]
name = "serde_derive"
version = "1.0.123"
@@ -3056,16 +3032,7 @@ dependencies = [
"indexmap",
"itoa",
"ryu",
- "serde 1.0.123",
-]
-
-[[package]]
-name = "serde_test"
-version = "0.8.23"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "110b3dbdf8607ec493c22d5d947753282f3bae73c0f56d322af1e8c78e4c23d5"
-dependencies = [
- "serde 0.8.23",
+ "serde",
]
[[package]]
@@ -3077,7 +3044,7 @@ dependencies = [
"form_urlencoded",
"itoa",
"ryu",
- "serde 1.0.123",
+ "serde",
]
[[package]]
@@ -3147,7 +3114,7 @@ checksum = "692ca13de57ce0613a363c8c2f1de925adebc81b04c923ac60c5488bb44abe4b"
dependencies = [
"chrono",
"num-bigint",
- "num-traits 0.2.14",
+ "num-traits",
]
[[package]]
@@ -3188,12 +3155,6 @@ dependencies = [
"version_check",
]
-[[package]]
-name = "static_assertions"
-version = "1.1.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f"
-
[[package]]
name = "stdweb"
version = "0.4.20"
@@ -3216,7 +3177,7 @@ checksum = "c87a60a40fccc84bef0652345bbbbbe20a605bf5d0ce81719fc476f5c03b50ef"
dependencies = [
"proc-macro2",
"quote",
- "serde 1.0.123",
+ "serde",
"serde_derive",
"syn",
]
@@ -3230,7 +3191,7 @@ dependencies = [
"base-x",
"proc-macro2",
"quote",
- "serde 1.0.123",
+ "serde",
"serde_derive",
"serde_json",
"sha1",
@@ -3666,7 +3627,7 @@ dependencies = [
"idna",
"matches",
"percent-encoding",
- "serde 1.0.123",
+ "serde",
]
[[package]]
@@ -3676,7 +3637,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bc5cf98d8186244414c848017f0e2676b3fcb46807f6668a97dfe67359a3c4b7"
dependencies = [
"getrandom 0.2.2",
- "serde 1.0.123",
+ "serde",
]
[[package]]
@@ -3720,7 +3681,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "55c0f7123de74f0dab9b7d00fd614e7b19349cd1e2f5252bbe9b1754b59433be"
dependencies = [
"cfg-if 1.0.0",
- "serde 1.0.123",
+ "serde",
"serde_json",
"wasm-bindgen-macro",
]
diff --git a/crates/api/src/lib.rs b/crates/api/src/lib.rs
index 5e9e1c162..779da57f4 100644
--- a/crates/api/src/lib.rs
+++ b/crates/api/src/lib.rs
@@ -184,7 +184,7 @@ pub(crate) fn check_optional_url(item: &Option