Skip to content

Commit

Permalink
Dependency Updates (#221)
Browse files Browse the repository at this point in the history
* depsup

* depsup

* depsup

* Fixed lint issues
  • Loading branch information
CraZySacX authored Jan 30, 2025
1 parent 1d09017 commit ab14ffc
Show file tree
Hide file tree
Showing 6 changed files with 72 additions and 48 deletions.
73 changes: 51 additions & 22 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion pudlib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ console = "0.15.8"
const_format = "0.2.34"
dirs2 = "3.0.1"
getset = { workspace = true }
lazy_static = { workspace = true }
rand = "0.8.5"
regex = { workspace = true }
serde = { workspace = true }
Expand Down
14 changes: 8 additions & 6 deletions pudlib/src/header/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,11 @@ fn trace(app_style: Style, prefix: &'static str) -> Result<()> {

#[cfg(test)]
mod test {
use std::sync::LazyLock;

use super::{from_u8, header};
use crate::log::Config as LogConfig;
use console::Style;
use lazy_static::lazy_static;
use regex::Regex;
use tracing::Level;

Expand Down Expand Up @@ -153,11 +154,12 @@ mod test {
}
}

lazy_static! {
static ref BUILD_TIMESTAMP: Regex = Regex::new(r"Timestamp \( build\)").unwrap();
static ref BUILD_SEMVER: Regex = Regex::new(r"Semver \( rustc\)").unwrap();
static ref GIT_BRANCH: Regex = Regex::new(r"Branch \( git\)").unwrap();
}
static BUILD_TIMESTAMP: LazyLock<Regex> =
LazyLock::new(|| Regex::new(r"Timestamp \( build\)").unwrap());
static BUILD_SEMVER: LazyLock<Regex> =
LazyLock::new(|| Regex::new(r"Semver \( rustc\)").unwrap());
static GIT_BRANCH: LazyLock<Regex> =
LazyLock::new(|| Regex::new(r"Branch \( git\)").unwrap());

#[test]
fn from_u8_works() {
Expand Down
8 changes: 3 additions & 5 deletions pudlib/src/log/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,9 @@
// Logging

use anyhow::Result;
use lazy_static::lazy_static;
use std::sync::{
atomic::{AtomicBool, Ordering},
Arc, Mutex,
Arc, LazyLock, Mutex,
};
use time::format_description::well_known::Iso8601;
use tracing::Level;
Expand Down Expand Up @@ -46,9 +45,8 @@ pub trait Config {
fn set_level(&mut self, level: Level) -> &mut Self;
}

lazy_static! {
static ref INIT_LOCK: Arc<Mutex<AtomicBool>> = Arc::new(Mutex::new(AtomicBool::new(false)));
}
static INIT_LOCK: LazyLock<Arc<Mutex<AtomicBool>>> =
LazyLock::new(|| Arc::new(Mutex::new(AtomicBool::new(false))));

/// Initialize tracing
///
Expand Down
10 changes: 4 additions & 6 deletions pudlib/src/schedule/dow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,13 @@ use crate::{
utils::until_err,
};
use anyhow::{anyhow, Result};
use lazy_static::lazy_static;
use regex::Regex;
use std::{collections::HashSet, fmt::Display};
use std::{collections::HashSet, fmt::Display, sync::LazyLock};
use time::Weekday;

lazy_static! {
static ref DOW_RANGE_RE: Regex =
Regex::new(r"([a-zA-Z]{3,})\.\.([a-zA-Z]{3,})").expect("invalid day of week range regex");
}
static DOW_RANGE_RE: LazyLock<Regex> = LazyLock::new(|| {
Regex::new(r"([a-zA-Z]{3,})\.\.([a-zA-Z]{3,})").expect("invalid day of week range regex")
});

/// The day of the week for a realtime schedule
#[derive(Clone, Debug, Eq, Hash, PartialEq)]
Expand Down
14 changes: 6 additions & 8 deletions pudlib/src/schedule/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,22 +21,20 @@ use crate::{
utils::until_err,
};
use anyhow::Result;
use lazy_static::lazy_static;
use regex::Regex;
use std::collections::HashSet;
use std::{collections::HashSet, sync::LazyLock};
use time::OffsetDateTime;
use typed_builder::TypedBuilder;

pub(crate) mod dow;
pub(crate) mod hms;
pub(crate) mod ymd;

lazy_static! {
static ref RANGE_RE: Regex =
Regex::new(r"(\d{1,2})\.\.(\d{1,2})").expect("invalid range regex");
static ref REP_RE: Regex =
Regex::new(r"(\d{1,2})(\.\.(\d{1,2}))?/(\d{1,2})").expect("invalid repetition regex");
}
static RANGE_RE: LazyLock<Regex> =
LazyLock::new(|| Regex::new(r"(\d{1,2})\.\.(\d{1,2})").expect("invalid range regex"));
static REP_RE: LazyLock<Regex> = LazyLock::new(|| {
Regex::new(r"(\d{1,2})(\.\.(\d{1,2}))?/(\d{1,2})").expect("invalid repetition regex")
});

const MINUTELY: &str = "minutely";
const HOURLY: &str = "hourly";
Expand Down

0 comments on commit ab14ffc

Please sign in to comment.