From ec614e19125fde45acbe3a2178c68794e6fb930c Mon Sep 17 00:00:00 2001 From: Lucien Greathouse Date: Thu, 17 Oct 2019 17:48:30 -0700 Subject: [PATCH] Remove last unused warning. Closes #245. --- src/path_map.rs | 41 +---------------------------------------- 1 file changed, 1 insertion(+), 40 deletions(-) diff --git a/src/path_map.rs b/src/path_map.rs index 9ccf11ea..86f6a02f 100644 --- a/src/path_map.rs +++ b/src/path_map.rs @@ -1,6 +1,6 @@ use std::{ collections::{HashMap, HashSet}, - path::{self, Path, PathBuf}, + path::{Path, PathBuf}, }; use log::warn; @@ -117,45 +117,6 @@ impl PathMap { removed_entries } - /// Traverses the route between `start_path` and `target_path` and returns - /// the path closest to `target_path` in the tree. - /// - /// This is useful when trying to determine what paths need to be marked as - /// altered when a change to a path is registered. Depending on the order of - /// FS events, a file remove event could be followed by that file's - /// directory being removed, in which case we should process that - /// directory's parent. - pub fn descend( - &self, - start_path: impl Into, - target_path: impl AsRef, - ) -> PathBuf { - let start_path = start_path.into(); - let target_path = target_path.as_ref(); - - let relative_path = target_path - .strip_prefix(&start_path) - .expect("target_path did not begin with start_path"); - let mut current_path = start_path; - - for component in relative_path.components() { - match component { - path::Component::Normal(name) => { - let next_path = current_path.join(name); - - if self.nodes.contains_key(&next_path) { - current_path = next_path; - } else { - return current_path; - } - } - _ => unreachable!(), - } - } - - current_path - } - pub fn orphans(&self) -> impl Iterator { self.orphan_paths.iter().map(|item| item.as_ref()) }