summaryrefslogtreecommitdiffstats
path: root/src/file/source
diff options
context:
space:
mode:
Diffstat (limited to 'src/file/source')
-rw-r--r--src/file/source/file.rs8
-rw-r--r--src/file/source/mod.rs2
-rw-r--r--src/file/source/string.rs2
3 files changed, 6 insertions, 6 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)?;
diff --git a/src/file/source/mod.rs b/src/file/source/mod.rs
index 5da69f1..ab276d0 100644
--- a/src/file/source/mod.rs
+++ b/src/file/source/mod.rs
@@ -12,5 +12,5 @@ pub trait FileSource: Debug + Clone {
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>>;
}
diff --git a/src/file/source/string.rs b/src/file/source/string.rs
index a2f66cb..3896cce 100644
--- a/src/file/source/string.rs
+++ b/src/file/source/string.rs
@@ -19,7 +19,7 @@ impl FileSource for FileSourceString {
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>> {
Ok((
None,
self.0.clone(),