From 62bb0ec59ddd5de832fa671a1af7c4eb75c306e1 Mon Sep 17 00:00:00 2001 From: Gnome Date: Fri, 15 Jul 2022 21:11:08 +0100 Subject: [PATCH 1/4] Fix feature casing --- Cargo.toml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 22f50559af6..b0b0b0d2ffe 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -179,7 +179,7 @@ gateway = ["flate2", "http", "utils"] http = [] absolute_ratelimits = ["http"] model = ["builder", "http"] -voice-model = ["serenity-voice-model"] +voice_model = ["serenity-voice-model"] standard_framework = ["framework", "uwl", "levenshtein", "command_attr", "static_assertions"] unstable_discord_api = [] utils = ["base64"] @@ -188,7 +188,7 @@ tokio_task_builder = ["tokio/tracing"] time = [] # Enables simd accelerated parsing -simdjson = ["simd-json"] +simd_json = ["simd-json"] # Enables temporary caching in functions that retrieve data via the HTTP API. temp_cache = ["cache", "moka"] @@ -210,6 +210,10 @@ native_tls_backend = [ "bytes", ] +# TODO(next): Remove, these are deprecated aliases +simdjson = ["simd_json"] +voice-model = ["voice_model"] + [package.metadata.docs.rs] features = ["default", "collector", "unstable_discord_api", "voice", "voice-model"] rustdoc-args = ["--cfg", "docsrs"] From e5694191b11d46058a733d3d46d95b2476ef5247 Mon Sep 17 00:00:00 2001 From: Gnome Date: Fri, 15 Jul 2022 21:31:15 +0100 Subject: [PATCH 2/4] Add deprecated warning --- build.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/build.rs b/build.rs index 905a137f05f..b6a230b8a14 100644 --- a/build.rs +++ b/build.rs @@ -12,4 +12,10 @@ compile_error!( If you are unsure, go with `rustls_backend`." ); -fn main() {} +#[cfg_attr(feature="simdjson", deprecated = "The `simdjson` feature name is deprecated and will be removed in the next version of serenity, use `simd_json`.")] +#[cfg_attr(feature="voice-model", deprecated = "The `voice-model` feature name is deprecated and will be removed in the next version of serenity, use `voice_model`.")] +fn deprecated_feature() {} + +fn main() { + deprecated_feature() +} From 693a4e995f7a2ec3aca949607b6ebb6c307e3e3d Mon Sep 17 00:00:00 2001 From: Gnome Date: Sat, 16 Jul 2022 13:18:34 +0100 Subject: [PATCH 3/4] Fix deprecated warning when both features are enabled --- build.rs | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/build.rs b/build.rs index b6a230b8a14..8de1a0db18f 100644 --- a/build.rs +++ b/build.rs @@ -12,10 +12,19 @@ compile_error!( If you are unsure, go with `rustls_backend`." ); -#[cfg_attr(feature="simdjson", deprecated = "The `simdjson` feature name is deprecated and will be removed in the next version of serenity, use `simd_json`.")] -#[cfg_attr(feature="voice-model", deprecated = "The `voice-model` feature name is deprecated and will be removed in the next version of serenity, use `voice_model`.")] -fn deprecated_feature() {} +#[cfg_attr( + feature = "simdjson", + deprecated = "The `simdjson` feature name is deprecated and will be removed in the next version of serenity, use `simd_json`." +)] +fn deprecated_simd_json_feature() {} + +#[cfg_attr( + feature = "voice-model", + deprecated = "The `voice-model` feature name is deprecated and will be removed in the next version of serenity, use `voice_model`." +)] +fn deprecated_voice_model_feature() {} fn main() { - deprecated_feature() + deprecated_simd_json_feature(); + deprecated_voice_model_feature() } From 0091d684113fbc83771d16391c4f98db8d917f48 Mon Sep 17 00:00:00 2001 From: Gnome Date: Sat, 16 Jul 2022 14:23:12 +0100 Subject: [PATCH 4/4] Fix name of simd_json feature in README --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 659e0a5791a..6ca0583d6ee 100644 --- a/README.md +++ b/README.md @@ -153,7 +153,7 @@ due to latency in the network. If you turn this feature on, it is recommended to synchronise your clock with an NTP server (such as Google's). - **tokio_task_builder**: Enables tokio's `tracing` feature and uses `tokio::task::Builder` to spawn tasks with names if `RUSTFLAGS="--cfg tokio_unstable"` is set. - **unstable_discord_api**: Enables features of the Discord API that do not have a stable interface. The features might not have official documentation or are subject to change. -- **simdjson**: Enables SIMD accelerated JSON parsing and rendering for API calls, use with `RUSTFLAGS="-C target-cpu=native"` +- **simd_json**: Enables SIMD accelerated JSON parsing and rendering for API calls, use with `RUSTFLAGS="-C target-cpu=native"` - **temp_cache**: Enables temporary caching in functions that retrieve data via the HTTP API. Serenity offers two TLS-backends, `rustls_backend` by default, you need to pick