From 183d465f74f4c818a6d8ccb6e580b17003d02ca3 Mon Sep 17 00:00:00 2001 From: Daniel Hofstetter Date: Sun, 3 Sep 2023 16:20:15 +0200 Subject: [PATCH] uucore: turn ranges into a feature --- src/uu/cut/Cargo.toml | 2 +- src/uu/numfmt/Cargo.toml | 2 +- src/uucore/Cargo.toml | 1 + src/uucore/src/lib/features.rs | 2 ++ src/uucore/src/lib/{mods => features}/ranges.rs | 0 src/uucore/src/lib/lib.rs | 3 ++- src/uucore/src/lib/mods.rs | 1 - 7 files changed, 7 insertions(+), 4 deletions(-) rename src/uucore/src/lib/{mods => features}/ranges.rs (100%) diff --git a/src/uu/cut/Cargo.toml b/src/uu/cut/Cargo.toml index be3ffe7f03f..affeb38058f 100644 --- a/src/uu/cut/Cargo.toml +++ b/src/uu/cut/Cargo.toml @@ -16,7 +16,7 @@ path = "src/cut.rs" [dependencies] clap = { workspace = true } -uucore = { workspace = true } +uucore = { workspace = true, features = ["ranges"] } memchr = { workspace = true } bstr = { workspace = true } is-terminal = { workspace = true } diff --git a/src/uu/numfmt/Cargo.toml b/src/uu/numfmt/Cargo.toml index c334a53e360..8fbf886a241 100644 --- a/src/uu/numfmt/Cargo.toml +++ b/src/uu/numfmt/Cargo.toml @@ -16,7 +16,7 @@ path = "src/numfmt.rs" [dependencies] clap = { workspace = true } -uucore = { workspace = true } +uucore = { workspace = true, features = ["ranges"] } [[bin]] name = "numfmt" diff --git a/src/uucore/Cargo.toml b/src/uucore/Cargo.toml index 79b7c39d7d9..fcbfdeac757 100644 --- a/src/uucore/Cargo.toml +++ b/src/uucore/Cargo.toml @@ -82,6 +82,7 @@ mode = ["libc"] perms = ["libc", "walkdir"] pipes = [] process = ["libc"] +ranges = [] ringbuffer = [] signals = [] sum = [ diff --git a/src/uucore/src/lib/features.rs b/src/uucore/src/lib/features.rs index c2dc975dce1..786a6468239 100644 --- a/src/uucore/src/lib/features.rs +++ b/src/uucore/src/lib/features.rs @@ -16,6 +16,8 @@ pub mod fsext; pub mod lines; #[cfg(feature = "memo")] pub mod memo; +#[cfg(feature = "ranges")] +pub mod ranges; #[cfg(feature = "ringbuffer")] pub mod ringbuffer; #[cfg(feature = "sum")] diff --git a/src/uucore/src/lib/mods/ranges.rs b/src/uucore/src/lib/features/ranges.rs similarity index 100% rename from src/uucore/src/lib/mods/ranges.rs rename to src/uucore/src/lib/features/ranges.rs diff --git a/src/uucore/src/lib/lib.rs b/src/uucore/src/lib/lib.rs index 30ebae25429..5b9f4ae1266 100644 --- a/src/uucore/src/lib/lib.rs +++ b/src/uucore/src/lib/lib.rs @@ -26,7 +26,6 @@ pub use crate::mods::line_ending; pub use crate::mods::os; pub use crate::mods::panic; pub use crate::mods::quoting_style; -pub use crate::mods::ranges; pub use crate::mods::version_cmp; // * string parsing modules @@ -48,6 +47,8 @@ pub use crate::features::fsext; pub use crate::features::lines; #[cfg(feature = "memo")] pub use crate::features::memo; +#[cfg(feature = "ranges")] +pub use crate::features::ranges; #[cfg(feature = "ringbuffer")] pub use crate::features::ringbuffer; #[cfg(feature = "sum")] diff --git a/src/uucore/src/lib/mods.rs b/src/uucore/src/lib/mods.rs index 99055d014f1..caa8fcb9290 100644 --- a/src/uucore/src/lib/mods.rs +++ b/src/uucore/src/lib/mods.rs @@ -9,7 +9,6 @@ pub mod error; pub mod line_ending; pub mod os; pub mod panic; -pub mod ranges; pub mod version_cmp; // dir and vdir also need access to the quoting_style module pub mod quoting_style;