Skip to content

Commit

Permalink
simplify
Browse files Browse the repository at this point in the history
  • Loading branch information
wsxiaoys committed Apr 28, 2024
1 parent d4b1788 commit b13f1b0
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
1 change: 0 additions & 1 deletion crates/tabby-scheduler/src/dataset/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ impl RepositoryExt for RepositoryConfig {
.expect("Paths always begin with the prefix");

let Some(ext) = relative_path.extension() else {
debug!("No extension for {relative_path:?}");
continue;

Check warning on line 49 in crates/tabby-scheduler/src/dataset/mod.rs

View check run for this annotation

Codecov / codecov/patch

crates/tabby-scheduler/src/dataset/mod.rs#L48-L49

Added lines #L48 - L49 were not covered by tests
};

Expand Down
5 changes: 2 additions & 3 deletions crates/tabby-scheduler/src/index.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@ static AVG_LINE_LENGTH_THRESHOLD: f32 = 150f32;
pub fn index_repositories(_config: &[RepositoryConfig]) {

Check warning on line 18 in crates/tabby-scheduler/src/index.rs

View check run for this annotation

Codecov / codecov/patch

crates/tabby-scheduler/src/index.rs#L18

Added line #L18 was not covered by tests
let code = CodeSearchSchema::new();

let index_dir = path::index_dir();
fs::create_dir_all(&index_dir).expect("Failed to create index directory");
let index = open_or_create_index(&code, &index_dir);
let index = open_or_create_index(&code, &path::index_dir());

Check warning on line 21 in crates/tabby-scheduler/src/index.rs

View check run for this annotation

Codecov / codecov/patch

crates/tabby-scheduler/src/index.rs#L21

Added line #L21 was not covered by tests
register_tokenizers(&index);

// Initialize the search index writer with an initial arena size of 150 MB.
Expand Down Expand Up @@ -96,6 +94,7 @@ fn open_or_create_index(code: &CodeSearchSchema, path: &Path) -> Index {
}

Check warning on line 94 in crates/tabby-scheduler/src/index.rs

View check run for this annotation

Codecov / codecov/patch

crates/tabby-scheduler/src/index.rs#L94

Added line #L94 was not covered by tests

fn open_or_create_index_impl(code: &CodeSearchSchema, path: &Path) -> tantivy::Result<Index> {
fs::create_dir_all(path).expect("Failed to create index directory");
let directory = MmapDirectory::open(path).expect("Failed to open index directory");
Index::open_or_create(directory, code.schema.clone())
}

Check warning on line 100 in crates/tabby-scheduler/src/index.rs

View check run for this annotation

Codecov / codecov/patch

crates/tabby-scheduler/src/index.rs#L96-L100

Added lines #L96 - L100 were not covered by tests

0 comments on commit b13f1b0

Please sign in to comment.