diff --git a/CHANGELOG.md b/CHANGELOG.md index 7e9b075e..5140c8b9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,13 @@ Since there is no stable release yet, the changes are organized per day in reverse chronological order. The main purpose of this document in its current state is to list breaking changes. +## [2024-08-18] + +### Breaking changes + +- The minimum supported Rust version has been bumped to 1.80 to replace the last + uses of `lazy_static` with `std::sync::LazyLock`. + ## [2024-05-05] ### Breaking changes diff --git a/Cargo.lock b/Cargo.lock index cb57272d..d2bff600 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3048,7 +3048,6 @@ dependencies = [ "cpal", "crossbeam", "jack", - "lazy_static", "libc", "log", "midi-consts", @@ -3089,7 +3088,6 @@ dependencies = [ "baseview 0.1.0 (git+https://github.com/RustAudio/baseview.git?rev=45465c5f46abed6c6ce370fffde5edc8e4cd5aa3)", "crossbeam", "egui-baseview", - "lazy_static", "nih_plug", "parking_lot 0.12.3", "raw-window-handle 0.5.2", diff --git a/Cargo.toml b/Cargo.toml index 879308ac..76929e8e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,7 +2,7 @@ name = "nih_plug" version = "0.0.0" edition = "2021" -rust-version = "1.70" +rust-version = "1.80" authors = ["Robbert van der Helm "] license = "ISC" @@ -85,7 +85,6 @@ cfg-if = "1.0" # This supports CLAP 1.1.8 clap-sys = { git = "https://github.com/robbert-vdh/clap-sys.git", branch = "feature/cstr-macro" } crossbeam = "0.8" -lazy_static = "1.4" log = { version = "0.4", features = ["std", "release_max_level_info"] } midi-consts = "0.1" nih_log = "0.3.1" diff --git a/nih_plug_egui/Cargo.toml b/nih_plug_egui/Cargo.toml index 4403e5fa..e14bd37e 100644 --- a/nih_plug_egui/Cargo.toml +++ b/nih_plug_egui/Cargo.toml @@ -21,7 +21,6 @@ raw-window-handle = "0.5" baseview = { git = "https://github.com/RustAudio/baseview.git", rev = "45465c5f46abed6c6ce370fffde5edc8e4cd5aa3" } crossbeam = "0.8" egui-baseview = { git = "https://github.com/BillyDM/egui-baseview.git", rev = "68c4d0e8e5c1c702a888a245f4ac50eddfdfcaed", default-features = false } -lazy_static = "1.4" parking_lot = "0.12" # To make the state persistable serde = { version = "1.0", features = ["derive"] } diff --git a/nih_plug_egui/src/widgets/param_slider.rs b/nih_plug_egui/src/widgets/param_slider.rs index a995ba7b..5eb4c937 100644 --- a/nih_plug_egui/src/widgets/param_slider.rs +++ b/nih_plug_egui/src/widgets/param_slider.rs @@ -1,10 +1,9 @@ -use std::sync::Arc; +use std::sync::{Arc, LazyLock}; use egui_baseview::egui::{ self, emath, vec2, Key, Response, Sense, Stroke, TextEdit, TextStyle, Ui, Vec2, Widget, WidgetText, }; -use lazy_static::lazy_static; use nih_plug::prelude::{Param, ParamSetter}; use parking_lot::Mutex; @@ -14,11 +13,10 @@ use super::util; /// noramlized parameter. const GRANULAR_DRAG_MULTIPLIER: f32 = 0.0015; -lazy_static! { - static ref DRAG_NORMALIZED_START_VALUE_MEMORY_ID: egui::Id = egui::Id::new((file!(), 0)); - static ref DRAG_AMOUNT_MEMORY_ID: egui::Id = egui::Id::new((file!(), 1)); - static ref VALUE_ENTRY_MEMORY_ID: egui::Id = egui::Id::new((file!(), 2)); -} +static DRAG_NORMALIZED_START_VALUE_MEMORY_ID: LazyLock = + LazyLock::new(|| egui::Id::new((file!(), 0))); +static DRAG_AMOUNT_MEMORY_ID: LazyLock = LazyLock::new(|| egui::Id::new((file!(), 1))); +static VALUE_ENTRY_MEMORY_ID: LazyLock = LazyLock::new(|| egui::Id::new((file!(), 2))); /// A slider widget similar to [`egui::widgets::Slider`] that knows about NIH-plug parameters ranges /// and can get values for it. The slider supports double click and control click to reset, diff --git a/src/event_loop/background_thread.rs b/src/event_loop/background_thread.rs index 3e437f8a..17d87a1a 100644 --- a/src/event_loop/background_thread.rs +++ b/src/event_loop/background_thread.rs @@ -6,7 +6,7 @@ use anymap::Entry; use crossbeam::channel; use parking_lot::Mutex; -use std::sync::{Arc, Weak}; +use std::sync::{Arc, LazyLock, Weak}; use std::thread::{self, JoinHandle}; use super::MainThreadExecutor; @@ -73,10 +73,8 @@ where // Rust does not allow us to use the `T` and `E` type variable in statics, so this is a // workaround to have a singleton that also works if for whatever reason there arem ultiple `T` // and `E`s in a single process (won't happen with normal plugin usage, but sho knwos). -lazy_static::lazy_static! { - static ref HANDLE_MAP: Mutex> = - Mutex::new(anymap::Map::new()); -} +static HANDLE_MAP: LazyLock>> = + LazyLock::new(|| Mutex::new(anymap::Map::new())); impl + 'static> WorkerThread { fn spawn() -> Self { diff --git a/src/wrapper/clap.rs b/src/wrapper/clap.rs index 3e7d2f3e..8ef4b2a6 100644 --- a/src/wrapper/clap.rs +++ b/src/wrapper/clap.rs @@ -14,7 +14,6 @@ pub use clap_sys::factory::plugin_factory::{clap_plugin_factory, CLAP_PLUGIN_FAC pub use clap_sys::host::clap_host; pub use clap_sys::plugin::{clap_plugin, clap_plugin_descriptor}; pub use clap_sys::version::CLAP_VERSION; -pub use lazy_static::lazy_static; /// Export one or more CLAP plugins from this library using the provided plugin types. #[macro_export]