From 8203a80ac7f010e32f8302822787eb9b5de8c9be Mon Sep 17 00:00:00 2001
From: Andrew Gallant <jamslam@gmail.com>
Date: Fri, 16 Sep 2016 06:58:10 -0400
Subject: [PATCH] fix tests

---
 src/gitignore.rs | 6 ++++--
 src/glob.rs      | 3 ---
 src/pathutil.rs  | 4 ++--
 3 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/src/gitignore.rs b/src/gitignore.rs
index cac42a94..7678db4b 100644
--- a/src/gitignore.rs
+++ b/src/gitignore.rs
@@ -124,8 +124,10 @@ impl Gitignore {
     /// Like matched, but takes a path that has already been stripped.
     pub fn matched_stripped(&self, path: &Path, is_dir: bool) -> Match {
         thread_local! {
-            static MATCHES: RefCell<Vec<usize>> = RefCell::new(vec![]);
-        }
+            static MATCHES: RefCell<Vec<usize>> = {
+                RefCell::new(vec![])
+            };
+        };
         MATCHES.with(|matches| {
             let mut matches = matches.borrow_mut();
             self.set.matches_into(path, &mut *matches);
diff --git a/src/glob.rs b/src/glob.rs
index c5b5d8d3..e7da9322 100644
--- a/src/glob.rs
+++ b/src/glob.rs
@@ -759,9 +759,6 @@ mod tests {
                 let pat = Pattern::new($pat).unwrap();
                 let path = &Path::new($path).to_str().unwrap();
                 let re = Regex::new(&pat.to_regex_with(&$options)).unwrap();
-                // println!("PATTERN: {}", $pat);
-                // println!("REGEX: {:?}", re);
-                // println!("PATH: {}", path);
                 assert!(!re.is_match(path.as_bytes()));
             }
         };
diff --git a/src/pathutil.rs b/src/pathutil.rs
index e92416e5..3cc92f7b 100644
--- a/src/pathutil.rs
+++ b/src/pathutil.rs
@@ -61,11 +61,11 @@ pub fn file_name<'a, P: AsRef<Path> + ?Sized>(
     let mut last_slash = 0;
     for (i, &b) in path.iter().enumerate().rev() {
         if b == b'/' {
-            last_slash = i;
+            last_slash = i + 1;
             break;
         }
     }
-    Some(OsStr::from_bytes(&path[last_slash + 1..]))
+    Some(OsStr::from_bytes(&path[last_slash..]))
 }
 
 /// The final component of the path, if it is a normal file.