summaryrefslogtreecommitdiffstats
path: root/src/file/source/file.rs
diff options
context:
space:
mode:
authorJoel Gallant <joel@joelgallant.me>2020-09-03 12:06:08 -0600
committerGitHub <noreply@github.com>2020-09-03 12:06:08 -0600
commit436c964037a1833fe6d17eda37e25425af7e9760 (patch)
tree5e6468c43f2f06fca2a338839a3d7a80e4d67d49 /src/file/source/file.rs
parent2c0b201055be60ec45e258adcc6c4b6e01bcd627 (diff)
parente84a39949c0c1625c1886b8f718b8165c7a8e831 (diff)
Merge pull request #134 from eisterman/fix_clippy_warnings
Fix of all the clippy warnings and removing of deprecated Error::description method
Diffstat (limited to 'src/file/source/file.rs')
-rw-r--r--src/file/source/file.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/file/source/file.rs b/src/file/source/file.rs
index a413a1f..57c251f 100644
--- a/src/file/source/file.rs
+++ b/src/file/source/file.rs
@@ -21,13 +21,13 @@ pub struct FileSourceFile {
impl FileSourceFile {
pub fn new(name: PathBuf) -> FileSourceFile {
- FileSourceFile { name: name }
+ FileSourceFile { name }
}
fn find_file(
&self,
format_hint: Option<FileFormat>,
- ) -> Result<(PathBuf, FileFormat), Box<Error + Send + Sync>> {
+ ) -> Result<(PathBuf, FileFormat), Box<dyn Error + Send + Sync>> {
// First check for an _exact_ match
let mut filename = env::current_dir()?.as_path().join(self.name.clone());
if filename.is_file() {
@@ -91,7 +91,7 @@ impl FileSource for FileSourceFile {
fn resolve(
&self,
format_hint: Option<FileFormat>,
- ) -> Result<(Option<String>, String, FileFormat), Box<Error + Send + Sync>> {
+ ) -> Result<(Option<String>, String, FileFormat), Box<dyn Error + Send + Sync>> {
// Find file
let (filename, format) = self.find_file(format_hint)?;
@@ -103,7 +103,7 @@ impl FileSource for FileSourceFile {
};
// Read contents from file
- let mut file = fs::File::open(filename.clone())?;
+ let mut file = fs::File::open(filename)?;
let mut text = String::new();
file.read_to_string(&mut text)?;