From d1def6f1a8b64bc425d3ac6cbff07513f8112ce4 Mon Sep 17 00:00:00 2001 From: Daniel Hofstetter Date: Sat, 5 Apr 2025 14:09:15 +0200 Subject: [PATCH 1/5] Update dependencies --- Cargo.lock | 86 +++++++++++++++++++++++------------------------------- 1 file changed, 36 insertions(+), 50 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 81d2d3eb..878dd87e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -96,9 +96,9 @@ checksum = "1628fb46dfa0b37568d12e5edd512553eccf6a22a78e8bde00bb4aed84d5bdbf" [[package]] name = "cc" -version = "1.2.16" +version = "1.2.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be714c154be609ec7f5dad223a33bf1482fff90472de28f7362806e6d4832b8c" +checksum = "8691782945451c1c383942c4874dbe63814f61cb57ef773cda2972682b7bb3c0" dependencies = [ "shlex", ] @@ -129,9 +129,9 @@ dependencies = [ [[package]] name = "chrono-tz" -version = "0.10.1" +version = "0.10.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c6ac4f2c0bf0f44e9161aec9675e1050aa4a530663c4a9e37e108fa948bca9f" +checksum = "efdce149c370f133a071ca8ef6ea340b7b88748ab0810097a9e2976eaa34b4f3" dependencies = [ "chrono", "chrono-tz-build", @@ -140,9 +140,9 @@ dependencies = [ [[package]] name = "chrono-tz-build" -version = "0.4.0" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e94fea34d77a245229e7746bd2beb786cd2a896f306ff491fb8cecb3074b10a7" +checksum = "8f10f8c9340e31fc120ff885fcdb54a0b48e474bbd77cab557f0c30a3e569402" dependencies = [ "parse-zoneinfo", "phf_codegen", @@ -225,9 +225,9 @@ checksum = "4f211af61d8efdd104f96e57adf5e426ba1bc3ed7a4ead616e15e5881fd79c4d" [[package]] name = "deranged" -version = "0.4.1" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28cfac68e08048ae1883171632c2aef3ebc555621ae56fbccce1cbf22dd7f058" +checksum = "9c9e6a11ca8224451684bc0d7d5a7adbf8f2fd6887261a1cfc3c0432f9d4068e" dependencies = [ "powerfmt", ] @@ -267,9 +267,9 @@ checksum = "7454e41ff9012c00d53cf7f475c5e3afa3b91b7c90568495495e8d9bf47a1055" [[package]] name = "errno" -version = "0.3.10" +version = "0.3.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33d852cb9b869c2a9b3df2f71a3074817f01e1844f839a144f5fcef059a4eb5d" +checksum = "976dd42dc7e85965fe702eb8164f21f450704bdde31faefd6471dba214cb594e" dependencies = [ "libc", "windows-sys 0.59.0", @@ -301,16 +301,17 @@ checksum = "a8d1add55171497b4705a648c6b583acafb01d58050a51727785f0b2c8e0a2b2" [[package]] name = "iana-time-zone" -version = "0.1.61" +version = "0.1.63" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "235e081f3925a06703c2d0117ea8b91f042756fd6e7a6e5d901e8ca1a996b220" +checksum = "b0c919e5debc312ad217002b8048a17b7d83f80703865bbfcfebb0458b0b27d8" dependencies = [ "android_system_properties", "core-foundation-sys", "iana-time-zone-haiku", "js-sys", + "log", "wasm-bindgen", - "windows-core 0.52.0", + "windows-core", ] [[package]] @@ -352,15 +353,15 @@ checksum = "d750af042f7ef4f724306de029d18836c26c1765a54a6a3f094cbd23a7267ffa" [[package]] name = "linux-raw-sys" -version = "0.9.3" +version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe7db12097d22ec582439daf8618b8fdd1a7bef6270e9af3b1ebcd30893cf413" +checksum = "cd945864f07fe9f5371a27ad7b52a172b4b499999f1d97574c9fa68373937e12" [[package]] name = "log" -version = "0.4.26" +version = "0.4.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30bde2b3dc3671ae49d8e2e9f044c7c005836e7a023ee57cffa25ab82764bb9e" +checksum = "13dc2df351e3202783a1fe0d44375f7295ffb4049267b0f3018346dc122a1d94" [[package]] name = "memchr" @@ -446,11 +447,11 @@ checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" [[package]] name = "os_display" -version = "0.1.3" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a6229bad892b46b0dcfaaeb18ad0d2e56400f5aaea05b768bde96e73676cf75" +checksum = "ad5fd71b79026fb918650dde6d125000a233764f1c2f1659a1c71118e33ea08f" dependencies = [ - "unicode-width 0.1.14", + "unicode-width", ] [[package]] @@ -527,9 +528,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.94" +version = "1.0.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a31971752e70b8b2686d7e46ec17fb38dad4051d94024c88df49b667caea9c84" +checksum = "02b3e5e68a3a1a02aad3ec490a98007cbc13c37cbe84a3cd7b8e406d76e7f778" dependencies = [ "unicode-ident", ] @@ -639,9 +640,9 @@ checksum = "88f8660c1ff60292143c98d08fc6e2f654d722db50410e3f3797d40baaf9d8f3" [[package]] name = "rustix" -version = "1.0.3" +version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e56a18552996ac8d29ecc3b190b4fdbb2d91ca4ec396de7bbffaf43f3d637e96" +checksum = "c71e83d6afe7ff64890ec6b71d6a69bb8a610ab78ce364b3352876bb4c801266" dependencies = [ "bitflags", "errno", @@ -737,9 +738,9 @@ checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" [[package]] name = "syn" -version = "2.0.100" +version = "2.0.101" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b09a44accad81e1ba1cd74a32461ba89dee89095ba17b32f5d03683b1b1fc2a0" +checksum = "8ce2b7fc941b3a24138a0a7cf8e858bfc6a992e7978a068a5c760deb0ed43caf" dependencies = [ "proc-macro2", "quote", @@ -792,7 +793,7 @@ dependencies = [ "smawk", "terminal_size", "unicode-linebreak", - "unicode-width 0.2.0", + "unicode-width", ] [[package]] @@ -840,12 +841,6 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3b09c83c3c29d37506a3e260c08c03743a6bb66a9cd432c6934ab501a190571f" -[[package]] -name = "unicode-width" -version = "0.1.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7dd6e30e90baa6f72411720665d41d89b9a3d039dc45b8faea1ddd07f617f6af" - [[package]] name = "unicode-width" version = "0.2.0" @@ -1032,7 +1027,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c5ee8f3d025738cb02bad7868bbb5f8a6327501e870bf51f1b455b0a2454a419" dependencies = [ "windows-collections", - "windows-core 0.61.0", + "windows-core", "windows-future", "windows-link", "windows-numerics", @@ -1044,16 +1039,7 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3beeceb5e5cfd9eb1d76b381630e82c4241ccd0d27f1a39ed41b2760b255c5e8" dependencies = [ - "windows-core 0.61.0", -] - -[[package]] -name = "windows-core" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9" -dependencies = [ - "windows-targets 0.52.6", + "windows-core", ] [[package]] @@ -1075,7 +1061,7 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a1d6bbefcb7b60acd19828e1bc965da6fcf18a7e39490c5f8be71e54a19ba32" dependencies = [ - "windows-core 0.61.0", + "windows-core", "windows-link", ] @@ -1113,7 +1099,7 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9150af68066c4c5c07ddc0ce30421554771e528bde427614c61038bc2c92c2b1" dependencies = [ - "windows-core 0.61.0", + "windows-core", "windows-link", ] @@ -1310,18 +1296,18 @@ checksum = "cfe53a6657fd280eaa890a3bc59152892ffa3e30101319d168b781ed6529b049" [[package]] name = "zerocopy" -version = "0.8.23" +version = "0.8.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd97444d05a4328b90e75e503a34bad781f14e28a823ad3557f0750df1ebcbc6" +checksum = "a1702d9583232ddb9174e01bb7c15a2ab8fb1bc6f227aa1233858c351a3ba0cb" dependencies = [ "zerocopy-derive", ] [[package]] name = "zerocopy-derive" -version = "0.8.23" +version = "0.8.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6352c01d0edd5db859a63e2605f4ea3183ddbd15e2c4a9e7d32184df75e4f154" +checksum = "28a6e20d751156648aa063f3800b706ee209a32c0b4d9f24be3d980b01be55ef" dependencies = [ "proc-macro2", "quote", From b6d54ea2816aad4b8cecea0c5c7d61cae241df6c Mon Sep 17 00:00:00 2001 From: Daniel Hofstetter Date: Sat, 5 Apr 2025 14:11:15 +0200 Subject: [PATCH 2/5] Cargo.toml: use edition 2024 --- Cargo.toml | 3 +-- src/uu/sed/Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 0d4b88aa..6fb2312e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -16,8 +16,7 @@ repository = "https://github.com/uutils/sed" readme = "README.md" keywords = ["sed", "uutils", "cross-platform", "cli", "utility"] categories = ["command-line-utilities"] -rust-version = "1.70.0" -edition = "2021" +edition = "2024" build = "build.rs" diff --git a/src/uu/sed/Cargo.toml b/src/uu/sed/Cargo.toml index 4a095456..2b89299e 100644 --- a/src/uu/sed/Cargo.toml +++ b/src/uu/sed/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "uu_sed" version = "0.0.1" -edition = "2021" +edition = "2024" authors = ["uutils developers"] license = "MIT" description = "sed ~ (uutils) stream editor for filtering/transforming text" From e5b9241eb250f1de621256a5b9622fbf009c4c4d Mon Sep 17 00:00:00 2001 From: Daniel Hofstetter Date: Sat, 5 Apr 2025 14:18:21 +0200 Subject: [PATCH 3/5] Format code --- src/bin/uudoc.rs | 4 +++- src/uu/sed/src/delimited_parser.rs | 21 ++++++++++++--------- src/uu/sed/src/sed.rs | 12 ++++-------- 3 files changed, 19 insertions(+), 18 deletions(-) diff --git a/src/bin/uudoc.rs b/src/bin/uudoc.rs index 3dcf2a9a..c4890cbd 100644 --- a/src/bin/uudoc.rs +++ b/src/bin/uudoc.rs @@ -20,7 +20,9 @@ fn main() -> io::Result<()> { if tldr_zip.is_none() { println!("Warning: No tldr archive found, so the documentation will not include examples."); - println!("To include examples in the documentation, download the tldr archive and put it in the docs/ folder."); + println!( + "To include examples in the documentation, download the tldr archive and put it in the docs/ folder." + ); println!(); println!(" curl https://tldr.sh/assets/tldr.zip -o docs/tldr.zip"); println!(); diff --git a/src/uu/sed/src/delimited_parser.rs b/src/uu/sed/src/delimited_parser.rs index ff71653c..7a5dd269 100644 --- a/src/uu/sed/src/delimited_parser.rs +++ b/src/uu/sed/src/delimited_parser.rs @@ -809,9 +809,10 @@ mod tests { fn errors_on_backslash_delimiter() { let (lines, mut line) = make_providers("\\bad"); let err = parse_regex(&lines, &mut line).unwrap_err(); - assert!(err - .to_string() - .contains("\\ cannot be used as a string delimiter")); + assert!( + err.to_string() + .contains("\\ cannot be used as a string delimiter") + ); } #[test] @@ -899,17 +900,19 @@ mod tests { fn errors_on_unterminated_transliteration() { let (lines, mut line) = make_providers("/unterminated"); let err = parse_transliteration(&lines, &mut line).unwrap_err(); - assert!(err - .to_string() - .contains("unterminated transliteration string")); + assert!( + err.to_string() + .contains("unterminated transliteration string") + ); } #[test] fn errors_on_esc_at_tr_eol() { let (lines, mut line) = make_providers("/foo\\"); let err = parse_transliteration(&lines, &mut line).unwrap_err(); - assert!(err - .to_string() - .contains("unterminated transliteration string")); + assert!( + err.to_string() + .contains("unterminated transliteration string") + ); } } diff --git a/src/uu/sed/src/sed.rs b/src/uu/sed/src/sed.rs index 1f736296..20541e96 100644 --- a/src/uu/sed/src/sed.rs +++ b/src/uu/sed/src/sed.rs @@ -18,7 +18,7 @@ pub mod script_line_provider; use crate::command::{CliOptions, ScriptValue}; use crate::compiler::compile; use crate::processor::process; -use clap::{arg, Arg, ArgMatches, Command}; +use clap::{Arg, ArgMatches, Command, arg}; use std::path::PathBuf; use uucore::error::{UResult, UUsageError}; use uucore::format_usage; @@ -177,13 +177,9 @@ fn build_context(matches: &ArgMatches) -> CliOptions { regexp_extended: matches.get_flag("regexp-extended"), follow_symlinks: matches.get_flag("follow-symlinks"), in_place: matches.contains_id("in-place"), - in_place_suffix: matches.get_one::("in-place").and_then(|s| { - if s.is_empty() { - None - } else { - Some(s.clone()) - } - }), + in_place_suffix: matches + .get_one::("in-place") + .and_then(|s| if s.is_empty() { None } else { Some(s.clone()) }), length: matches .get_one::("length") .map(|v| *v as usize) From 1a34e18e37f654b7217981500a22dd5260cd6a7a Mon Sep 17 00:00:00 2001 From: Daniel Hofstetter Date: Sat, 5 Apr 2025 14:26:15 +0200 Subject: [PATCH 4/5] Cargo.toml: order entries alphabetically --- Cargo.toml | 30 +++++++++++++++--------------- src/uu/sed/Cargo.toml | 2 +- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 6fb2312e..9a14a9c8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -29,46 +29,46 @@ feat_common_core = [ ] [workspace.dependencies] -uucore = "0.0.30" +bytesize = "2.0.0" +chrono = { version = "0.4.37", default-features = false, features = [ + "clock", +] } clap = { version = "4.4", features = ["wrap_help", "cargo"] } clap_complete = "4.5" clap_mangen = "0.2" -regex = "1.10.4" -sysinfo = "0.35" libc = "0.2.153" once_cell = "1.21" phf = "0.11.2" phf_codegen = "0.11.2" +rand = { version = "0.9", features = ["small_rng"] } +regex = "1.10.4" +sysinfo = "0.35" +tempfile = "3.10.1" textwrap = { version = "0.16.1", features = ["terminal_size"] } +uucore = "0.0.30" xattr = "1.3.1" -tempfile = "3.10.1" -rand = { version = "0.9", features = ["small_rng"] } -bytesize = "2.0.0" -chrono = { version = "0.4.37", default-features = false, features = [ - "clock", -] } [dependencies] clap = { workspace = true } clap_complete = { workspace = true } clap_mangen = { workspace = true } -uucore = { workspace = true } phf = { workspace = true } -textwrap = { workspace = true } sysinfo = { workspace = true } +textwrap = { workspace = true } +uucore = { workspace = true } +ctor = "0.4.1" sed = { optional = true, version = "0.0.1", package = "uu_sed", path = "src/uu/sed" } uutests = "0.0.30" -ctor = "0.4.1" [dev-dependencies] +chrono = { workspace = true } +libc = { workspace = true } pretty_assertions = "1" +rand = { workspace = true } regex = { workspace = true } tempfile = { workspace = true } -libc = { workspace = true } -rand = { workspace = true } uucore = { workspace = true, features = ["entries", "process", "signals"] } -chrono = { workspace = true } [target.'cfg(unix)'.dev-dependencies] xattr = { workspace = true } diff --git a/src/uu/sed/Cargo.toml b/src/uu/sed/Cargo.toml index 2b89299e..2671125c 100644 --- a/src/uu/sed/Cargo.toml +++ b/src/uu/sed/Cargo.toml @@ -13,11 +13,11 @@ categories = ["command-line-utilities"] [dependencies] -uucore = { workspace = true } clap = { workspace = true } once_cell = { workspace = true } regex = { workspace = true } tempfile = { workspace = true } +uucore = { workspace = true } [lib] path = "src/sed.rs" From 93eb8f97b4c9c9aad864b81ce92ca1a8552a948d Mon Sep 17 00:00:00 2001 From: Daniel Hofstetter Date: Sat, 5 Apr 2025 14:28:21 +0200 Subject: [PATCH 5/5] Cargo.toml: cleanup spell-checker:ignore entries --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 9a14a9c8..3ae96336 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ # sed (uutils) # * see the repository LICENSE, README, and CONTRIBUTING files for more information -# spell-checker:ignore (libs) bigdecimal datetime fundu gethostid kqueue libselinux mangen memmap sed uuhelp +# spell-checker:ignore (libs) mangen sed [package] name = "sed"