From be9cd3a09f4fb027786c634158ddeaca75a169f0 Mon Sep 17 00:00:00 2001 From: Ian Douglas Scott Date: Fri, 28 Oct 2022 14:43:18 -0700 Subject: Use `once_cell` instead of `lazy_static` This seems to be generally considered the preferred, idiomatic solution now. This is in the standard library behind a feature flag (apparently now called `std::sync::LazyLock`). --- examples/todos/src/main.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'examples/todos/src') diff --git a/examples/todos/src/main.rs b/examples/todos/src/main.rs index bddc0e71..be48ae8c 100644 --- a/examples/todos/src/main.rs +++ b/examples/todos/src/main.rs @@ -11,12 +11,10 @@ use iced::window; use iced::{Application, Element}; use iced::{Color, Command, Font, Length, Settings, Subscription}; -use lazy_static::lazy_static; +use once_cell::sync::Lazy; use serde::{Deserialize, Serialize}; -lazy_static! { - static ref INPUT_ID: text_input::Id = text_input::Id::unique(); -} +static INPUT_ID: Lazy = Lazy::new(text_input::Id::unique); pub fn main() -> iced::Result { Todos::run(Settings { -- cgit