Skip to content

Commit

Permalink
fix: clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
darkskygit committed Dec 28, 2023
1 parent be10f25 commit 78bd6ba
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 26 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 10 additions & 5 deletions libs/jwst-codec-utils/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
[package]
name = "jwst-codec-utils"
version = "0.1.0"
authors = ["x1a0t <[email protected]>", "DarkSky <[email protected]>"]
edition = "2021"
name = "jwst-codec-utils"
version = "0.0.1"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

Expand All @@ -16,7 +17,7 @@ arbitrary = { version = "1.3", features = ["derive"], optional = true }
clap = { version = "4.4", features = ["derive"], optional = true }
phf = { version = "0.11", features = ["macros"], optional = true }
rand_chacha = "0.3"
regex = { version = "1.9", optional = true }
regex = { version = "1.10", optional = true }

# ======= bench dependencies =======
lib0 = { version = "=0.16.5", features = ["lib0-serde"] }
Expand All @@ -38,6 +39,10 @@ proptest-derive = "0.4"
name = "bench_result_render"
path = "bin/bench_result_render.rs"

[[bin]]
name = "doc_merger"
path = "bin/doc_merger.rs"

[[bin]]
name = "memory_leak_test"
path = "bin/memory_leak_test.rs"
Expand All @@ -60,11 +65,11 @@ name = "text_ops_benchmarks"

[[bench]]
harness = false
name = "update_benchmarks"
name = "apply_benchmarks"

[[bench]]
harness = false
name = "apply_benchmarks"
name = "update_benchmarks"

[lib]
bench = true
30 changes: 15 additions & 15 deletions libs/jwst-codec-utils/fuzz/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
[package]
edition = "2021"
name = "jwst-codec-fuzz"
version = "0.0.0"
publish = false
edition = "2021"
version = "0.0.0"

[package.metadata]
cargo-fuzz = true

[dependencies]
rand = "0.8.5"
rand_chacha = "0.3.1"
libfuzzer-sys = "0.4.6"
rand = "0.8"
rand_chacha = "0.3"
libfuzzer-sys = "0.4"

jwst-codec-utils = { path = "..", features = ["fuzz"] }
lib0 = "0.16.5"
Expand All @@ -27,65 +27,65 @@ members = ["."]
debug = 1

[[bin]]
doc = false
name = "codec_doc_any_struct"
path = "fuzz_targets/codec_doc_any_struct.rs"
test = false
doc = false

[[bin]]
doc = false
name = "codec_doc_any"
path = "fuzz_targets/codec_doc_any.rs"
test = false
doc = false

[[bin]]
doc = false
name = "decode_bytes"
path = "fuzz_targets/decode_bytes.rs"
test = false
doc = false

[[bin]]
doc = false
name = "ins_del_text"
path = "fuzz_targets/ins_del_text.rs"
test = false
doc = false

[[bin]]
doc = false
name = "sync_message"
path = "fuzz_targets/sync_message.rs"
test = false
doc = false

[[bin]]
doc = false
name = "i32_decode"
path = "fuzz_targets/i32_decode.rs"
test = false
doc = false

[[bin]]
doc = false
name = "i32_encode"
path = "fuzz_targets/i32_encode.rs"
test = false
doc = false

[[bin]]
doc = false
name = "u64_decode"
path = "fuzz_targets/u64_decode.rs"
test = false
doc = false


[[bin]]
doc = false
name = "u64_encode"
path = "fuzz_targets/u64_encode.rs"
test = false
doc = false

[[bin]]
doc = false
name = "apply_update"
path = "fuzz_targets/apply_update.rs"
test = false
doc = false

[patch.crates-io]
lib0 = { git = "https://github.com/toeverything/y-crdt", rev = "a700f09" }
Expand Down
4 changes: 2 additions & 2 deletions libs/jwst-codec-utils/src/doc_operation/yrs_op/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ mod tests {
fn test_ops_registry_get_ops() {
let ops_registry = OpsRegistry::new();
let ops = ops_registry.get_ops(&CRDTNestType::Array);
assert!(ops.len() > 0);
assert!(!ops.is_empty());
}

#[test]
Expand All @@ -170,6 +170,6 @@ mod tests {
let array = doc.get_or_insert_array("array");
let ops_registry = OpsRegistry::new();
let ops = ops_registry.get_ops_from_yrs_nest_type(&YrsNestType::ArrayType(array));
assert!(ops.len() > 0);
assert!(!ops.is_empty());
}
}
2 changes: 1 addition & 1 deletion libs/jwst-codec/src/codec/buffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,6 @@ mod tests {
let mut buf = Vec::<u8>::new();
write_var_buffer(&mut buf, data).unwrap();
let result = read_var_buffer(buf.as_bytes());
assert_eq!(result, Ok((&[][..], &data[..])));
assert_eq!(result, Ok((&[][..], data)));
}
}
4 changes: 2 additions & 2 deletions libs/jwst-codec/src/doc/awareness.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ use std::{cmp::max, collections::hash_map::Entry};
use super::*;
use crate::sync::Arc;

type AwarenessCallback = dyn Fn(&Awareness, AwarenessEvent) + Send + Sync + 'static;
pub type AwarenessCallback = Arc<dyn Fn(&Awareness, AwarenessEvent) + Send + Sync + 'static>;

pub struct Awareness {
awareness: AwarenessStates,
callback: Option<Arc<AwarenessCallback>>,
callback: Option<AwarenessCallback>,
local_id: u64,
}

Expand Down

0 comments on commit 78bd6ba

Please sign in to comment.