diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml index 2894d1ac0..55b1a1132 100644 --- a/.github/workflows/unit-tests.yml +++ b/.github/workflows/unit-tests.yml @@ -33,7 +33,7 @@ jobs: strategy: matrix: os: [ubuntu-latest, macos-latest, windows-latest] - rust: [1.70.0, stable, beta, nightly] + rust: [1.80.0, stable, beta, nightly] steps: - name: Checkout repository uses: actions/checkout@v4 diff --git a/Cargo.lock b/Cargo.lock index 7d8ac00c8..84267e833 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -453,7 +453,6 @@ dependencies = [ "natord", "nu-ansi-term", "number_prefix", - "once_cell", "palette", "path-clean", "percent-encoding", diff --git a/Cargo.toml b/Cargo.toml index b92e8418d..7e3ca7590 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,7 +6,7 @@ description = "A modern replacement for ls" authors = ["Christina Sørensen "] categories = ["command-line-utilities"] edition = "2021" -rust-version = "1.70.0" +rust-version = "1.80.0" exclude = [ "/devtools/*", "/Justfile", @@ -87,7 +87,6 @@ natord = "1.0" path-clean = "1.0.1" number_prefix = "0.4" palette = { version = "0.7.6", default-features = false, features = ["std"] } -once_cell = "1.20.1" percent-encoding = "2.3.1" phf = { version = "0.11.2", features = ["macros"] } plist = { version = "1.7.0", default-features = false } diff --git a/rust-toolchain.toml b/rust-toolchain.toml index f8b0aec75..3a3d2f50f 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,7 +1,7 @@ # SPDX-FileCopyrightText: 2024 Christina Sørensen # SPDX-License-Identifier: EUPL-1.2 [toolchain] -channel = "1.70" +channel = "1.80" components = [ "rustfmt", "rustc", diff --git a/src/fs/file.rs b/src/fs/file.rs index 58e3bba09..e54d98d8c 100644 --- a/src/fs/file.rs +++ b/src/fs/file.rs @@ -25,7 +25,7 @@ use chrono::prelude::*; use log::*; #[cfg(unix)] -use once_cell::sync::Lazy; +use std::sync::LazyLock; use crate::fs::dir::Dir; use crate::fs::feature::xattr; @@ -40,11 +40,10 @@ use super::mounts::MountedFs; // Maps (device_id, inode) => (size_in_bytes, size_in_blocks) // Mutex::new is const but HashMap::new is not const requiring us to use lazy // initialization. -// TODO: Replace with std::sync::LazyLock when it is stable. #[allow(clippy::type_complexity)] #[cfg(unix)] -static DIRECTORY_SIZE_CACHE: Lazy>> = - Lazy::new(|| Mutex::new(HashMap::new())); +static DIRECTORY_SIZE_CACHE: LazyLock>> = + LazyLock::new(|| Mutex::new(HashMap::new())); /// A **File** is a wrapper around one of Rust’s `PathBuf` values, along with /// associated data about the file. diff --git a/src/output/table.rs b/src/output/table.rs index 923039241..72d65585e 100644 --- a/src/output/table.rs +++ b/src/output/table.rs @@ -12,7 +12,7 @@ use std::sync::{Mutex, MutexGuard}; use chrono::prelude::*; use log::*; -use once_cell::sync::Lazy; +use std::sync::LazyLock; #[cfg(unix)] use uzers::UsersCache; @@ -398,7 +398,7 @@ impl Environment { } } -static ENVIRONMENT: Lazy = Lazy::new(Environment::load_all); +static ENVIRONMENT: LazyLock = LazyLock::new(Environment::load_all); pub struct Table<'a> { columns: Vec, diff --git a/src/output/time.rs b/src/output/time.rs index d1bc6ea5f..8935a574b 100644 --- a/src/output/time.rs +++ b/src/output/time.rs @@ -8,7 +8,7 @@ use chrono::prelude::*; use core::cmp::max; -use once_cell::sync::Lazy; +use std::sync::LazyLock; use std::time::Duration; use unicode_width::UnicodeWidthStr; @@ -140,12 +140,12 @@ fn custom(time: &DateTime, non_recent_fmt: &str, recent_fmt: Option } } -static CURRENT_YEAR: Lazy = Lazy::new(|| Local::now().year()); +static CURRENT_YEAR: LazyLock = LazyLock::new(|| Local::now().year()); -static LOCALE: Lazy = - Lazy::new(|| locale::Time::load_user_locale().unwrap_or_else(|_| locale::Time::english())); +static LOCALE: LazyLock = + LazyLock::new(|| locale::Time::load_user_locale().unwrap_or_else(|_| locale::Time::english())); -static MAX_MONTH_WIDTH: Lazy = Lazy::new(|| { +static MAX_MONTH_WIDTH: LazyLock = LazyLock::new(|| { // Some locales use a three-character wide month name (Jan to Dec); // others vary between three to four (1月 to 12月, juil.). We check each month width // to detect the longest and set the output format accordingly. diff --git a/tests/gen/long_time_style_custom_non_recent_empty_nix.stderr b/tests/gen/long_time_style_custom_non_recent_empty_nix.stderr index 3ada3283f..295e1b87c 100644 --- a/tests/gen/long_time_style_custom_non_recent_empty_nix.stderr +++ b/tests/gen/long_time_style_custom_non_recent_empty_nix.stderr @@ -1,2 +1,3 @@ -thread 'main' panicked at 'Custom timestamp format is empty, please supply a chrono format string after the plus sign.', src/options/view.rs:357:21 +thread 'main' panicked at src/options/view.rs:357:21: +Custom timestamp format is empty, please supply a chrono format string after the plus sign. note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace diff --git a/tests/gen/long_time_style_custom_non_recent_none_nix.stderr b/tests/gen/long_time_style_custom_non_recent_none_nix.stderr index f03122381..bb38a7b17 100644 --- a/tests/gen/long_time_style_custom_non_recent_none_nix.stderr +++ b/tests/gen/long_time_style_custom_non_recent_none_nix.stderr @@ -1,2 +1,3 @@ -thread 'main' panicked at 'Custom timestamp format is empty, please supply a chrono format string after the plus sign.', src/options/view.rs:355:47 +thread 'main' panicked at src/options/view.rs:355:47: +Custom timestamp format is empty, please supply a chrono format string after the plus sign. note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace diff --git a/tests/gen/long_time_style_custom_recent_empty_nix.stderr b/tests/gen/long_time_style_custom_recent_empty_nix.stderr index 3c619484e..68b358378 100644 --- a/tests/gen/long_time_style_custom_recent_empty_nix.stderr +++ b/tests/gen/long_time_style_custom_recent_empty_nix.stderr @@ -1,2 +1,3 @@ -thread 'main' panicked at 'Custom timestamp format for recent files is empty, please supply a chrono format string at the second line.', src/options/view.rs:371:25 +thread 'main' panicked at src/options/view.rs:371:25: +Custom timestamp format for recent files is empty, please supply a chrono format string at the second line. note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace