fix (src/process.rs): fix cargo clippy linter warnings

This PR fixes lint warnings generated by cargo-clippy:

- **warning**: you should put `notify::ops::RENAME` between ticks in the documentation
- **warning**: use of `or_insert` followed by a function call

I have run `cargo test` and these changes do not break any of the tests :-)

reference:
--

* https://rust-lang-nursery.github.io/rust-clippy/v0.0.165/index.html#doc_markdown
* https://rust-lang-nursery.github.io/rust-clippy/v0.0.165/index.html#or_fun_call
* https://github.com/rust-lang-nursery/rust-clippy
This commit is contained in:
Matt Gathu 2017-10-06 13:55:21 +03:00
parent 93b7b0343f
commit 775eb47dde
No known key found for this signature in database
GPG Key ID: 89CE7A1A70AABF37
1 changed files with 7 additions and 7 deletions

View File

@ -297,11 +297,11 @@ mod imp {
/// Collect `PathOp` details into op-categories to pass onto the exec'd command as env-vars
///
/// WRITTEN -> notify::ops::WRITE, notify::ops::CLOSE_WRITE
/// META_CHANGED -> notify::ops::CHMOD
/// REMOVED -> notify::ops::REMOVE
/// CREATED -> notify::ops::CREATE
/// RENAMED -> notify::ops::RENAME
/// WRITTEN -> `notify::ops::WRITE`, `notify::ops::CLOSE_WRITE`
/// META_CHANGED -> `notify::ops::CHMOD`
/// REMOVED -> `notify::ops::REMOVE`
/// CREATED -> `notify::ops::CREATE`
/// RENAMED -> `notify::ops::RENAME`
fn collect_path_env_vars(pathops: &[PathOp]) -> Vec<(String, String)> {
#[cfg(target_family = "unix")]
const ENV_SEP: &'static str = ":";
@ -314,7 +314,7 @@ fn collect_path_env_vars(pathops: &[PathOp]) -> Vec<(String, String)> {
if let Some(op) = pathop.op { // ignore pathops that don't have a `notify::op` set
if let Some(s) = pathop.path.to_str() { // ignore invalid utf8 paths
all_pathbufs.insert(pathop.path.clone());
let e = by_op.entry(op).or_insert(vec![]);
let e = by_op.entry(op).or_insert_with(Vec::new);
e.push(s.to_owned());
}
}
@ -331,7 +331,7 @@ fn collect_path_env_vars(pathops: &[PathOp]) -> Vec<(String, String)> {
if let Some(ref common_path) = common_path {
vars.push(("WATCHEXEC_COMMON_PATH".to_string(), common_path.to_string()));
}
for (op, paths) in by_op.into_iter() {
for (op, paths) in by_op {
let key = match op {
op if PathOp::is_create(op) => "WATCHEXEC_CREATED_PATH",
op if PathOp::is_remove(op) => "WATCHEXEC_REMOVED_PATH",