Skip to content

Commit

Permalink
remove once_cell as dependency
Browse files Browse the repository at this point in the history
our MSVR at least 1.71.0, and once_cell was merge into std in 1.70.0,
so there are no reason to use external one instead of std
  • Loading branch information
Dushistov committed Jun 15, 2024
1 parent 772434e commit 038b0dc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ default = ["regex"]
regex = ["env_filter/regex"]

[dependencies]
once_cell = "1.9"
env_filter = "0.1.0"
env_logger = "0.11.2"

Expand Down
10 changes: 5 additions & 5 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@
#[cfg(target_os = "android")]
extern crate android_log_sys as log_ffi;
use once_cell::sync::OnceCell;

use log::{Level, LevelFilter, Log, Metadata, Record};
#[cfg(target_os = "android")]
Expand All @@ -74,6 +73,7 @@ use std::ffi::{CStr, CString};
use std::fmt;
use std::mem::{self, MaybeUninit};
use std::ptr;
use std::sync::OnceLock;

pub use env_filter::{Builder as FilterBuilder, Filter};
pub use env_logger::fmt::Formatter;
Expand Down Expand Up @@ -162,14 +162,14 @@ fn android_log(_buf_id: Option<LogId>, _priority: Level, _tag: &CStr, _msg: &CSt

/// Underlying android logger backend
pub struct AndroidLogger {
config: OnceCell<Config>,
config: OnceLock<Config>,
}

impl AndroidLogger {
/// Create new logger instance from config
pub fn new(config: Config) -> AndroidLogger {
AndroidLogger {
config: OnceCell::from(config),
config: OnceLock::from(config),
}
}

Expand All @@ -178,7 +178,7 @@ impl AndroidLogger {
}
}

static ANDROID_LOGGER: OnceCell<AndroidLogger> = OnceCell::new();
static ANDROID_LOGGER: OnceLock<AndroidLogger> = OnceLock::new();

const LOGGING_TAG_MAX_LEN: usize = 23;
const LOGGING_MSG_MAX_LEN: usize = 4000;
Expand All @@ -187,7 +187,7 @@ impl Default for AndroidLogger {
/// Create a new logger with default config
fn default() -> AndroidLogger {
AndroidLogger {
config: OnceCell::from(Config::default()),
config: OnceLock::from(Config::default()),
}
}
}
Expand Down

0 comments on commit 038b0dc

Please sign in to comment.