Mercurial > public > mercurial-scm > hg
diff rust/hg-core/src/utils.rs @ 49632:29cf3167e459
hg-core: remove unneeded trait now that we support Rust 1.52+
author | Rapha?l Gom?s <rgomes@octobus.net> |
---|---|
date | Mon, 14 Nov 2022 15:29:58 +0100 |
parents | 5734b03ecf3e |
children | 048f829a445a |
line wrap: on
line diff
--- a/rust/hg-core/src/utils.rs Mon Nov 14 15:20:48 2022 +0100 +++ b/rust/hg-core/src/utils.rs Mon Nov 14 15:29:58 2022 +0100 @@ -145,21 +145,6 @@ } } -pub trait StrExt { - // TODO: Use https://doc.rust-lang.org/nightly/std/primitive.str.html#method.split_once - // once we require Rust 1.52+ - fn split_2(&self, separator: char) -> Option<(&str, &str)>; -} - -impl StrExt for str { - fn split_2(&self, separator: char) -> Option<(&str, &str)> { - let mut iter = self.splitn(2, separator); - let a = iter.next()?; - let b = iter.next()?; - Some((a, b)) - } -} - pub trait Escaped { /// Return bytes escaped for display to the user fn escaped_bytes(&self) -> Vec<u8>;