From 36d22d82aa202bb199967e9512281e9a53db42c9 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 21:33:14 +0200 Subject: Adding upstream version 115.7.0esr. Signed-off-by: Daniel Baumann --- third_party/rust/semver/src/backport.rs | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 third_party/rust/semver/src/backport.rs (limited to 'third_party/rust/semver/src/backport.rs') diff --git a/third_party/rust/semver/src/backport.rs b/third_party/rust/semver/src/backport.rs new file mode 100644 index 0000000000..b5e1d02be5 --- /dev/null +++ b/third_party/rust/semver/src/backport.rs @@ -0,0 +1,23 @@ +#[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; + +#[cfg(no_alloc_crate)] // rustc <1.36 +pub(crate) mod alloc { + pub use std::alloc; + pub use std::vec; +} -- cgit v1.2.3