diff options
author | Daniel Eades <danieleades@hotmail.com> | 2022-01-29 12:14:37 +0100 |
---|---|---|
committer | Daniel Eades <danieleades@hotmail.com> | 2022-01-29 14:01:49 +0100 |
commit | 6ecfeec624ae9e145b66431188bae31c17bcd154 (patch) | |
tree | 82a552f664dd98c5e55007aff914632834810e33 /src/file/mod.rs | |
parent | 53e43fbcf96b5c2a661d052a6e3d55fc3709f1e1 (diff) |
use 'Self' to refer to own type
Diffstat (limited to 'src/file/mod.rs')
-rw-r--r-- | src/file/mod.rs | 10 |
1 files changed, 5 insertions, 5 deletions
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<source::file::FileSourceFile, FileFormat> { /// 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<source::file::FileSourceFile, FileFormat> { impl<'a> From<&'a Path> for File<source::file::FileSourceFile, FileFormat> { 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<source::file::FileSourceFile, FileFormat> { impl From<PathBuf> for File<source::file::FileSourceFile, FileFormat> { fn from(path: PathBuf) -> Self { - File { + Self { format: None, required: true, source: source::file::FileSourceFile::new(path), |