diff --git a/.changeset/rust-1-100-std-apis.md b/.changeset/rust-1-100-std-apis.md new file mode 100644 index 0000000..d1f9d26 --- /dev/null +++ b/.changeset/rust-1-100-std-apis.md @@ -0,0 +1,5 @@ +--- +"@stll/stdnum": patch +--- + +Raise the Rust crates' minimum supported Rust version to 1.100, use the standard `trim_prefix` and `trim_suffix` string helpers, and reject unused Cargo dependencies at build time. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 6ce1ab9..0b7086b 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -13,7 +13,7 @@ a pull request. ## Development setup ```bash -# Prerequisites: Bun and Rust 1.96 +# Prerequisites: Bun and Rust 1.100 bun install bun run rust:check # lint and test the Rust implementation bun run codegen:check # verify generated bindings, types, and README diff --git a/Cargo.toml b/Cargo.toml index 3e883f0..5ecbaf0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,7 +13,7 @@ version = "2.3.2" edition = "2024" # Minimum supported Rust version; CI uses the shared stable toolchain. # Resolver "3" keeps dependency resolution MSRV-aware. -rust-version = "1.96" +rust-version = "1.100" license = "Apache-2.0" publish = false repository = "https://github.com/stella/stdnum" @@ -33,6 +33,9 @@ unused_macros = "deny" unused_mut = "deny" unused_variables = "deny" +[workspace.lints.cargo] +unused_dependencies = "deny" + [workspace.lints.rustdoc] broken_intra_doc_links = "deny" bare_urls = "deny" diff --git a/crates/stdnum-core/src/validators/additional_a_m.rs b/crates/stdnum-core/src/validators/additional_a_m.rs index b324038..ec71bb4 100644 --- a/crates/stdnum-core/src/validators/additional_a_m.rs +++ b/crates/stdnum-core/src/validators/additional_a_m.rs @@ -347,7 +347,7 @@ fn compact_for(id: &str, value: &str) -> String { } compact } - "cl.rut" => upper.strip_prefix("CL").unwrap_or(&upper).to_owned(), + "cl.rut" => upper.trim_prefix("CL").to_owned(), "gt.nit" => upper.trim_start_matches('0').to_owned(), "il.idnr" => format!("{compact:0>9}"), "eg.tn" | "iq.nid" | "ir.nid" => compact diff --git a/crates/stdnum-core/src/validators/legacy_specs.rs b/crates/stdnum-core/src/validators/legacy_specs.rs index 6e177f7..7df26c1 100644 --- a/crates/stdnum-core/src/validators/legacy_specs.rs +++ b/crates/stdnum-core/src/validators/legacy_specs.rs @@ -1340,7 +1340,7 @@ fn format_for(id: &str, value: &str) -> String { span(&v, 7, v.len()) ), "no.mva" => { - let d = v.strip_suffix("MVA").unwrap_or(&v); + let d = v.trim_suffix("MVA"); format!( "NO {} {} {} MVA", span(d, 0, 3), diff --git a/crates/stdnum-wasm-size-fixture/Cargo.toml b/crates/stdnum-wasm-size-fixture/Cargo.toml index a16cbd4..00d9843 100644 --- a/crates/stdnum-wasm-size-fixture/Cargo.toml +++ b/crates/stdnum-wasm-size-fixture/Cargo.toml @@ -2,7 +2,7 @@ name = "stella-stdnum-wasm-size-fixture" version = "0.0.0" edition = "2024" -rust-version = "1.96" +rust-version = "1.100" license = "Apache-2.0" publish = false