@@ -281,14 +281,14 @@ impl OsString {
281
281
///
282
282
/// ```
283
283
/// #![feature(try_reserve_2)]
284
- /// use std::ffi::OsString;
284
+ /// use std::ffi::{OsStr, OsString} ;
285
285
/// use std::collections::TryReserveError;
286
286
///
287
287
/// fn process_data(data: &str) -> Result<OsString, TryReserveError> {
288
288
/// let mut s = OsString::new();
289
289
///
290
290
/// // Pre-reserve the memory, exiting if we can't
291
- /// s.try_reserve(OsString::from (data).len())?;
291
+ /// s.try_reserve(OsStr::new (data).len())?;
292
292
///
293
293
/// // Now we know this can't OOM in the middle of our complex work
294
294
/// s.push(data);
@@ -349,14 +349,14 @@ impl OsString {
349
349
///
350
350
/// ```
351
351
/// #![feature(try_reserve_2)]
352
- /// use std::ffi::OsString;
352
+ /// use std::ffi::{OsStr, OsString} ;
353
353
/// use std::collections::TryReserveError;
354
354
///
355
355
/// fn process_data(data: &str) -> Result<OsString, TryReserveError> {
356
356
/// let mut s = OsString::new();
357
357
///
358
358
/// // Pre-reserve the memory, exiting if we can't
359
- /// s.try_reserve_exact(OsString::from (data).len())?;
359
+ /// s.try_reserve_exact(OsStr::new (data).len())?;
360
360
///
361
361
/// // Now we know this can't OOM in the middle of our complex work
362
362
/// s.push(data);
0 commit comments