From b842c149b611d40d4007a8b93563568bdaf80766 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fe=CC=81lix=20Saparelli?= Date: Sun, 27 Oct 2019 23:58:00 +1300 Subject: [PATCH] Use Rust 2018 --- Cargo.toml | 1 + src/cli.rs | 2 +- src/error.rs | 3 --- src/lib.rs | 10 ---------- src/notification_filter.rs | 8 +++----- src/process.rs | 14 +++++++------- src/run.rs | 22 +++++++++------------- 7 files changed, 21 insertions(+), 39 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index d7310db..5d5d3d3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,6 +11,7 @@ keywords = ["watcher", "inotify", "fsevents", "kqueue"] categories = ["command-line-utilities"] license = "Apache-2.0" exclude = ["/ci/*", "/pkg/*", "/.travis.yml", "/Makefile", "/appveyor.yml"] +edition = "2018" [badges] appveyor = { repository = "watchexec/watchexec" } diff --git a/src/cli.rs b/src/cli.rs index 3ce9d20..22e8136 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -15,7 +15,7 @@ //! ``` use clap::{App, Arg, Error}; -use error; +use crate::error; use std::{ ffi::OsString, path::{PathBuf, MAIN_SEPARATOR}, diff --git a/src/error.rs b/src/error.rs index 4a02b8d..6c9fa71 100644 --- a/src/error.rs +++ b/src/error.rs @@ -1,6 +1,3 @@ -use clap; -use globset; -use notify; use std::{error::Error as StdError, fmt, io, sync::PoisonError}; pub type Result = ::std::result::Result; diff --git a/src/lib.rs b/src/lib.rs index cb209f2..71e40cb 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -13,20 +13,10 @@ extern crate clap; #[macro_use] extern crate derive_builder; -extern crate env_logger; -extern crate globset; #[macro_use] extern crate log; #[macro_use] extern crate lazy_static; -extern crate notify; - -#[cfg(windows)] -extern crate kernel32; -#[cfg(unix)] -extern crate nix; -#[cfg(windows)] -extern crate winapi; pub mod cli; pub mod error; diff --git a/src/notification_filter.rs b/src/notification_filter.rs index 53b86c5..dd9d77a 100644 --- a/src/notification_filter.rs +++ b/src/notification_filter.rs @@ -1,9 +1,7 @@ -extern crate glob; - -use error; -use gitignore::Gitignore; +use crate::error; +use crate::gitignore::Gitignore; use globset::{Glob, GlobSet, GlobSetBuilder}; -use ignore::Ignore; +use crate::ignore::Ignore; use std::path::Path; pub struct NotificationFilter { diff --git a/src/process.rs b/src/process.rs index 3b8b136..24afb97 100644 --- a/src/process.rs +++ b/src/process.rs @@ -1,5 +1,5 @@ -use error::Result; -use pathop::PathOp; +use crate::error::Result; +use crate::pathop::PathOp; use std::collections::{HashMap, HashSet}; use std::path::PathBuf; @@ -59,8 +59,8 @@ mod imp { //use super::wrap_commands; use nix::libc::*; use nix::{self, Error}; - use pathop::PathOp; - use signal::Signal; + use crate::pathop::PathOp; + use crate::signal::Signal; use std::io::{self, Result}; use std::process::Command; use std::sync::*; @@ -146,7 +146,7 @@ mod imp { } pub fn signal(&self, signal: Signal) { - use signal::ConvertToLibc; + use crate::signal::ConvertToLibc; let signo = signal.convert_to_libc(); debug!("Sending {:?} (int: {}) to child process", signal, signo); @@ -176,8 +176,8 @@ mod imp { mod imp { //use super::wrap_commands; use kernel32::*; - use pathop::PathOp; - use signal::Signal; + use crate::pathop::PathOp; + use crate::signal::Signal; use std::io; use std::io::Result; use std::mem; diff --git a/src/run.rs b/src/run.rs index 714a95a..9078d78 100644 --- a/src/run.rs +++ b/src/run.rs @@ -1,15 +1,11 @@ -use cli::{clear_screen, Args}; -use env_logger; -use error::{Error, Result}; -use gitignore; -use ignore; -use log; -use notification_filter::NotificationFilter; -#[cfg(target_os = "linux")] -use notify; -use pathop::PathOp; -use process::{self, Process}; -use signal::{self, Signal}; +use crate::cli::{clear_screen, Args}; +use crate::error::{Error, Result}; +use crate::gitignore; +use crate::ignore; +use crate::notification_filter::NotificationFilter; +use crate::pathop::PathOp; +use crate::process::{self, Process}; +use crate::signal::{self, Signal}; use std::{ collections::HashMap, fs::canonicalize, @@ -20,7 +16,7 @@ use std::{ }, time::Duration, }; -use watcher::{Event, Watcher}; +use crate::watcher::{Event, Watcher}; fn init_logger(debug: bool) { let mut log_builder = env_logger::Builder::new();