Skip to content

Commit 73ec27d

Browse files
authored
Rollup merge of #85766 - workingjubilee:file-options, r=yaahc
Stabilize File::options() Renames File::with_options to File::options, per consensus in #65439, and stabilizes it.
2 parents 891ca5f + caf206b commit 73ec27d

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

library/std/src/fs.rs

+4-5
Original file line numberDiff line numberDiff line change
@@ -358,25 +358,24 @@ impl File {
358358
///
359359
/// It is equivalent to `OpenOptions::new()` but allows you to write more
360360
/// readable code. Instead of `OpenOptions::new().read(true).open("foo.txt")`
361-
/// you can write `File::with_options().read(true).open("foo.txt")`. This
361+
/// you can write `File::options().read(true).open("foo.txt")`. This
362362
/// also avoids the need to import `OpenOptions`.
363363
///
364364
/// See the [`OpenOptions::new`] function for more details.
365365
///
366366
/// # Examples
367367
///
368368
/// ```no_run
369-
/// #![feature(with_options)]
370369
/// use std::fs::File;
371370
///
372371
/// fn main() -> std::io::Result<()> {
373-
/// let mut f = File::with_options().read(true).open("foo.txt")?;
372+
/// let mut f = File::options().read(true).open("foo.txt")?;
374373
/// Ok(())
375374
/// }
376375
/// ```
377376
#[must_use]
378-
#[unstable(feature = "with_options", issue = "65439")]
379-
pub fn with_options() -> OpenOptions {
377+
#[stable(feature = "with_options", since = "1.58.0")]
378+
pub fn options() -> OpenOptions {
380379
OpenOptions::new()
381380
}
382381

0 commit comments

Comments
 (0)