fn check_event(&self, event: &Event, priority: Priority) -> Result<bool, RuntimeError> {
		let _span = trace_span!("filterer_check").entered();

		{
			trace!("checking internal whitelist");
			// Ideally check path equality backwards for better perf
			// There could be long matching prefixes so we will exit late
			if event
				.paths()
				.any(|(p, _)| self.whitelist.iter().any(|w| w == p))
			{
				trace!("internal whitelist filterer matched (success)");
				return Ok(true);
			}
		}

		{
			trace!("checking internal ignore filterer");
			if !self
				.ignore_files
				.check_event(event, priority)
				.expect("IgnoreFilterer never errors")
			{
				trace!("internal ignore filterer matched (fail)");
				return Ok(false);
			}
		}

		let mut paths = event.paths().peekable();
		if paths.peek().is_none() {
			trace!("non-path event (pass)");
			Ok(true)
		} else {
			Ok(paths.any(|(path, file_type)| {
				let _span = trace_span!("path", ?path).entered();
				let is_dir = file_type.map_or(false, |t| matches!(t, FileType::Dir));

				if self.ignores.matched(path, is_dir).is_ignore() {
					trace!("ignored by globset ignore");
					return false;
				}

				let mut filtered = false;
				if self.filters.num_ignores() > 0 {
					trace!("running through glob filters");
					filtered = true;

					if self.filters.matched(path, is_dir).is_ignore() {
						trace!("allowed by globset filters");
						return true;
					}

					// Watchexec 1.x bug, TODO remove at 2.0
					#[cfg(unix)]
					if let Ok(based) = path.strip_prefix(&self.origin) {
						let rebased = {
							use std::path::MAIN_SEPARATOR;
							let mut b = self.origin.clone().into_os_string();
							b.push(PathBuf::from(String::from(MAIN_SEPARATOR)));
							b.push(PathBuf::from(String::from(MAIN_SEPARATOR)));
							b.push(based.as_os_str());
							b
						};

						trace!(?rebased, "testing on rebased path, 1.x bug compat (#258)");
						if self.filters.matched(rebased, is_dir).is_ignore() {
							trace!("allowed by globset filters, 1.x bug compat (#258)");
							return true;
						}
					}
				}

				if !self.extensions.is_empty() {
					trace!("running through extension filters");
					filtered = true;

					if is_dir {
						trace!("failed on extension check due to being a dir");
						return false;
					}

					if let Some(ext) = path.extension() {
						if self.extensions.iter().any(|e| e == ext) {
							trace!("allowed by extension filter");
							return true;
						}
					} else {
						trace!(
							?path,
							"failed on extension check due to having no extension"
						);
						return false;
					}
				}

				!filtered
			}))
		}
	}
Filter an event.

This implementation never errors.
crates/filterer/globset/src/lib.rs