Skip to content

Commit 50909cf

Browse files
committed
fix ci
1 parent 2e115bf commit 50909cf

8 files changed

Lines changed: 64 additions & 34 deletions

File tree

crates/fff-core/src/background_watcher.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -686,11 +686,9 @@ fn handle_debounced_events(
686686
if need_full_git_rescan || !files_to_update_git_status.is_empty() {
687687
let sp = shared_picker.clone();
688688
let sf = shared_frecency.clone();
689-
let git_workdir = repo.as_ref().map(|r| {
690-
r.workdir()
691-
.unwrap_or_else(|| r.path())
692-
.to_path_buf()
693-
});
689+
let git_workdir = repo
690+
.as_ref()
691+
.map(|r| r.workdir().unwrap_or_else(|| r.path()).to_path_buf());
694692
let full_rescan = need_full_git_rescan;
695693
let need_picker_rescan = need_full_rescan;
696694
let files = files_to_update_git_status;

crates/fff-core/src/bigram_filter.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -724,7 +724,7 @@ pub(crate) fn build_bigram_index(
724724

725725
// in progress bigram walk + rust's ignore crate allocates shit ton of garbage memory
726726
// all custom allocators would think this is available resource while we do not allocate
727-
// afte the sync, so it's very important to let the unused memory go back to the OS
727+
// after the sync, so it's very important to let the unused memory go back to the OS
728728
crate::file_picker::hint_allocator_collect();
729729

730730
index

crates/fff-core/src/file_picker.rs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1414,7 +1414,7 @@ impl FilePicker {
14141414
let overlay = self.sync_data.bigram_overlay.as_ref().map(Arc::clone);
14151415
let pos = slot.index();
14161416

1417-
// this is the only way to actaully know if the file is on disk, we CAN NOT
1417+
// this is the only way to actually know if the file is on disk, we CAN NOT
14181418
// rely on the watcher to proive the latest state of the file, do the actual check
14191419
let metadata = match std::fs::metadata(path) {
14201420
Ok(m) => {
@@ -1503,6 +1503,9 @@ impl FilePicker {
15031503

15041504
fn tombstone_file(&mut self, index: usize) {
15051505
let file = &mut self.sync_data.files[index];
1506+
if file.is_deleted() {
1507+
return;
1508+
}
15061509

15071510
file.set_deleted(true);
15081511
file.invalidate_mmap(&self.cache_budget);
@@ -1520,13 +1523,16 @@ impl FilePicker {
15201523

15211524
fn untombstone_file(&mut self, index: usize) {
15221525
let file = &mut self.sync_data.files[index];
1526+
if !file.is_deleted() {
1527+
return;
1528+
}
15231529
file.set_deleted(false);
15241530

15251531
self.sync_data.live_count += 1;
15261532
}
15271533

15281534
/// Marks file as deleted, make sure that if you call this yourself these changes can be reverted
1529-
/// by the internal mechanics if the file actully exists on the disk, use only if you know that
1535+
/// by the internal mechanics if the file actually exists on the disk, use only if you know that
15301536
/// the file going to be disapperaed or if you do not have the watcher installed
15311537
pub fn remove_file_by_path(&mut self, path: impl AsRef<Path>) -> bool {
15321538
let path = path.as_ref();
@@ -1939,7 +1945,7 @@ pub(crate) fn warmup_mmaps(
19391945
base_path: &Path,
19401946
arena: ArenaPtr,
19411947
) {
1942-
// for most of the use cases mmaps limit would be signficantly smaller than arepo
1948+
// for most of the use cases mmaps limit would be significantly smaller than arepo
19431949
for file in files.iter() {
19441950
if file.is_likely_hot()
19451951
|| file.is_binary()

crates/fff-core/src/grep.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1655,8 +1655,11 @@ fn fuzzy_grep_search<'a>(
16551655
return None;
16561656
}
16571657

1658-
1659-
let file_arena = if file.is_overflow() { overflow_arena } else { arena };
1658+
let file_arena = if file.is_overflow() {
1659+
overflow_arena
1660+
} else {
1661+
arena
1662+
};
16601663
let file_bytes = file.get_content_for_search(buf, file_arena, base_path, budget)?;
16611664

16621665
// File-level prefilter: check if enough distinct needle chars

crates/fff-core/src/scan.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ impl ScanJob {
315315
let budget: &ContentCacheBudget = &unsafe_snapshot.budget;
316316
let files: &[crate::types::FileItem] = &unsafe_snapshot.files[..unsafe_snapshot.base_count];
317317

318-
// unified bigram and warmup_mmaps in one go, it's important to reuse open files as much as possible
318+
// unified bigram and warmup_mmaps in one go, it's important to reuse open files as much as possible
319319
if config.content_indexing && !signals.cancelled.load(Ordering::Acquire) {
320320
let indexable_files = &files[..unsafe_snapshot.indexable_count.min(files.len())];
321321
let index = build_bigram_index(

crates/fff-core/tests/fuzz_real_repos.rs

Lines changed: 44 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//! Proptest-driven fuzz test against real GitHub repos with a live watcher.
22
//!
33
//! Clones real repository, runs the simulated close to real user sereies of file system ewvents and
4-
//! verifies that fff can still find the correct files. Test cases are randomzied and preserved
4+
//! verifies that fff can still find the correct files. Test cases are randomized and preserved
55
//! using proptest
66
//!
77
//! Run:
@@ -104,7 +104,11 @@ fn copy_repo_to_workdir(cached: &Path, workdir: &Path) {
104104
.arg(workdir)
105105
.output()
106106
.expect("cp -r failed");
107-
assert!(out.status.success(), "cp -r failed: {}", String::from_utf8_lossy(&out.stderr));
107+
assert!(
108+
out.status.success(),
109+
"cp -r failed: {}",
110+
String::from_utf8_lossy(&out.stderr)
111+
);
108112
}
109113

110114
fn collect_text_files(base: &Path) -> Vec<PathBuf> {
@@ -156,7 +160,9 @@ fn collect_text_files(base: &Path) -> Vec<PathBuf> {
156160
if path.is_empty() {
157161
continue;
158162
}
159-
let Ok(s) = std::str::from_utf8(path) else { continue };
163+
let Ok(s) = std::str::from_utf8(path) else {
164+
continue;
165+
};
160166
if ignored_set.contains(s) {
161167
continue;
162168
}
@@ -199,7 +205,9 @@ fn inject_marker(path: &Path, marker: &str, seed: u32) -> Option<String> {
199205
/// Revert a file by restoring the original line at the same position
200206
/// where inject_marker placed the marker.
201207
fn revert_marker(path: &Path, marker: &str, original_line: &str) {
202-
let Ok(content) = fs::read_to_string(path) else { return };
208+
let Ok(content) = fs::read_to_string(path) else {
209+
return;
210+
};
203211
let marker_line = format!("// {marker}");
204212
let result: String = content
205213
.lines()
@@ -293,9 +301,8 @@ fn run_scenario(ops: &[Op]) {
293301
// Stream fff logs at info+ level by default. Override with RUST_LOG.
294302
let _ = tracing_subscriber::fmt()
295303
.with_env_filter(
296-
tracing_subscriber::EnvFilter::try_from_default_env().unwrap_or_else(|_| {
297-
tracing_subscriber::EnvFilter::new("warn,fff_search=info")
298-
}),
304+
tracing_subscriber::EnvFilter::try_from_default_env()
305+
.unwrap_or_else(|_| tracing_subscriber::EnvFilter::new("warn,fff_search=info")),
299306
)
300307
.with_test_writer()
301308
.try_init();
@@ -389,7 +396,13 @@ fn run_scenario(ops: &[Op]) {
389396
let content = fs::read_to_string(&path).unwrap_or_default();
390397
let new_content = content
391398
.lines()
392-
.map(|l| if l == old_marker_line { format!("// {new_marker}") } else { l.to_string() })
399+
.map(|l| {
400+
if l == old_marker_line {
401+
format!("// {new_marker}")
402+
} else {
403+
l.to_string()
404+
}
405+
})
393406
.collect::<Vec<_>>()
394407
.join("\n")
395408
+ "\n";
@@ -426,7 +439,13 @@ fn run_scenario(ops: &[Op]) {
426439
let content = fs::read_to_string(target).unwrap_or_default();
427440
let new_content = content
428441
.lines()
429-
.map(|l| if l == old_marker_line { format!("// {marker}") } else { l.to_string() })
442+
.map(|l| {
443+
if l == old_marker_line {
444+
format!("// {marker}")
445+
} else {
446+
l.to_string()
447+
}
448+
})
430449
.collect::<Vec<_>>()
431450
.join("\n")
432451
+ "\n";
@@ -436,8 +455,7 @@ fn run_scenario(ops: &[Op]) {
436455
tracked[pos].last_write_sec = epoch_secs();
437456
} else {
438457
// First edit: inject marker at a deterministic line
439-
let original = inject_marker(target, &marker, *seed)
440-
.unwrap_or_default();
458+
let original = inject_marker(target, &marker, *seed).unwrap_or_default();
441459
tracked.push(TrackedFile {
442460
relative,
443461
marker,
@@ -540,7 +558,9 @@ fn run_scenario(ops: &[Op]) {
540558
last_failure = Some(format!(
541559
"{mode_name} grep for {:?} in {:?} not found\n\
542560
is_created={} exists={} on_disk_has_marker={}",
543-
tf.marker, tf.relative, tf.is_created,
561+
tf.marker,
562+
tf.relative,
563+
tf.is_created,
544564
workdir.join(&tf.relative).exists(),
545565
fs::read_to_string(workdir.join(&tf.relative))
546566
.map(|c| c.contains(&tf.marker))
@@ -561,9 +581,7 @@ fn run_scenario(ops: &[Op]) {
561581
let found = grep_finds(picker, dead, GrepMode::PlainText);
562582
drop(guard);
563583
if found {
564-
last_failure = Some(format!(
565-
"dead marker {dead:?} still findable"
566-
));
584+
last_failure = Some(format!("dead marker {dead:?} still findable"));
567585
all_ok = false;
568586
break;
569587
}
@@ -578,9 +596,8 @@ fn run_scenario(ops: &[Op]) {
578596
let files = grep_file_list(picker, ig, GrepMode::PlainText);
579597
drop(guard);
580598
if !files.is_empty() {
581-
last_failure = Some(format!(
582-
"ignored marker {ig:?} found in {files:?}"
583-
));
599+
last_failure =
600+
Some(format!("ignored marker {ig:?} found in {files:?}"));
584601
all_ok = false;
585602
break;
586603
}
@@ -590,7 +607,9 @@ fn run_scenario(ops: &[Op]) {
590607
if all_ok {
591608
eprintln!(
592609
" op[{op_idx}] verify OK: {mode_name} mode, {} live, {} dead, {} ignored",
593-
tracked.len(), dead_markers.len(), ignored_markers.len(),
610+
tracked.len(),
611+
dead_markers.len(),
612+
ignored_markers.len(),
594613
);
595614
break;
596615
}
@@ -616,8 +635,12 @@ fn run_scenario(ops: &[Op]) {
616635
let guard = shared_picker.read().unwrap();
617636
let picker = guard.as_ref().unwrap();
618637

619-
let live_ok = tracked.iter().all(|tf| grep_finds(picker, &tf.marker, GrepMode::PlainText));
620-
let dead_ok = dead_markers.iter().all(|d| !grep_finds(picker, d, GrepMode::PlainText));
638+
let live_ok = tracked
639+
.iter()
640+
.all(|tf| grep_finds(picker, &tf.marker, GrepMode::PlainText));
641+
let dead_ok = dead_markers
642+
.iter()
643+
.all(|d| !grep_finds(picker, d, GrepMode::PlainText));
621644
drop(guard);
622645

623646
if live_ok && dead_ok {

crates/fff-nvim/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ tempfile = "3.8"
9696

9797
[[bench]]
9898
name = "indexing_and_search"
99-
path = "benches/fuzzy_seearch_bench.rs"
99+
path = "benches/fuzzy_search_bench.rs"
100100
harness = false
101101

102102
[[bench]]
File renamed without changes.

0 commit comments

Comments
 (0)