Use Rust 2018

This commit is contained in:
Félix Saparelli 2019-10-27 23:58:00 +13:00
parent 0eb83a6387
commit b842c149b6
No known key found for this signature in database
GPG Key ID: 25940898BB90EA51
7 changed files with 21 additions and 39 deletions

View File

@ -11,6 +11,7 @@ keywords = ["watcher", "inotify", "fsevents", "kqueue"]
categories = ["command-line-utilities"] categories = ["command-line-utilities"]
license = "Apache-2.0" license = "Apache-2.0"
exclude = ["/ci/*", "/pkg/*", "/.travis.yml", "/Makefile", "/appveyor.yml"] exclude = ["/ci/*", "/pkg/*", "/.travis.yml", "/Makefile", "/appveyor.yml"]
edition = "2018"
[badges] [badges]
appveyor = { repository = "watchexec/watchexec" } appveyor = { repository = "watchexec/watchexec" }

View File

@ -15,7 +15,7 @@
//! ``` //! ```
use clap::{App, Arg, Error}; use clap::{App, Arg, Error};
use error; use crate::error;
use std::{ use std::{
ffi::OsString, ffi::OsString,
path::{PathBuf, MAIN_SEPARATOR}, path::{PathBuf, MAIN_SEPARATOR},

View File

@ -1,6 +1,3 @@
use clap;
use globset;
use notify;
use std::{error::Error as StdError, fmt, io, sync::PoisonError}; use std::{error::Error as StdError, fmt, io, sync::PoisonError};
pub type Result<T> = ::std::result::Result<T, Error>; pub type Result<T> = ::std::result::Result<T, Error>;

View File

@ -13,20 +13,10 @@
extern crate clap; extern crate clap;
#[macro_use] #[macro_use]
extern crate derive_builder; extern crate derive_builder;
extern crate env_logger;
extern crate globset;
#[macro_use] #[macro_use]
extern crate log; extern crate log;
#[macro_use] #[macro_use]
extern crate lazy_static; 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 cli;
pub mod error; pub mod error;

View File

@ -1,9 +1,7 @@
extern crate glob; use crate::error;
use crate::gitignore::Gitignore;
use error;
use gitignore::Gitignore;
use globset::{Glob, GlobSet, GlobSetBuilder}; use globset::{Glob, GlobSet, GlobSetBuilder};
use ignore::Ignore; use crate::ignore::Ignore;
use std::path::Path; use std::path::Path;
pub struct NotificationFilter { pub struct NotificationFilter {

View File

@ -1,5 +1,5 @@
use error::Result; use crate::error::Result;
use pathop::PathOp; use crate::pathop::PathOp;
use std::collections::{HashMap, HashSet}; use std::collections::{HashMap, HashSet};
use std::path::PathBuf; use std::path::PathBuf;
@ -59,8 +59,8 @@ mod imp {
//use super::wrap_commands; //use super::wrap_commands;
use nix::libc::*; use nix::libc::*;
use nix::{self, Error}; use nix::{self, Error};
use pathop::PathOp; use crate::pathop::PathOp;
use signal::Signal; use crate::signal::Signal;
use std::io::{self, Result}; use std::io::{self, Result};
use std::process::Command; use std::process::Command;
use std::sync::*; use std::sync::*;
@ -146,7 +146,7 @@ mod imp {
} }
pub fn signal(&self, signal: Signal) { pub fn signal(&self, signal: Signal) {
use signal::ConvertToLibc; use crate::signal::ConvertToLibc;
let signo = signal.convert_to_libc(); let signo = signal.convert_to_libc();
debug!("Sending {:?} (int: {}) to child process", signal, signo); debug!("Sending {:?} (int: {}) to child process", signal, signo);
@ -176,8 +176,8 @@ mod imp {
mod imp { mod imp {
//use super::wrap_commands; //use super::wrap_commands;
use kernel32::*; use kernel32::*;
use pathop::PathOp; use crate::pathop::PathOp;
use signal::Signal; use crate::signal::Signal;
use std::io; use std::io;
use std::io::Result; use std::io::Result;
use std::mem; use std::mem;

View File

@ -1,15 +1,11 @@
use cli::{clear_screen, Args}; use crate::cli::{clear_screen, Args};
use env_logger; use crate::error::{Error, Result};
use error::{Error, Result}; use crate::gitignore;
use gitignore; use crate::ignore;
use ignore; use crate::notification_filter::NotificationFilter;
use log; use crate::pathop::PathOp;
use notification_filter::NotificationFilter; use crate::process::{self, Process};
#[cfg(target_os = "linux")] use crate::signal::{self, Signal};
use notify;
use pathop::PathOp;
use process::{self, Process};
use signal::{self, Signal};
use std::{ use std::{
collections::HashMap, collections::HashMap,
fs::canonicalize, fs::canonicalize,
@ -20,7 +16,7 @@ use std::{
}, },
time::Duration, time::Duration,
}; };
use watcher::{Event, Watcher}; use crate::watcher::{Event, Watcher};
fn init_logger(debug: bool) { fn init_logger(debug: bool) {
let mut log_builder = env_logger::Builder::new(); let mut log_builder = env_logger::Builder::new();