general: Use std's OnceCell where possible
Rust's standard library now provides a drop-in replacement for `OnceCell`. It requires no API changes from `once_cell`'s version. This commit replaces the version from `once_cell` with the new `std` struct where possible. We still need to use `once_cell` for properties until https://github.com/gtk-rs/gtk-rs-core/pull/1113 is merged. We also still need it for Lazy until that lands. Part-of: <https://gitlab.gnome.org/GNOME/Incubator/loupe/-/merge_requests/241>
This commit is contained in:
parent
ffb2e1064d
commit
439286be40
6 changed files with 8 additions and 11 deletions
|
|
@ -2,7 +2,7 @@
|
||||||
name = "loupe"
|
name = "loupe"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
rust-version = "1.65"
|
rust-version = "1.70"
|
||||||
license = "GPL-3.0-or-later"
|
license = "GPL-3.0-or-later"
|
||||||
|
|
||||||
[profile.release]
|
[profile.release]
|
||||||
|
|
|
||||||
|
|
@ -26,8 +26,8 @@ use gio::prelude::*;
|
||||||
use gio::subclass::prelude::*;
|
use gio::subclass::prelude::*;
|
||||||
use glib::GString;
|
use glib::GString;
|
||||||
use indexmap::IndexMap;
|
use indexmap::IndexMap;
|
||||||
use once_cell::sync::{Lazy, OnceCell};
|
use once_cell::sync::Lazy;
|
||||||
use std::cell::RefCell;
|
use std::cell::{OnceCell, RefCell};
|
||||||
|
|
||||||
mod imp {
|
mod imp {
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
|
||||||
|
|
@ -41,9 +41,8 @@ use adw::{prelude::*, subclass::prelude::*};
|
||||||
use arc_swap::ArcSwap;
|
use arc_swap::ArcSwap;
|
||||||
use futures::prelude::*;
|
use futures::prelude::*;
|
||||||
use once_cell::sync::Lazy;
|
use once_cell::sync::Lazy;
|
||||||
use once_cell::unsync::OnceCell;
|
|
||||||
|
|
||||||
use std::cell::{Cell, RefCell};
|
use std::cell::{Cell, OnceCell, RefCell};
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
/// Default background color around images and behind transparent images
|
/// Default background color around images and behind transparent images
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,7 @@ use std::cell::{Cell, RefCell};
|
||||||
const BUFFER: usize = 2;
|
const BUFFER: usize = 2;
|
||||||
|
|
||||||
mod imp {
|
mod imp {
|
||||||
use once_cell::sync::OnceCell;
|
use std::cell::OnceCell;
|
||||||
|
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -27,9 +27,9 @@ use crate::widgets::LpImagePage;
|
||||||
use adw::prelude::*;
|
use adw::prelude::*;
|
||||||
use adw::subclass::prelude::*;
|
use adw::subclass::prelude::*;
|
||||||
use indexmap::IndexMap;
|
use indexmap::IndexMap;
|
||||||
use once_cell::sync::{Lazy, OnceCell};
|
use once_cell::sync::Lazy;
|
||||||
|
|
||||||
use std::cell::{Cell, RefCell};
|
use std::cell::{Cell, OnceCell, RefCell};
|
||||||
|
|
||||||
static SCROLL_DAMPING_RATIO: f64 = 1.;
|
static SCROLL_DAMPING_RATIO: f64 = 1.;
|
||||||
static SCROLL_MASS: f64 = 0.5;
|
static SCROLL_MASS: f64 = 0.5;
|
||||||
|
|
|
||||||
|
|
@ -30,9 +30,7 @@ use adw::subclass::prelude::*;
|
||||||
use glib::clone;
|
use glib::clone;
|
||||||
use gtk::CompositeTemplate;
|
use gtk::CompositeTemplate;
|
||||||
|
|
||||||
use once_cell::sync::OnceCell;
|
use std::cell::{Cell, OnceCell, RefCell};
|
||||||
|
|
||||||
use std::cell::{Cell, RefCell};
|
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::{Path, PathBuf};
|
||||||
|
|
||||||
use crate::config;
|
use crate::config;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue