Drop lazy_static (#1168)
Co-authored-by: Stuart Reilly <sreilly@scottlogic.com>
This commit is contained in:
@@ -1,17 +1,16 @@
|
||||
use std::ffi::OsString;
|
||||
use std::path::PathBuf;
|
||||
use std::process::Command;
|
||||
use std::{env, path::Path};
|
||||
use std::{fs, io::Write};
|
||||
|
||||
use color_eyre::eyre::eyre;
|
||||
use color_eyre::eyre::Context;
|
||||
use color_eyre::eyre::Result;
|
||||
use jetbrains_toolbox_updater::{find_jetbrains_toolbox, update_jetbrains_toolbox, FindError};
|
||||
use lazy_static::lazy_static;
|
||||
use regex::bytes::Regex;
|
||||
use rust_i18n::t;
|
||||
use semver::Version;
|
||||
use std::ffi::OsString;
|
||||
use std::path::PathBuf;
|
||||
use std::process::Command;
|
||||
use std::sync::LazyLock;
|
||||
use std::{env, path::Path};
|
||||
use std::{fs, io::Write};
|
||||
use tempfile::tempfile_in;
|
||||
use tracing::{debug, error};
|
||||
|
||||
@@ -1233,9 +1232,8 @@ pub fn run_poetry(ctx: &ExecutionContext) -> Result<()> {
|
||||
use std::ffi::OsStr;
|
||||
use std::os::unix::ffi::OsStrExt;
|
||||
|
||||
lazy_static! {
|
||||
static ref SHEBANG_REGEX: Regex = Regex::new(r"^#![ \t]*([^ \t\n]+)(?:[ \t]+([^\n]+)?)?").unwrap();
|
||||
}
|
||||
static SHEBANG_REGEX: LazyLock<Regex> =
|
||||
LazyLock::new(|| Regex::new(r"^#![ \t]*([^ \t\n]+)(?:[ \t]+([^\n]+)?)?").unwrap());
|
||||
|
||||
let script = fs::read(poetry)?;
|
||||
if let Some(c) = SHEBANG_REGEX.captures(&script) {
|
||||
@@ -1254,10 +1252,8 @@ pub fn run_poetry(ctx: &ExecutionContext) -> Result<()> {
|
||||
|
||||
use std::str;
|
||||
|
||||
lazy_static! {
|
||||
static ref SHEBANG_REGEX: Regex =
|
||||
Regex::new(r#"^#![ \t]*(?:"([^"\n]+)"|([^" \t\n]+))(?:[ \t]+([^\n]+)?)?"#).unwrap();
|
||||
}
|
||||
static SHEBANG_REGEX: LazyLock<Regex> =
|
||||
LazyLock::new(|| Regex::new(r#"^#![ \t]*(?:"([^"\n]+)"|([^" \t\n]+))(?:[ \t]+([^\n]+)?)?"#).unwrap());
|
||||
|
||||
let data = fs::read(poetry)?;
|
||||
|
||||
|
||||
@@ -1,11 +1,3 @@
|
||||
use std::ffi::OsStr;
|
||||
use std::fs;
|
||||
use std::os::unix::fs::MetadataExt;
|
||||
use std::path::Component;
|
||||
use std::path::PathBuf;
|
||||
use std::process::Command;
|
||||
use std::{env::var, path::Path};
|
||||
|
||||
use crate::command::CommandExt;
|
||||
use crate::{output_changed_message, Step, HOME_DIR};
|
||||
use color_eyre::eyre::eyre;
|
||||
@@ -13,12 +5,19 @@ use color_eyre::eyre::Context;
|
||||
use color_eyre::eyre::Result;
|
||||
use home;
|
||||
use ini::Ini;
|
||||
use lazy_static::lazy_static;
|
||||
#[cfg(target_os = "linux")]
|
||||
use nix::unistd::Uid;
|
||||
use regex::Regex;
|
||||
use rust_i18n::t;
|
||||
use semver::Version;
|
||||
use std::ffi::OsStr;
|
||||
use std::fs;
|
||||
use std::os::unix::fs::MetadataExt;
|
||||
use std::path::Component;
|
||||
use std::path::PathBuf;
|
||||
use std::process::Command;
|
||||
use std::sync::LazyLock;
|
||||
use std::{env::var, path::Path};
|
||||
use tracing::debug;
|
||||
|
||||
#[cfg(target_os = "linux")]
|
||||
@@ -461,10 +460,8 @@ pub fn run_nix(ctx: &ExecutionContext) -> Result<()> {
|
||||
"`nix --version` output"
|
||||
);
|
||||
|
||||
lazy_static! {
|
||||
static ref NIX_VERSION_REGEX: Regex =
|
||||
Regex::new(r"^nix \([^)]*\) ([0-9.]+)").expect("Nix version regex always compiles");
|
||||
}
|
||||
static NIX_VERSION_REGEX: LazyLock<Regex> =
|
||||
LazyLock::new(|| Regex::new(r"^nix \([^)]*\) ([0-9.]+)").expect("Nix version regex always compiles"));
|
||||
|
||||
if get_version_cmd_first_line_stdout.is_empty() {
|
||||
return Err(eyre!("`nix --version` output was empty"));
|
||||
|
||||
Reference in New Issue
Block a user