Commit Graph

10 Commits

Author SHA1 Message Date
David Tolnay
e84e100f06 Delete extern crate lines
Summary:
`extern crate` is usually no longer needed in 2018 edition of Rust. This diff removes `extern crate` lines from fbcode where possible, replacing #[macro_use] with individual import of macros.

Before:

```
#[macro_use]
extern crate futures_ext;
extern crate serde_json;
```

After:

```
use futures_ext::try_boxfuture;
```

Reviewed By: Imxset21

Differential Revision: D17313537

fbshipit-source-id: 70462a2c161375017b77fa44aba166884ad2fdc3
2019-09-11 22:02:16 -07:00
Andres Suarez
e936dde821 Apply rustfmt to all rust files
Reviewed By: jsgf

Differential Revision: D14578283

fbshipit-source-id: 9b4a7b1fd445fd033b64c6af04ee52b27eefb616
2019-07-10 20:18:48 -07:00
Mark Thomas
1d329cae5d rust: update to 2018 edition
Summary:
Update all rust crates that compile on Rust 2018 to use the 2018 edition.

The `commitcloudsubscriber` crate only compiles with Rust 2015, so make that
explicit in `Cargo.toml`.

Reviewed By: farnz

Differential Revision: D15601648

fbshipit-source-id: 7380e6e695fc3049913af91fcbde105dfe1be4bc
2019-06-03 07:22:36 -07:00
Mark Thomas
93a98afbe4 vlqencoding: don't require Sized for Read or Write traits
Summary:
The `VLQEncode` and `VLQDecode` traits erroneously expected the (automatic)
`Sized` marker trait for `Read` and `Write`.  This meant they couldn't be used
for trait object `Read`s or `Write`s without jumping through hoops or extra
`mut` keywords.

By not requiring `Sized` we can remove those workarounds.

Reviewed By: quark-zju

Differential Revision: D12816459

fbshipit-source-id: 16353e8fefff5738bd24a9f41c9d7d250aea56fd
2018-10-29 04:10:46 -07:00
Jun Wu
3adc813687 codemod: add copyright headers
Summary: This is just the result of running `./contrib/fix-code.py $(hg files .)`

Reviewed By: ikostia

Differential Revision: D10213075

fbshipit-source-id: 88577c9b9588a5b44fcf1fe6f0082815dfeb363a
2018-10-26 15:09:12 -07:00
Jun Wu
3408c53051 vlqencoding: replace criterion with minibench
Summary: Similar with D7440249. See D7440254 for motivation.

Reviewed By: DurhamG

Differential Revision: D7562196

fbshipit-source-id: e90c623bd9576de49c3d4990ac93c105238d219c
2018-04-17 18:54:39 -07:00
Jun Wu
c114d2499b vlqencoding: add read_vlq_at API that works for AsRef<[u8]>
Summary:
This allows us to decode VLQ integers at a given offset, for anything that
implements `AsRef<[u8]>`. Instead of having to couple with a `&mut Read`
interface. The main benefit is to get rid of `mut`. The old `VLQDecode`
interface has to use `&mut Read` since reading has a side effect of changing
the internal position counter.

Reviewed By: markbt

Differential Revision: D7093998

fbshipit-source-id: 20cb14e38c828462c34f32245d0f0f512028b647
2018-04-13 21:51:19 -07:00
Jun Wu
e266793816 vlqencoding: add a benchmark
Summary:
I'm going to add more ways to do VLQ parsing (ex. reading from a `&[u8]`
instead of a `Read` which has to be mutable). So let's add a benchmark to
compare the `&[u8]` version with the `Read` version.

Reviewed By: DurhamG

Differential Revision: D7092960

fbshipit-source-id: e1189de10396516c732dc73b45b7690a1718f1c0
2018-04-13 21:51:19 -07:00
Jun Wu
f547ef9ed0 rust: vendor more crates
Summary:
criterion provides useful utilities for writing benchmarks.
fs2 provides cross-platform file locking.
memmap provides cross-platform mmap.
atomicwrites provides cross-platform atomic file rewrite.
twox-hash provides xxHash fast hash algorithm for integrity check usecase.

Reviewed By: singhsrb

Differential Revision: D7092764

fbshipit-source-id: a3a2a31c198e73701708d7124574ba447ab99c45
2018-04-13 21:51:19 -07:00
Mark Thomas
2e81565606 fb-hgext: integrate rust libraries and extensions with setup.py
Summary:
Move the rust libraries and extensions to their new locations, and integrate
them with the hg-crew setup.py.

Test Plan: Run `python setup.py build` and verify rust extensions are built.

Reviewers: durham, #mercurial

Reviewed By: durham

Subscribers: fried, jsgf, mitrandir

Differential Revision: https://phabricator.intern.facebook.com/D6677251

Tasks: T24908724

Signature: 6677251:1515450235:920faf40babbce9b09e3283ff9ca328d1c5c51e6
2018-01-08 15:26:24 -08:00