mirror of
https://github.com/alacritty/alacritty.git
synced 2025-08-28 22:34:13 -04:00
Remove direct dependency on once_cell
With MSRV 1.70, std now contains the necessary parts.
This commit is contained in:
parent
047152acb8
commit
01d7640569
4 changed files with 12 additions and 11 deletions
1
Cargo.lock
generated
1
Cargo.lock
generated
|
@ -53,7 +53,6 @@ dependencies = [
|
||||||
"log",
|
"log",
|
||||||
"notify",
|
"notify",
|
||||||
"objc",
|
"objc",
|
||||||
"once_cell",
|
|
||||||
"parking_lot",
|
"parking_lot",
|
||||||
"png",
|
"png",
|
||||||
"raw-window-handle",
|
"raw-window-handle",
|
||||||
|
|
|
@ -32,7 +32,6 @@ home = "0.5.5"
|
||||||
libc = "0.2"
|
libc = "0.2"
|
||||||
log = { version = "0.4", features = ["std", "serde"] }
|
log = { version = "0.4", features = ["std", "serde"] }
|
||||||
notify = "6.1.1"
|
notify = "6.1.1"
|
||||||
once_cell = "1.12"
|
|
||||||
parking_lot = "0.12.0"
|
parking_lot = "0.12.0"
|
||||||
raw-window-handle = "0.5"
|
raw-window-handle = "0.5"
|
||||||
serde = { version = "1", features = ["derive"] }
|
serde = { version = "1", features = ["derive"] }
|
||||||
|
|
|
@ -8,12 +8,11 @@ use std::fs::{File, OpenOptions};
|
||||||
use std::io::{self, LineWriter, Stdout, Write};
|
use std::io::{self, LineWriter, Stdout, Write};
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
use std::sync::atomic::{AtomicBool, Ordering};
|
use std::sync::atomic::{AtomicBool, Ordering};
|
||||||
use std::sync::{Arc, Mutex};
|
use std::sync::{Arc, Mutex, OnceLock};
|
||||||
use std::time::Instant;
|
use std::time::Instant;
|
||||||
use std::{env, process};
|
use std::{env, process};
|
||||||
|
|
||||||
use log::{self, Level, LevelFilter};
|
use log::{self, Level, LevelFilter};
|
||||||
use once_cell::sync::Lazy;
|
|
||||||
use winit::event_loop::EventLoopProxy;
|
use winit::event_loop::EventLoopProxy;
|
||||||
|
|
||||||
use crate::cli::Options;
|
use crate::cli::Options;
|
||||||
|
@ -35,10 +34,14 @@ pub const LOG_TARGET_CONFIG: &str = "alacritty_config_derive";
|
||||||
const ALACRITTY_EXTRA_LOG_TARGETS_ENV: &str = "ALACRITTY_EXTRA_LOG_TARGETS";
|
const ALACRITTY_EXTRA_LOG_TARGETS_ENV: &str = "ALACRITTY_EXTRA_LOG_TARGETS";
|
||||||
|
|
||||||
/// User configurable extra log targets to include.
|
/// User configurable extra log targets to include.
|
||||||
static EXTRA_LOG_TARGETS: Lazy<Vec<String>> = Lazy::new(|| {
|
fn extra_log_targets() -> &'static [String] {
|
||||||
|
static EXTRA_LOG_TARGETS: OnceLock<Vec<String>> = OnceLock::new();
|
||||||
|
|
||||||
|
EXTRA_LOG_TARGETS.get_or_init(|| {
|
||||||
env::var(ALACRITTY_EXTRA_LOG_TARGETS_ENV)
|
env::var(ALACRITTY_EXTRA_LOG_TARGETS_ENV)
|
||||||
.map_or(Vec::new(), |targets| targets.split(';').map(ToString::to_string).collect())
|
.map_or(Vec::new(), |targets| targets.split(';').map(ToString::to_string).collect())
|
||||||
});
|
})
|
||||||
|
}
|
||||||
|
|
||||||
/// List of targets which will be logged by Alacritty.
|
/// List of targets which will be logged by Alacritty.
|
||||||
const ALLOWED_TARGETS: &[&str] = &[
|
const ALLOWED_TARGETS: &[&str] = &[
|
||||||
|
@ -181,7 +184,7 @@ fn create_log_message(record: &log::Record<'_>, target: &str, start: Instant) ->
|
||||||
fn is_allowed_target(level: Level, target: &str) -> bool {
|
fn is_allowed_target(level: Level, target: &str) -> bool {
|
||||||
match (level, log::max_level()) {
|
match (level, log::max_level()) {
|
||||||
(Level::Error, LevelFilter::Trace) | (Level::Warn, LevelFilter::Trace) => true,
|
(Level::Error, LevelFilter::Trace) | (Level::Warn, LevelFilter::Trace) => true,
|
||||||
_ => ALLOWED_TARGETS.contains(&target) || EXTRA_LOG_TARGETS.iter().any(|t| t == target),
|
_ => ALLOWED_TARGETS.contains(&target) || extra_log_targets().iter().any(|t| t == target),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,7 @@ use std::borrow::Cow;
|
||||||
use std::collections::HashSet;
|
use std::collections::HashSet;
|
||||||
use std::ffi::{CStr, CString};
|
use std::ffi::{CStr, CString};
|
||||||
use std::sync::atomic::{AtomicBool, Ordering};
|
use std::sync::atomic::{AtomicBool, Ordering};
|
||||||
|
use std::sync::OnceLock;
|
||||||
use std::{fmt, ptr};
|
use std::{fmt, ptr};
|
||||||
|
|
||||||
use ahash::RandomState;
|
use ahash::RandomState;
|
||||||
|
@ -9,7 +10,6 @@ use crossfont::Metrics;
|
||||||
use glutin::context::{ContextApi, GlContext, PossiblyCurrentContext};
|
use glutin::context::{ContextApi, GlContext, PossiblyCurrentContext};
|
||||||
use glutin::display::{GetGlDisplay, GlDisplay};
|
use glutin::display::{GetGlDisplay, GlDisplay};
|
||||||
use log::{debug, error, info, warn, LevelFilter};
|
use log::{debug, error, info, warn, LevelFilter};
|
||||||
use once_cell::sync::OnceCell;
|
|
||||||
use unicode_width::UnicodeWidthChar;
|
use unicode_width::UnicodeWidthChar;
|
||||||
|
|
||||||
use alacritty_terminal::index::Point;
|
use alacritty_terminal::index::Point;
|
||||||
|
@ -318,7 +318,7 @@ impl GlExtensions {
|
||||||
///
|
///
|
||||||
/// This function will lazily load OpenGL extensions.
|
/// This function will lazily load OpenGL extensions.
|
||||||
fn contains(extension: &str) -> bool {
|
fn contains(extension: &str) -> bool {
|
||||||
static OPENGL_EXTENSIONS: OnceCell<HashSet<&'static str, RandomState>> = OnceCell::new();
|
static OPENGL_EXTENSIONS: OnceLock<HashSet<&'static str, RandomState>> = OnceLock::new();
|
||||||
|
|
||||||
OPENGL_EXTENSIONS.get_or_init(Self::load_extensions).contains(extension)
|
OPENGL_EXTENSIONS.get_or_init(Self::load_extensions).contains(extension)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue