Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Clément Renault <clement@meilisearch.com>
  • Loading branch information
irevoire and Kerollmops committed Jun 20, 2024
1 parent 0cb2900 commit ae9e854
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ pub enum Error {
/// Arroy is not able to find the metadata for a given index.
/// It is probably because the user forget to build the database.
#[error(
"Metadata are missing on index {0}, did you build your database before trying to read it"
"Metadata are missing on index {0}, You must build your database before attempting to read it"
)]
MissingMetadata(u16),

Expand Down
4 changes: 1 addition & 3 deletions src/reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,7 @@ impl<'t, D: Distance> Reader<'t, D> {
received: D::name(),
});
}
let need_build =
database.remap_data_type::<Bytes>().get(rtxn, &Key::updated(index))?.is_some();
if need_build {
if database.remap_data_type::<Bytes>().get(rtxn, &Key::updated(index))?.is_some() {
return Err(Error::NeedBuild(index));
}

Expand Down
2 changes: 1 addition & 1 deletion src/tests/reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ fn open_unfinished_db() {

let rtxn = handle.env.read_txn().unwrap();
let ret = Reader::<Euclidean>::open(&rtxn, 0, handle.database).map(|_| ()).unwrap_err();
insta::assert_display_snapshot!(ret, @"Metadata are missing on index 0, did you build your database before trying to read it");
insta::assert_display_snapshot!(ret, @"Metadata are missing on index 0, You must build your database before attempting to read it");

Check warning on line 37 in src/tests/reader.rs

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest, stable)

use of deprecated macro `insta::assert_display_snapshot`: use assert_snapshot!() instead

Check warning on line 37 in src/tests/reader.rs

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest, stable)

use of deprecated macro `insta::assert_display_snapshot`: use assert_snapshot!() instead

Check warning on line 37 in src/tests/reader.rs

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest, stable)

use of deprecated macro `insta::assert_display_snapshot`: use assert_snapshot!() instead

Check warning on line 37 in src/tests/reader.rs

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest, beta)

use of deprecated macro `insta::assert_display_snapshot`: use assert_snapshot!() instead

Check warning on line 37 in src/tests/reader.rs

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest, beta)

use of deprecated macro `insta::assert_display_snapshot`: use assert_snapshot!() instead

Check warning on line 37 in src/tests/reader.rs

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest, beta)

use of deprecated macro `insta::assert_display_snapshot`: use assert_snapshot!() instead

Check warning on line 37 in src/tests/reader.rs

View workflow job for this annotation

GitHub Actions / test (macos-latest-xlarge, stable)

use of deprecated macro `insta::assert_display_snapshot`: use assert_snapshot!() instead

Check warning on line 37 in src/tests/reader.rs

View workflow job for this annotation

GitHub Actions / test (macos-latest-xlarge, stable)

use of deprecated macro `insta::assert_display_snapshot`: use assert_snapshot!() instead

Check warning on line 37 in src/tests/reader.rs

View workflow job for this annotation

GitHub Actions / test (macos-latest-xlarge, stable)

use of deprecated macro `insta::assert_display_snapshot`: use assert_snapshot!() instead

Check warning on line 37 in src/tests/reader.rs

View workflow job for this annotation

GitHub Actions / test (macos-latest-xlarge, beta)

use of deprecated macro `insta::assert_display_snapshot`: use assert_snapshot!() instead

Check warning on line 37 in src/tests/reader.rs

View workflow job for this annotation

GitHub Actions / test (macos-latest-xlarge, beta)

use of deprecated macro `insta::assert_display_snapshot`: use assert_snapshot!() instead

Check warning on line 37 in src/tests/reader.rs

View workflow job for this annotation

GitHub Actions / test (macos-latest-xlarge, beta)

use of deprecated macro `insta::assert_display_snapshot`: use assert_snapshot!() instead

Check warning on line 37 in src/tests/reader.rs

View workflow job for this annotation

GitHub Actions / test (windows-latest, stable)

use of deprecated macro `insta::assert_display_snapshot`: use assert_snapshot!() instead

Check warning on line 37 in src/tests/reader.rs

View workflow job for this annotation

GitHub Actions / test (windows-latest, stable)

use of deprecated macro `insta::assert_display_snapshot`: use assert_snapshot!() instead

Check warning on line 37 in src/tests/reader.rs

View workflow job for this annotation

GitHub Actions / test (windows-latest, stable)

use of deprecated macro `insta::assert_display_snapshot`: use assert_snapshot!() instead

Check warning on line 37 in src/tests/reader.rs

View workflow job for this annotation

GitHub Actions / test (windows-latest, beta)

use of deprecated macro `insta::assert_display_snapshot`: use assert_snapshot!() instead

Check warning on line 37 in src/tests/reader.rs

View workflow job for this annotation

GitHub Actions / test (windows-latest, beta)

use of deprecated macro `insta::assert_display_snapshot`: use assert_snapshot!() instead

Check warning on line 37 in src/tests/reader.rs

View workflow job for this annotation

GitHub Actions / test (windows-latest, beta)

use of deprecated macro `insta::assert_display_snapshot`: use assert_snapshot!() instead
}

#[test]
Expand Down
1 change: 0 additions & 1 deletion src/tests/writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ fn write_one_vector() {

#[test]
fn write_one_vector_in_one_tree() {
let _ = env_logger::builder().is_test(true).parse_filters("trace").try_init();
let handle = create_database::<Euclidean>();
let mut wtxn = handle.env.write_txn().unwrap();
let writer = Writer::new(handle.database, 0, 3);
Expand Down

0 comments on commit ae9e854

Please sign in to comment.