diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-30 03:57:31 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-30 03:57:31 +0000 |
commit | dc0db358abe19481e475e10c32149b53370f1a1c (patch) | |
tree | ab8ce99c4b255ce46f99ef402c27916055b899ee /vendor/clap_lex/src | |
parent | Releasing progress-linux version 1.71.1+dfsg1-2~progress7.99u1. (diff) | |
download | rustc-dc0db358abe19481e475e10c32149b53370f1a1c.tar.xz rustc-dc0db358abe19481e475e10c32149b53370f1a1c.zip |
Merging upstream version 1.72.1+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/clap_lex/src')
-rw-r--r-- | vendor/clap_lex/src/ext.rs | 42 | ||||
-rw-r--r-- | vendor/clap_lex/src/lib.rs | 16 |
2 files changed, 8 insertions, 50 deletions
diff --git a/vendor/clap_lex/src/ext.rs b/vendor/clap_lex/src/ext.rs index 0e6b33ebb..a2de707e2 100644 --- a/vendor/clap_lex/src/ext.rs +++ b/vendor/clap_lex/src/ext.rs @@ -162,39 +162,6 @@ pub trait OsStrExt: private::Sealed { /// /// [`split_whitespace`]: str::split_whitespace fn split<'s, 'n>(&'s self, needle: &'n str) -> Split<'s, 'n>; - /// Divide one string slice into two at an index. - /// - /// The argument, `mid`, should be a byte offset from the start of the - /// string. It must also be on the boundary of a UTF-8 code point. - /// - /// The two slices returned go from the start of the string slice to `mid`, - /// and from `mid` to the end of the string slice. - /// - /// To get mutable string slices instead, see the [`split_at_mut`] - /// method. - /// - /// [`split_at_mut`]: str::split_at_mut - /// - /// # Panics - /// - /// Panics if `mid` is not on a UTF-8 code point boundary, or if it is - /// past the end of the last code point of the string slice. - /// - /// # Examples - /// - /// Basic usage: - /// - /// ``` - /// use clap_lex::OsStrExt as _; - /// let s = std::ffi::OsStr::new("Per Martin-Löf"); - /// - /// let (first, last) = s.split_at(3); - /// - /// assert_eq!("Per", first); - /// assert_eq!(" Martin-Löf", last); - /// ``` - #[deprecated(since = "4.1.0", note = "This is not sound for all `index`")] - fn split_at(&self, index: usize) -> (&OsStr, &OsStr); /// Splits the string on the first occurrence of the specified delimiter and /// returns prefix before delimiter and suffix after delimiter. /// @@ -249,15 +216,6 @@ impl OsStrExt for OsStr { } } - fn split_at(&self, index: usize) -> (&OsStr, &OsStr) { - let bytes = to_bytes(self); - unsafe { - // BUG: This is unsafe and has been deprecated - let (first, second) = bytes.split_at(index); - (to_os_str_unchecked(first), to_os_str_unchecked(second)) - } - } - fn split_once(&self, needle: &'_ str) -> Option<(&OsStr, &OsStr)> { let start = self.find(needle)?; let end = start + needle.len(); diff --git a/vendor/clap_lex/src/lib.rs b/vendor/clap_lex/src/lib.rs index b349fba51..d519a10c5 100644 --- a/vendor/clap_lex/src/lib.rs +++ b/vendor/clap_lex/src/lib.rs @@ -40,7 +40,7 @@ //! Ok(Color::Never) //! } //! Some(invalid) => { -//! Err(format!("Invalid value for `--color`, {:?}", invalid).into()) +//! Err(format!("Invalid value for `--color`, {invalid:?}").into()) //! } //! } //! } @@ -67,7 +67,7 @@ //! match long { //! Ok("verbose") => { //! if let Some(value) = value { -//! return Err(format!("`--verbose` does not take a value, got `{:?}`", value).into()); +//! return Err(format!("`--verbose` does not take a value, got `{value:?}`").into()); //! } //! args.verbosity += 1; //! } @@ -91,7 +91,7 @@ //! args.color = Color::parse(value)?; //! } //! Ok(c) => { -//! return Err(format!("Unexpected flag: -{}", c).into()); +//! return Err(format!("Unexpected flag: -{c}").into()); //! } //! Err(e) => { //! return Err(format!("Unexpected flag: -{}", e.to_string_lossy()).into()); @@ -107,7 +107,7 @@ //! } //! //! let args = parse_args(["bin", "--hello", "world"]); -//! println!("{:?}", args); +//! println!("{args:?}"); //! ``` mod ext; @@ -139,7 +139,7 @@ impl RawArgs { /// let _bin = raw.next_os(&mut cursor); /// /// let mut paths = raw.remaining(&mut cursor).map(PathBuf::from).collect::<Vec<_>>(); - /// println!("{:?}", paths); + /// println!("{paths:?}"); /// ``` pub fn from_args() -> Self { Self::new(std::env::args_os()) @@ -156,7 +156,7 @@ impl RawArgs { /// let _bin = raw.next_os(&mut cursor); /// /// let mut paths = raw.remaining(&mut cursor).map(PathBuf::from).collect::<Vec<_>>(); - /// println!("{:?}", paths); + /// println!("{paths:?}"); /// ``` pub fn new(iter: impl IntoIterator<Item = impl Into<std::ffi::OsString>>) -> Self { let iter = iter.into_iter(); @@ -174,7 +174,7 @@ impl RawArgs { /// let _bin = raw.next_os(&mut cursor); /// /// let mut paths = raw.remaining(&mut cursor).map(PathBuf::from).collect::<Vec<_>>(); - /// println!("{:?}", paths); + /// println!("{paths:?}"); /// ``` pub fn cursor(&self) -> ArgCursor { ArgCursor::new() @@ -213,7 +213,7 @@ impl RawArgs { /// let _bin = raw.next_os(&mut cursor); /// /// let mut paths = raw.remaining(&mut cursor).map(PathBuf::from).collect::<Vec<_>>(); - /// println!("{:?}", paths); + /// println!("{paths:?}"); /// ``` pub fn remaining(&self, cursor: &mut ArgCursor) -> impl Iterator<Item = &OsStr> { let remaining = self.items[cursor.cursor..].iter().map(|s| s.as_os_str()); |