Fixed some warnings

This commit is contained in:
Dave
2025-11-25 13:58:27 +00:00
parent 2e4510679a
commit 3d746a8073
11 changed files with 78 additions and 48 deletions

View File

@@ -41,10 +41,10 @@ pub fn add_crdt_fields(args: OgTokenStream, input: OgTokenStream) -> OgTokenStre
);
}
return quote! {
quote! {
#input
}
.into();
.into()
}
/// Proc macro to automatically derive the CRDTNode trait
@@ -56,7 +56,7 @@ pub fn derive_json_crdt(input: OgTokenStream) -> OgTokenStream {
// used in the quasi-quotation below as `#name`
let ident = input.ident;
let ident_str = LitStr::new(&*ident.to_string(), ident.span());
let ident_str = LitStr::new(&ident.to_string(), ident.span());
let (impl_generics, ty_generics, where_clause) = input.generics.split_for_impl();
match input.data {
@@ -74,7 +74,7 @@ pub fn derive_json_crdt(input: OgTokenStream) -> OgTokenStream {
Type::Path(t) => t.to_token_stream(),
_ => return quote_spanned! { field.span() => compile_error!("Field should be a primitive or struct which implements CRDTNode") }.into(),
};
let str_literal = LitStr::new(&*ident.to_string(), ident.span());
let str_literal = LitStr::new(&ident.to_string(), ident.span());
ident_strings.push(str_literal.clone());
ident_literals.push(ident.clone());
tys.push(ty.clone());
@@ -185,10 +185,10 @@ pub fn derive_json_crdt(input: OgTokenStream) -> OgTokenStream {
expanded.into()
}
_ => {
return quote_spanned! { ident.span() => compile_error!("Cannot derive CRDT on tuple or unit structs"); }
quote_spanned! { ident.span() => compile_error!("Cannot derive CRDT on tuple or unit structs"); }
.into()
}
},
_ => return quote_spanned! { ident.span() => compile_error!("Cannot derive CRDT on enums or unions"); }.into(),
_ => quote_spanned! { ident.span() => compile_error!("Cannot derive CRDT on enums or unions"); }.into(),
}
}

View File

@@ -1,7 +1,8 @@
use bft_json_crdt::{
json_crdt::{CrdtNode, JsonValue},
keypair::make_author,
list_crdt::ListCrdt,
op::{Op, OpId, ROOT_ID}, json_crdt::{CrdtNode, JsonValue},
op::{Op, OpId, ROOT_ID},
};
use rand::{rngs::ThreadRng, seq::SliceRandom, Rng};

View File

@@ -51,7 +51,7 @@ impl Simulator {
.iter()
.map(|node| {
let node_clone = Arc::clone(node);
let start_clone = start.clone();
let start_clone = start;
thread::spawn(move || {
while start_clone.elapsed() < duration {
node_clone.submit_price();
@@ -64,7 +64,7 @@ impl Simulator {
// Spawn network propagation thread
let nodes_clone = self.nodes.clone();
let partitioned_clone = Arc::clone(&self.partitioned);
let start_clone = start.clone();
let start_clone = start;
let propagation_handle = thread::spawn(move || {
while start_clone.elapsed() < duration {
let is_partitioned = *partitioned_clone.lock().unwrap();
@@ -80,7 +80,7 @@ impl Simulator {
let crdt1 = nodes_clone[i].crdt.lock().unwrap();
let mut crdt2 = nodes_clone[j].crdt.lock().unwrap();
crdt2.merge(&*crdt1);
crdt2.merge(&crdt1);
}
}
}