From 1f978e217e4e5040372208a14d4012ec3e9abbd7 Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Sun, 14 Sep 2025 09:44:53 -0700 Subject: [PATCH] Delete no_str_strip_prefix configuration --- build.rs | 7 ------- src/backport.rs | 16 ---------------- src/lib.rs | 1 - 3 files changed, 24 deletions(-) diff --git a/build.rs b/build.rs index 38a6d9fa..46436f3b 100644 --- a/build.rs +++ b/build.rs @@ -12,18 +12,11 @@ fn main() { if compiler >= 80 { println!("cargo:rustc-check-cfg=cfg(no_nonzero_bitscan)"); - println!("cargo:rustc-check-cfg=cfg(no_str_strip_prefix)"); println!("cargo:rustc-check-cfg=cfg(no_track_caller)"); println!("cargo:rustc-check-cfg=cfg(no_unsafe_op_in_unsafe_fn_lint)"); println!("cargo:rustc-check-cfg=cfg(test_node_semver)"); } - if compiler < 45 { - // String::strip_prefix. - // https://doc.rust-lang.org/std/primitive.str.html#method.strip_prefix - println!("cargo:rustc-cfg=no_str_strip_prefix"); - } - if compiler < 46 { // #[track_caller]. // https://blog.rust-lang.org/2020/08/27/Rust-1.46.0.html#track_caller diff --git a/src/backport.rs b/src/backport.rs index 979166ba..221ee4a1 100644 --- a/src/backport.rs +++ b/src/backport.rs @@ -1,17 +1 @@ -#[cfg(no_str_strip_prefix)] // rustc <1.45 -pub(crate) trait StripPrefixExt { - fn strip_prefix(&self, ch: char) -> Option<&str>; -} - -#[cfg(no_str_strip_prefix)] -impl StripPrefixExt for str { - fn strip_prefix(&self, ch: char) -> Option<&str> { - if self.starts_with(ch) { - Some(&self[ch.len_utf8()..]) - } else { - None - } - } -} - pub(crate) use crate::alloc::vec::Vec; diff --git a/src/lib.rs b/src/lib.rs index d07d2fde..cd20459e 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -65,7 +65,6 @@ #![cfg_attr(not(feature = "std"), no_std)] #![cfg_attr(not(no_unsafe_op_in_unsafe_fn_lint), deny(unsafe_op_in_unsafe_fn))] #![cfg_attr(no_unsafe_op_in_unsafe_fn_lint, allow(unused_unsafe))] -#![cfg_attr(no_str_strip_prefix, allow(unstable_name_collisions))] #![allow( clippy::cast_lossless, clippy::cast_possible_truncation,