Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions crates/fff-core/src/constraints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ pub(crate) fn apply_constraints<'a, T: Constrainable + Sync>(

#[cfg(feature = "zlob")]
type GlobPattern = zlob::ZlobPattern;
#[cfg(not(feature = "zlob"))]
#[cfg(all(not(feature = "zlob"), feature = "ripgrep"))]
type GlobPattern = globset::GlobMatcher;

/// How `Constraint::Glob` is evaluated for each item.
Expand Down Expand Up @@ -440,7 +440,7 @@ fn compiled_matches(p: &GlobPattern, path: &str) -> bool {
}

#[inline]
#[cfg(not(feature = "zlob"))]
#[cfg(all(not(feature = "zlob"), feature = "ripgrep"))]
fn compiled_matches(p: &GlobPattern, path: &str) -> bool {
p.is_match(path)
}
Expand Down Expand Up @@ -553,7 +553,7 @@ fn compile_one(pattern: &str) -> Option<GlobPattern> {
zlob::ZlobPattern::compile(pattern, zlob::ZlobFlags::RECOMMENDED).ok()
}

#[cfg(not(feature = "zlob"))]
#[cfg(all(not(feature = "zlob"), feature = "ripgrep"))]
fn compile_one(pattern: &str) -> Option<GlobPattern> {
globset::Glob::new(pattern)
.ok()
Expand All @@ -577,7 +577,7 @@ fn match_glob_pattern(pattern: &str, paths: &[&str]) -> Vec<bool> {
mask
}

#[cfg(not(feature = "zlob"))]
#[cfg(all(not(feature = "zlob"), feature = "ripgrep"))]
fn match_glob_pattern(pattern: &str, paths: &[&str]) -> Vec<bool> {
let mut mask = vec![false; paths.len()];
let Ok(glob) = globset::Glob::new(pattern) else {
Expand Down
2 changes: 1 addition & 1 deletion crates/fff-core/src/ignore.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ pub(crate) const IGNORED_DIRS: &[&str] = &[
"AppData/Roaming",
];

#[cfg(not(feature = "zlob"))]
#[cfg(all(not(feature = "zlob"), feature = "ripgrep"))]
pub(crate) fn non_git_repo_overrides(base_path: &Path) -> Option<ignore::overrides::Override> {
use ignore::overrides::OverrideBuilder;

Expand Down
6 changes: 6 additions & 0 deletions crates/fff-core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,12 @@
//! # Ok::<(), Box<dyn std::error::Error>>(())
//! ```

#[cfg(not(any(feature = "ripgrep", feature = "zlob")))]
compile_error!(
"fff-search requires either the `ripgrep` (default) or `zlob` feature. \
Enable one, e.g. `--features ripgrep` or `--features zlob`."
);

mod background_watcher;
mod git_status_worker;
pub(crate) mod parallelism;
Expand Down
4 changes: 2 additions & 2 deletions crates/fff-core/src/walk/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ mod zlob;
#[cfg(feature = "zlob")]
pub(crate) use zlob::walk_collect_files;

#[cfg(not(feature = "zlob"))]
#[cfg(all(not(feature = "zlob"), feature = "ripgrep"))]
mod ripgrep;
#[cfg(not(feature = "zlob"))]
#[cfg(all(not(feature = "zlob"), feature = "ripgrep"))]
pub(crate) use ripgrep::walk_collect_files;

pub(crate) struct WalkOutput {
Expand Down
Loading