Repository: sharkdp/fd
Pull request #383 (2019-01-05 20:21:24)

Edition upgrade
This is just a minimal set of changes for the 2018 edition (since recently 1.31 is the minimum supported version).

This does not also change the `mod.rs` files into `$module_name.rs` files. Please let me know if you think this should also be done in the same PR.


Patch:
diff --git a/Cargo.toml b/Cargo.toml
index fabc99b..c686196 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -17,6 +17,7 @@ name = "fd-find"
 readme = "README.md"
 repository = "https://github.com/sharkdp/fd"
 version = "7.2.0"
+edition= "2018"
 
 [[bin]]
 name = "fd"
diff --git a/build.rs b/build.rs
index 051e233..932c475 100644
--- a/build.rs
+++ b/build.rs
@@ -6,10 +6,6 @@
 // notice may not be copied, modified, or distributed except
 // according to those terms.
 
-#[macro_use]
-extern crate clap;
-extern crate version_check;
-
 use clap::Shell;
 use std::fs;
 use std::io::{self, Write};
diff --git a/src/app.rs b/src/app.rs
index 89f0736..ef34814 100644
--- a/src/app.rs
+++ b/src/app.rs
@@ -7,7 +7,7 @@
 // according to those terms.
 use std::collections::HashMap;
 
-use clap::{App, AppSettings, Arg};
+use clap::{crate_version, App, AppSettings, Arg};
 
 struct Help {
     short: &'static str,
diff --git a/src/exec/job.rs b/src/exec/job.rs
index b961020..56d6966 100644
--- a/src/exec/job.rs
+++ b/src/exec/job.rs
@@ -7,10 +7,10 @@
 // according to those terms.
 
 use super::CommandTemplate;
+use crate::walk::WorkerResult;
 use std::path::PathBuf;
 use std::sync::mpsc::Receiver;
 use std::sync::{Arc, Mutex};
-use walk::WorkerResult;
 
 /// An event loop that listens for inputs from the `rx` receiver. Each received input will
 /// generate a command with the supplied command template. The generated command will then
diff --git a/src/exec/mod.rs b/src/exec/mod.rs
index 6b58661..8f335e4 100644
--- a/src/exec/mod.rs
+++ b/src/exec/mod.rs
@@ -17,6 +17,7 @@ use std::path::{Path, PathBuf};
 use std::process::{Command, Stdio};
 use std::sync::{Arc, Mutex};
 
+use lazy_static::lazy_static;
 use regex::Regex;
 
 use self::command::execute_command;
diff --git a/src/internal/filter/size.rs b/src/internal/filter/size.rs
index c24c078..b534f8d 100644
--- a/src/internal/filter/size.rs
+++ b/src/internal/filter/size.rs
@@ -1,3 +1,4 @@
+use lazy_static::lazy_static;
 use regex::Regex;
 
 lazy_static! {
diff --git a/src/internal/opts.rs b/src/internal/opts.rs
index 529935b..c2dc7ec 100644
--- a/src/internal/opts.rs
+++ b/src/internal/opts.rs
@@ -1,5 +1,5 @@
-use exec::CommandTemplate;
-use internal::{
+use crate::exec::CommandTemplate;
+use crate::internal::{
     filter::{SizeFilter, TimeFilter},
     FileTypes,
 };
diff --git a/src/main.rs b/src/main.rs
index 6dad5ee..571bdc6 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -6,21 +6,6 @@
 // notice may not be copied, modified, or distributed except
 // according to those terms.
 
-extern crate ansi_term;
-extern crate atty;
-#[macro_use]
-extern crate clap;
-extern crate ignore;
-#[macro_use]
-extern crate lazy_static;
-extern crate humantime;
-#[cfg(all(unix, not(target_os = "redox")))]
-extern crate libc;
-extern crate lscolors;
-extern crate num_cpus;
-extern crate regex;
-extern crate regex_syntax;
-
 #[macro_use]
 mod internal;
 
@@ -41,8 +26,8 @@ use atty::Stream;
 use lscolors::LsColors;
 use regex::{RegexBuilder, RegexSetBuilder};
 
-use exec::CommandTemplate;
-use internal::{
+use crate::exec::CommandTemplate;
+use crate::internal::{
     filter::{SizeFilter, TimeFilter},
     opts::FdOptions,
     pattern_has_uppercase_char, transform_args_with_exec, FileTypes,
diff --git a/src/output.rs b/src/output.rs
index 9788640..d6cd5d9 100644
--- a/src/output.rs
+++ b/src/output.rs
@@ -6,8 +6,8 @@
 // notice may not be copied, modified, or distributed except
 // according to those terms.
 
-use exit_codes::ExitCode;
-use internal::opts::FdOptions;
+use crate::exit_codes::ExitCode;
+use crate::internal::opts::FdOptions;
 use lscolors::{LsColors, Style};
 
 use std::io::{self, Write};
diff --git a/src/walk.rs b/src/walk.rs
index 7943e29..efcc4ee 100644
--- a/src/walk.rs
+++ b/src/walk.rs
@@ -6,13 +6,11 @@
 // notice may not be copied, modified, or distributed except
 // according to those terms.
 
-extern crate ctrlc;
-
-use exec;
-use exit_codes::ExitCode;
-use fshelper;
-use internal::{opts::FdOptions, MAX_BUFFER_LENGTH};
-use output;
+use crate::exec;
+use crate::exit_codes::ExitCode;
+use crate::fshelper;
+use crate::internal::{opts::FdOptions, MAX_BUFFER_LENGTH};
+use crate::output;
 
 use std::error::Error;
 use std::path::PathBuf;


Test patch:
diff --git a/tests/testenv/mod.rs b/tests/testenv/mod.rs
index 1a6f9d9..ba9d075 100644
--- a/tests/testenv/mod.rs
+++ b/tests/testenv/mod.rs
@@ -20,10 +20,7 @@ use std::os::unix;
 #[cfg(windows)]
 use std::os::windows;
 
-extern crate diff;
-extern crate tempdir;
-
-use self::tempdir::TempDir;
+use tempdir::TempDir;
 
 /// Environment for the integration tests.
 pub struct TestEnv {
diff --git a/tests/tests.rs b/tests/tests.rs
index 8659043..d03168f 100644
--- a/tests/tests.rs
+++ b/tests/tests.rs
@@ -8,18 +8,14 @@
 
 //! Integration tests for the CLI interface of fd.
 
-extern crate filetime;
-extern crate humantime;
-extern crate regex;
-
 mod testenv;
 
+use crate::testenv::TestEnv;
 use regex::escape;
 use std::fs;
 use std::io::Write;
 use std::path::Path;
 use std::time::{Duration, SystemTime};
-use testenv::TestEnv;
 
 static DEFAULT_DIRS: &'static [&'static str] = &["one/two/three", "one/two/three/directory_foo"];