From 6ecfeec624ae9e145b66431188bae31c17bcd154 Mon Sep 17 00:00:00 2001 From: Daniel Eades Date: Sat, 29 Jan 2022 12:14:37 +0100 Subject: use 'Self' to refer to own type --- src/file/mod.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/file/mod.rs') diff --git a/src/file/mod.rs b/src/file/mod.rs index d4f3e1a..65f3fd6 100644 --- a/src/file/mod.rs +++ b/src/file/mod.rs @@ -43,7 +43,7 @@ where F: FileStoredFormat + 'static, { pub fn from_str(s: &str, format: F) -> Self { - File { + Self { format: Some(format), required: true, source: s.into(), @@ -56,7 +56,7 @@ where F: FileStoredFormat + 'static, { pub fn new(name: &str, format: F) -> Self { - File { + Self { format: Some(format), required: true, source: source::file::FileSourceFile::new(name.into()), @@ -68,7 +68,7 @@ impl File { /// Given the basename of a file, will attempt to locate a file by setting its /// extension to a registered format. pub fn with_name(name: &str) -> Self { - File { + Self { format: None, required: true, source: source::file::FileSourceFile::new(name.into()), @@ -78,7 +78,7 @@ impl File { impl<'a> From<&'a Path> for File { fn from(path: &'a Path) -> Self { - File { + Self { format: None, required: true, source: source::file::FileSourceFile::new(path.to_path_buf()), @@ -88,7 +88,7 @@ impl<'a> From<&'a Path> for File { impl From for File { fn from(path: PathBuf) -> Self { - File { + Self { format: None, required: true, source: source::file::FileSourceFile::new(path), -- cgit v1.2.3