Fix build when bstr is also imported.

Add type annotation to `vec` to avoid the following build error if you
additionally import `bstr`:

```
~/jj> cargo test
   Compiling jj-lib v0.8.0 (/home/aspotashev/jj/lib)
warning: unused import: `bstr`
  --> lib/src/default_index_store.rs:30:5
   |
30 | use bstr;
   |     ^^^^
   |
   = note: `#[warn(unused_imports)]` on by default

error[E0282]: type annotations needed
   --> lib/src/default_index_store.rs:564:14
    |
564 |             .as_mut()
    |              ^^^^^^
565 |             .write_u32::<LittleEndian>(parent_overflow.len() as u32)
    |              --------- type must be known at this point
    |
help: try using a fully qualified path to specify the expected types
    |
563 |         <[u8] as AsMut<T>>::as_mut(&mut buf[parent_overflow_offset..parent_overflow_offset + 4])
    |         +++++++++++++++++++++++++++++++                                                        ~

For more information about this error, try `rustc --explain E0282`.
warning: `jj-lib` (lib) generated 1 warning
error: could not compile `jj-lib` (lib) due to previous error; 1 warning emitted
```

Reason to support `bstr` being imported: in a Bazel environment where
crates are imported with certain features enabled, jj-lib may pull in
bstr as part of the following dependency chain:
  jj-lib -> insta -> similar -> bstr.
This commit is contained in:
Alexander Potashev 2023-08-15 00:21:03 +02:00 committed by Alexander Potashev
parent 873634a80e
commit 2d81cf9156

View file

@ -560,8 +560,7 @@ impl MutableIndexImpl {
buf.write_u32::<LittleEndian>(pos.0).unwrap();
}
buf[parent_overflow_offset..parent_overflow_offset + 4]
.as_mut()
(&mut buf[parent_overflow_offset..parent_overflow_offset + 4])
.write_u32::<LittleEndian>(parent_overflow.len() as u32)
.unwrap();
for parent_pos in parent_overflow {