Mercurial > public > mercurial-scm > hg-stable
comparison rust/hg-core/src/utils.rs @ 49751:048f829a445a
hg-core: remove unneeded util now that we support Rust 1.42+
author | Rapha?l Gom?s <rgomes@octobus.net> |
---|---|
date | Mon, 14 Nov 2022 15:31:49 +0100 |
parents | 29cf3167e459 |
children | ec399ddf6764 |
comparison
equal
deleted
inserted
replaced
49750:29cf3167e459 | 49751:048f829a445a |
---|---|
191 } | 191 } |
192 | 192 |
193 impl<'a> Escaped for &'a HgPath { | 193 impl<'a> Escaped for &'a HgPath { |
194 fn escaped_bytes(&self) -> Vec<u8> { | 194 fn escaped_bytes(&self) -> Vec<u8> { |
195 self.as_bytes().escaped_bytes() | 195 self.as_bytes().escaped_bytes() |
196 } | |
197 } | |
198 | |
199 // TODO: use the str method when we require Rust 1.45 | |
200 pub(crate) fn strip_suffix<'a>(s: &'a str, suffix: &str) -> Option<&'a str> { | |
201 if s.ends_with(suffix) { | |
202 Some(&s[..s.len() - suffix.len()]) | |
203 } else { | |
204 None | |
205 } | 196 } |
206 } | 197 } |
207 | 198 |
208 #[cfg(unix)] | 199 #[cfg(unix)] |
209 pub fn shell_quote(value: &[u8]) -> Vec<u8> { | 200 pub fn shell_quote(value: &[u8]) -> Vec<u8> { |