From 9431b745f615269178546d30229d9c128fe3e135 Mon Sep 17 00:00:00 2001 From: Alexandru Macovei Date: Sat, 5 Jan 2019 19:17:22 +0200 Subject: [PATCH 1/3] [2018 edition] run cargo fix edition and edition-idioms --- src/exec/job.rs | 2 +- src/internal/opts.rs | 4 ++-- src/main.rs | 4 ++-- src/output.rs | 4 ++-- src/walk.rs | 10 +++++----- tests/tests.rs | 2 +- 6 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/exec/job.rs b/src/exec/job.rs index b9610209c..a565ce85d 100644 --- a/src/exec/job.rs +++ b/src/exec/job.rs @@ -10,7 +10,7 @@ use super::CommandTemplate; use std::path::PathBuf; use std::sync::mpsc::Receiver; use std::sync::{Arc, Mutex}; -use walk::WorkerResult; +use crate::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/internal/opts.rs b/src/internal/opts.rs index 529935b61..c2dc7ec31 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 6dad5ee3d..108292bad 100644 --- a/src/main.rs +++ b/src/main.rs @@ -41,8 +41,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 9788640ef..d6cd5d95a 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 7943e2923..2bb3fd657 100644 --- a/src/walk.rs +++ b/src/walk.rs @@ -8,11 +8,11 @@ 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; diff --git a/tests/tests.rs b/tests/tests.rs index 86590437e..d6f688ab8 100644 --- a/tests/tests.rs +++ b/tests/tests.rs @@ -19,7 +19,7 @@ use std::fs; use std::io::Write; use std::path::Path; use std::time::{Duration, SystemTime}; -use testenv::TestEnv; +use crate::testenv::TestEnv; static DEFAULT_DIRS: &'static [&'static str] = &["one/two/three", "one/two/three/directory_foo"]; From b1012d1f9822c8030d835addca0092ffec4dc1ed Mon Sep 17 00:00:00 2001 From: Alexandru Macovei Date: Sat, 5 Jan 2019 19:18:47 +0200 Subject: [PATCH 2/3] [2018 edition] enable 2018 edition --- Cargo.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/Cargo.toml b/Cargo.toml index fabc99bde..c68619613 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" From 683ccb8d3de85fe41f3102cec9832ef4772136a6 Mon Sep 17 00:00:00 2001 From: Alexandru Macovei Date: Sat, 5 Jan 2019 19:24:33 +0200 Subject: [PATCH 3/3] [2018 edition] remove all extern crate lines from sources --- build.rs | 4 ---- src/app.rs | 2 +- src/exec/job.rs | 2 +- src/exec/mod.rs | 1 + src/internal/filter/size.rs | 1 + src/main.rs | 15 --------------- src/walk.rs | 2 -- tests/testenv/mod.rs | 5 +---- tests/tests.rs | 6 +----- 9 files changed, 6 insertions(+), 32 deletions(-) diff --git a/build.rs b/build.rs index 051e23342..932c4753a 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 89f0736e5..ef3481483 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 a565ce85d..56d6966c2 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 crate::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 6b58661e2..8f335e448 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 c24c07806..b534f8d3e 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/main.rs b/src/main.rs index 108292bad..571bdc64e 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; diff --git a/src/walk.rs b/src/walk.rs index 2bb3fd657..efcc4ee26 100644 --- a/src/walk.rs +++ b/src/walk.rs @@ -6,8 +6,6 @@ // notice may not be copied, modified, or distributed except // according to those terms. -extern crate ctrlc; - use crate::exec; use crate::exit_codes::ExitCode; use crate::fshelper; diff --git a/tests/testenv/mod.rs b/tests/testenv/mod.rs index 1a6f9d9ce..ba9d075d4 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 d6f688ab8..d03168f55 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 crate::testenv::TestEnv; static DEFAULT_DIRS: &'static [&'static str] = &["one/two/three", "one/two/three/directory_foo"];