mirror of
https://github.com/loro-dev/loro.git
synced 2025-01-22 12:57:20 +00:00
chore: cargo style fix
This commit is contained in:
parent
06d7d054a5
commit
c8d5127213
6 changed files with 32 additions and 25 deletions
|
@ -1,23 +1,31 @@
|
|||
use arbitrary::Unstructured;
|
||||
use criterion::{criterion_group, criterion_main, Criterion};
|
||||
use loro_core::fuzz::test_multi_sites;
|
||||
use loro_core::fuzz::Action;
|
||||
use rand::Rng;
|
||||
use rand::SeedableRng;
|
||||
#[cfg(feature = "fuzzing")]
|
||||
mod run {
|
||||
use super::*;
|
||||
use arbitrary::Unstructured;
|
||||
use loro_core::fuzz::test_multi_sites;
|
||||
use loro_core::fuzz::Action;
|
||||
use rand::Rng;
|
||||
use rand::SeedableRng;
|
||||
|
||||
pub fn criterion_benchmark(c: &mut Criterion) {
|
||||
let mut rgn = rand::rngs::StdRng::seed_from_u64(0);
|
||||
let mut bytes = Vec::new();
|
||||
for _ in 0..1000 {
|
||||
bytes.push(rgn.gen::<u8>());
|
||||
pub fn criterion_benchmark(c: &mut Criterion) {
|
||||
let mut rgn = rand::rngs::StdRng::seed_from_u64(0);
|
||||
let mut bytes = Vec::new();
|
||||
for _ in 0..1000 {
|
||||
bytes.push(rgn.gen::<u8>());
|
||||
}
|
||||
|
||||
let mut gen = Unstructured::new(&bytes);
|
||||
let actions = gen.arbitrary::<[Action; 200]>().unwrap();
|
||||
c.bench_function("random text edit 2 sites", |b| {
|
||||
b.iter(|| test_multi_sites(2, actions.clone().into()))
|
||||
});
|
||||
}
|
||||
|
||||
let mut gen = Unstructured::new(&bytes);
|
||||
let actions = gen.arbitrary::<[Action; 200]>().unwrap();
|
||||
c.bench_function("random text edit 2 sites", |b| {
|
||||
b.iter(|| test_multi_sites(2, actions.clone().into()))
|
||||
});
|
||||
}
|
||||
pub fn dumb(_c: &mut Criterion) {}
|
||||
|
||||
criterion_group!(benches, criterion_benchmark);
|
||||
#[cfg(feature = "fuzzing")]
|
||||
criterion_group!(benches, run::criterion_benchmark);
|
||||
#[cfg(not(feature = "fuzzing"))]
|
||||
criterion_group!(benches, dumb);
|
||||
criterion_main!(benches);
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
#![allow(unused)]
|
||||
use std::{
|
||||
cell::{Ref, RefCell, RefMut},
|
||||
rc::{Rc, Weak as RcWeak},
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
mod iter;
|
||||
use std::{
|
||||
marker::PhantomPinned,
|
||||
sync::{Arc, RwLock, Weak},
|
||||
};
|
||||
|
||||
use fxhash::{FxHashMap, FxHashSet};
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
use bumpalo::boxed::Box as BumpBox;
|
||||
use std::{cell::UnsafeCell, fmt::Debug, ptr::NonNull};
|
||||
|
||||
use std::{fmt::Debug, ptr::NonNull};
|
||||
|
||||
use fxhash::FxHashSet;
|
||||
|
||||
|
@ -7,8 +7,7 @@ use crate::{
|
|||
rle_trait::{GlobalIndex, HasIndex, ZeroElement},
|
||||
rle_tree::{
|
||||
node::{InternalNode, LeafNode},
|
||||
tree_trait::GlobalTreeTrait,
|
||||
Position, UnsafeCursor,
|
||||
tree_trait::GlobalTreeTrait, UnsafeCursor,
|
||||
},
|
||||
HasLength, Mergable, Rle, RleTree, Sliceable,
|
||||
};
|
||||
|
|
|
@ -3,7 +3,7 @@ use std::{
|
|||
fmt::{Debug, Error, Formatter},
|
||||
};
|
||||
|
||||
use fxhash::{FxBuildHasher, FxHashSet, FxHasher};
|
||||
use fxhash::{FxBuildHasher, FxHashSet};
|
||||
use smallvec::SmallVec;
|
||||
|
||||
use crate::rle_tree::{
|
||||
|
|
4
justfile
4
justfile
|
@ -20,8 +20,8 @@ check:
|
|||
check-unsafe:
|
||||
env RUSTFLAGS="-Funsafe-code --cap-lints=warn" cargo check
|
||||
|
||||
fix:
|
||||
cargo clippy --fix
|
||||
fix *FLAGS:
|
||||
cargo clippy --fix {{FLAGS}}
|
||||
|
||||
deny:
|
||||
cargo deny check
|
||||
|
|
Loading…
Reference in a new issue