@@ -162,39 +162,6 @@ pub trait OsStrExt: private::Sealed {
162162 ///
163163 /// [`split_whitespace`]: str::split_whitespace
164164 fn split < ' s , ' n > ( & ' s self , needle : & ' n str ) -> Split < ' s , ' n > ;
165- /// Divide one string slice into two at an index.
166- ///
167- /// The argument, `mid`, should be a byte offset from the start of the
168- /// string. It must also be on the boundary of a UTF-8 code point.
169- ///
170- /// The two slices returned go from the start of the string slice to `mid`,
171- /// and from `mid` to the end of the string slice.
172- ///
173- /// To get mutable string slices instead, see the [`split_at_mut`]
174- /// method.
175- ///
176- /// [`split_at_mut`]: str::split_at_mut
177- ///
178- /// # Panics
179- ///
180- /// Panics if `mid` is not on a UTF-8 code point boundary, or if it is
181- /// past the end of the last code point of the string slice.
182- ///
183- /// # Examples
184- ///
185- /// Basic usage:
186- ///
187- /// ```
188- /// use clap_lex::OsStrExt as _;
189- /// let s = std::ffi::OsStr::new("Per Martin-Löf");
190- ///
191- /// let (first, last) = s.split_at(3);
192- ///
193- /// assert_eq!("Per", first);
194- /// assert_eq!(" Martin-Löf", last);
195- /// ```
196- #[ deprecated( since = "4.1.0" , note = "This is not sound for all `index`" ) ]
197- fn split_at ( & self , index : usize ) -> ( & OsStr , & OsStr ) ;
198165 /// Splits the string on the first occurrence of the specified delimiter and
199166 /// returns prefix before delimiter and suffix after delimiter.
200167 ///
@@ -249,15 +216,6 @@ impl OsStrExt for OsStr {
249216 }
250217 }
251218
252- fn split_at ( & self , index : usize ) -> ( & OsStr , & OsStr ) {
253- let bytes = to_bytes ( self ) ;
254- unsafe {
255- // BUG: This is unsafe and has been deprecated
256- let ( first, second) = bytes. split_at ( index) ;
257- ( to_os_str_unchecked ( first) , to_os_str_unchecked ( second) )
258- }
259- }
260-
261219 fn split_once ( & self , needle : & ' _ str ) -> Option < ( & OsStr , & OsStr ) > {
262220 let start = self . find ( needle) ?;
263221 let end = start + needle. len ( ) ;
0 commit comments