Skip to content

Use Self over specific type in return position #70694

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 3, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions src/libstd/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -734,7 +734,7 @@ impl OpenOptions {
/// let file = options.read(true).open("foo.txt");
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
pub fn new() -> OpenOptions {
pub fn new() -> Self {
OpenOptions(fs_imp::OpenOptions::new())
}

Expand All @@ -751,7 +751,7 @@ impl OpenOptions {
/// let file = OpenOptions::new().read(true).open("foo.txt");
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
pub fn read(&mut self, read: bool) -> &mut OpenOptions {
pub fn read(&mut self, read: bool) -> &mut Self {
self.0.read(read);
self
}
Expand All @@ -772,7 +772,7 @@ impl OpenOptions {
/// let file = OpenOptions::new().write(true).open("foo.txt");
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
pub fn write(&mut self, write: bool) -> &mut OpenOptions {
pub fn write(&mut self, write: bool) -> &mut Self {
self.0.write(write);
self
}
Expand Down Expand Up @@ -819,7 +819,7 @@ impl OpenOptions {
/// let file = OpenOptions::new().append(true).open("foo.txt");
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
pub fn append(&mut self, append: bool) -> &mut OpenOptions {
pub fn append(&mut self, append: bool) -> &mut Self {
self.0.append(append);
self
}
Expand All @@ -839,7 +839,7 @@ impl OpenOptions {
/// let file = OpenOptions::new().write(true).truncate(true).open("foo.txt");
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
pub fn truncate(&mut self, truncate: bool) -> &mut OpenOptions {
pub fn truncate(&mut self, truncate: bool) -> &mut Self {
self.0.truncate(truncate);
self
}
Expand All @@ -860,7 +860,7 @@ impl OpenOptions {
/// let file = OpenOptions::new().write(true).create(true).open("foo.txt");
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
pub fn create(&mut self, create: bool) -> &mut OpenOptions {
pub fn create(&mut self, create: bool) -> &mut Self {
self.0.create(create);
self
}
Expand Down Expand Up @@ -893,7 +893,7 @@ impl OpenOptions {
/// .open("foo.txt");
/// ```
#[stable(feature = "expand_open_options2", since = "1.9.0")]
pub fn create_new(&mut self, create_new: bool) -> &mut OpenOptions {
pub fn create_new(&mut self, create_new: bool) -> &mut Self {
self.0.create_new(create_new);
self
}
Expand Down