mirror of
https://gitlab.com/veilid/veilid.git
synced 2025-04-16 22:13:14 -04:00
[ci skip] clippy fixes
This commit is contained in:
parent
f6f5dfea87
commit
7d81579acc
@ -50,7 +50,7 @@ pub struct VeilidComponentGuard<'a, T: VeilidComponent + Send + Sync + 'static>
|
||||
_phantom: core::marker::PhantomData<&'a T>,
|
||||
}
|
||||
|
||||
impl<'a, T> core::ops::Deref for VeilidComponentGuard<'a, T>
|
||||
impl<T> core::ops::Deref for VeilidComponentGuard<'_, T>
|
||||
where
|
||||
T: VeilidComponent + Send + Sync + 'static,
|
||||
{
|
||||
|
@ -3,6 +3,10 @@ use super::*;
|
||||
use crate::*;
|
||||
use core::convert::TryInto;
|
||||
|
||||
pub const MAX_ENVELOPE_SIZE: usize = 65507;
|
||||
pub const MIN_ENVELOPE_SIZE: usize = 0x6A + 0x40; // Header + Signature
|
||||
pub const ENVELOPE_MAGIC: &[u8; 3] = b"VLD";
|
||||
|
||||
/// Envelopes are versioned
|
||||
///
|
||||
/// These are the formats for the on-the-wire serialization performed by this module
|
||||
@ -29,11 +33,6 @@ use core::convert::TryInto;
|
||||
/// signature: [u8; 64], // 0x?? (end-0x40): Signature of the entire envelope including header is appended to the packet
|
||||
/// // entire header needs to be included in message digest, relays are not allowed to modify the envelope without invalidating the signature.
|
||||
/// }
|
||||
|
||||
pub const MAX_ENVELOPE_SIZE: usize = 65507;
|
||||
pub const MIN_ENVELOPE_SIZE: usize = 0x6A + 0x40; // Header + Signature
|
||||
pub const ENVELOPE_MAGIC: &[u8; 3] = b"VLD";
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Default)]
|
||||
pub struct Envelope {
|
||||
version: EnvelopeVersion,
|
||||
|
@ -19,7 +19,7 @@ impl<'a> CryptoSystemGuard<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> core::ops::Deref for CryptoSystemGuard<'a> {
|
||||
impl core::ops::Deref for CryptoSystemGuard<'_> {
|
||||
type Target = dyn CryptoSystem + Send + Sync;
|
||||
|
||||
fn deref(&self) -> &Self::Target {
|
||||
@ -39,7 +39,7 @@ async fn yielding<R, T: FnOnce() -> R>(x: T) -> R {
|
||||
out
|
||||
}
|
||||
|
||||
impl<'a> AsyncCryptoSystemGuard<'a> {
|
||||
impl AsyncCryptoSystemGuard<'_> {
|
||||
// Accessors
|
||||
pub fn kind(&self) -> CryptoKind {
|
||||
self.guard.kind()
|
||||
|
@ -3,6 +3,11 @@ use super::*;
|
||||
use crate::*;
|
||||
use core::convert::TryInto;
|
||||
|
||||
pub const MAX_RECEIPT_SIZE: usize = 1380;
|
||||
pub const MAX_EXTRA_DATA_SIZE: usize = MAX_RECEIPT_SIZE - MIN_RECEIPT_SIZE; // 1250
|
||||
pub const MIN_RECEIPT_SIZE: usize = 130;
|
||||
pub const RECEIPT_MAGIC: &[u8; 3] = b"RCP";
|
||||
|
||||
/// Out-of-band receipts are versioned along with envelope versions
|
||||
///
|
||||
/// These are the formats for the on-the-wire serialization performed by this module
|
||||
@ -26,12 +31,6 @@ use core::convert::TryInto;
|
||||
/// extra_data: [u8; ??], // 0x42: Extra data is appended (arbitrary extra data, not encrypted by receipt itself, maximum size is 1250 bytes)
|
||||
/// signature: [u8; 64], // 0x?? (end-0x40): Signature of the entire receipt including header and extra data is appended to the packet
|
||||
/// }
|
||||
|
||||
pub const MAX_RECEIPT_SIZE: usize = 1380;
|
||||
pub const MAX_EXTRA_DATA_SIZE: usize = MAX_RECEIPT_SIZE - MIN_RECEIPT_SIZE; // 1250
|
||||
pub const MIN_RECEIPT_SIZE: usize = 130;
|
||||
pub const RECEIPT_MAGIC: &[u8; 3] = b"RCP";
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Default)]
|
||||
pub struct Receipt {
|
||||
version: u8,
|
||||
|
@ -53,7 +53,7 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, F, Out> VisitOutput<Out> for FmtStripVisitor<'a, F, Out>
|
||||
impl<F, Out> VisitOutput<Out> for FmtStripVisitor<'_, F, Out>
|
||||
where
|
||||
F: Visit + VisitOutput<Out>,
|
||||
{
|
||||
@ -70,7 +70,7 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, F, Out> Visit for FmtStripVisitor<'a, F, Out>
|
||||
impl<F, Out> Visit for FmtStripVisitor<'_, F, Out>
|
||||
where
|
||||
F: Visit + VisitOutput<Out>,
|
||||
{
|
||||
|
@ -13,7 +13,7 @@ pub const ADDRESS_CONSISTENCY_DETECTION_COUNT: usize = 5;
|
||||
/// Length of consistent/inconsistent result cache for detection
|
||||
pub const ADDRESS_CHECK_CACHE_SIZE: usize = 10;
|
||||
|
||||
/// Length of consistent/inconsistent result cache for detection
|
||||
// /// Length of consistent/inconsistent result cache for detection
|
||||
// pub const ADDRESS_CHECK_PEER_COUNT: usize = 256;
|
||||
// /// Frequency of address checks
|
||||
// pub const PUBLIC_ADDRESS_CHECK_TASK_INTERVAL_SECS: u32 = 60;
|
||||
|
@ -521,7 +521,7 @@ impl ConnectionManager {
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
/// Asynchronous Event Processor
|
||||
// Asynchronous Event Processor
|
||||
|
||||
async fn process_connection_manager_event(
|
||||
&self,
|
||||
|
@ -351,7 +351,7 @@ impl Network {
|
||||
// Add static public dialinfo if it's configured
|
||||
if let Some(url) = url.as_ref() {
|
||||
let mut split_url = SplitUrl::from_str(url).wrap_err("couldn't split url")?;
|
||||
if split_url.scheme.to_ascii_lowercase() != "ws" {
|
||||
if !split_url.scheme.eq_ignore_ascii_case("ws") {
|
||||
bail!("WS URL must use 'ws://' scheme");
|
||||
}
|
||||
"ws".clone_into(&mut split_url.scheme);
|
||||
@ -478,7 +478,7 @@ impl Network {
|
||||
if let Some(url) = url.as_ref() {
|
||||
// Add static public dialinfo if it's configured
|
||||
let mut split_url = SplitUrl::from_str(url)?;
|
||||
if split_url.scheme.to_ascii_lowercase() != "wss" {
|
||||
if !split_url.scheme.eq_ignore_ascii_case("wss") {
|
||||
bail!("WSS URL must use 'wss://' scheme");
|
||||
}
|
||||
"wss".clone_into(&mut split_url.scheme);
|
||||
|
@ -981,7 +981,7 @@ impl BucketEntryInner {
|
||||
self.peer_stats.rpc_stats.last_question_ts
|
||||
}
|
||||
|
||||
/// Return the last time we asked a node a question
|
||||
// /// Return the last time we asked a node a question
|
||||
// fn last_question_time(&self) -> Option<Timestamp> {
|
||||
// self.peer_stats.rpc_stats.last_question_ts
|
||||
// }
|
||||
@ -1112,7 +1112,7 @@ impl BucketEntryInner {
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
/// Called when rpc processor things happen
|
||||
// Called when rpc processor things happen
|
||||
|
||||
pub(super) fn question_sent(
|
||||
&mut self,
|
||||
|
@ -209,7 +209,7 @@ impl RoutingTable {
|
||||
}
|
||||
|
||||
/////////////////////////////////////
|
||||
/// Initialization
|
||||
// Initialization
|
||||
|
||||
/// Called to initialize the routing table after it is created
|
||||
async fn init_async(&self) -> EyreResult<()> {
|
||||
@ -517,7 +517,7 @@ impl RoutingTable {
|
||||
}
|
||||
|
||||
/////////////////////////////////////
|
||||
/// Locked operations
|
||||
// Locked operations
|
||||
|
||||
pub fn routing_domain_for_address(&self, address: Address) -> Option<RoutingDomain> {
|
||||
self.inner.read().routing_domain_for_address(address)
|
||||
|
@ -16,14 +16,13 @@ pub(crate) struct NodeRefLock<
|
||||
}
|
||||
|
||||
impl<
|
||||
'a,
|
||||
N: NodeRefAccessorsTrait
|
||||
+ NodeRefOperateTrait
|
||||
+ VeilidComponentRegistryAccessor
|
||||
+ fmt::Debug
|
||||
+ fmt::Display
|
||||
+ Clone,
|
||||
> VeilidComponentRegistryAccessor for NodeRefLock<'a, N>
|
||||
> VeilidComponentRegistryAccessor for NodeRefLock<'_, N>
|
||||
{
|
||||
fn registry(&self) -> VeilidComponentRegistry {
|
||||
self.nr.registry()
|
||||
@ -45,8 +44,8 @@ impl<'a, N: NodeRefAccessorsTrait + NodeRefOperateTrait + fmt::Debug + fmt::Disp
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, N: NodeRefAccessorsTrait + NodeRefOperateTrait + fmt::Debug + fmt::Display + Clone>
|
||||
NodeRefAccessorsTrait for NodeRefLock<'a, N>
|
||||
impl<N: NodeRefAccessorsTrait + NodeRefOperateTrait + fmt::Debug + fmt::Display + Clone>
|
||||
NodeRefAccessorsTrait for NodeRefLock<'_, N>
|
||||
{
|
||||
fn entry(&self) -> Arc<BucketEntry> {
|
||||
self.nr.entry()
|
||||
@ -73,8 +72,8 @@ impl<'a, N: NodeRefAccessorsTrait + NodeRefOperateTrait + fmt::Debug + fmt::Disp
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, N: NodeRefAccessorsTrait + NodeRefOperateTrait + fmt::Debug + fmt::Display + Clone>
|
||||
NodeRefOperateTrait for NodeRefLock<'a, N>
|
||||
impl<N: NodeRefAccessorsTrait + NodeRefOperateTrait + fmt::Debug + fmt::Display + Clone>
|
||||
NodeRefOperateTrait for NodeRefLock<'_, N>
|
||||
{
|
||||
fn operate<T, F>(&self, f: F) -> T
|
||||
where
|
||||
@ -107,21 +106,21 @@ impl<'a, N: NodeRefAccessorsTrait + NodeRefOperateTrait + fmt::Debug + fmt::Disp
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, N: NodeRefAccessorsTrait + NodeRefOperateTrait + fmt::Debug + fmt::Display + Clone>
|
||||
NodeRefCommonTrait for NodeRefLock<'a, N>
|
||||
impl<N: NodeRefAccessorsTrait + NodeRefOperateTrait + fmt::Debug + fmt::Display + Clone>
|
||||
NodeRefCommonTrait for NodeRefLock<'_, N>
|
||||
{
|
||||
}
|
||||
|
||||
impl<'a, N: NodeRefAccessorsTrait + NodeRefOperateTrait + fmt::Debug + fmt::Display + Clone>
|
||||
fmt::Display for NodeRefLock<'a, N>
|
||||
impl<N: NodeRefAccessorsTrait + NodeRefOperateTrait + fmt::Debug + fmt::Display + Clone>
|
||||
fmt::Display for NodeRefLock<'_, N>
|
||||
{
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
write!(f, "{}", self.nr)
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, N: NodeRefAccessorsTrait + NodeRefOperateTrait + fmt::Debug + fmt::Display + Clone>
|
||||
fmt::Debug for NodeRefLock<'a, N>
|
||||
impl<N: NodeRefAccessorsTrait + NodeRefOperateTrait + fmt::Debug + fmt::Display + Clone>
|
||||
fmt::Debug for NodeRefLock<'_, N>
|
||||
{
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
f.debug_struct("NodeRefLock").field("nr", &self.nr).finish()
|
||||
|
@ -16,14 +16,13 @@ pub(crate) struct NodeRefLockMut<
|
||||
}
|
||||
|
||||
impl<
|
||||
'a,
|
||||
N: NodeRefAccessorsTrait
|
||||
+ NodeRefOperateTrait
|
||||
+ VeilidComponentRegistryAccessor
|
||||
+ fmt::Debug
|
||||
+ fmt::Display
|
||||
+ Clone,
|
||||
> VeilidComponentRegistryAccessor for NodeRefLockMut<'a, N>
|
||||
> VeilidComponentRegistryAccessor for NodeRefLockMut<'_, N>
|
||||
{
|
||||
fn registry(&self) -> VeilidComponentRegistry {
|
||||
self.nr.registry()
|
||||
@ -46,8 +45,8 @@ impl<'a, N: NodeRefAccessorsTrait + NodeRefOperateTrait + fmt::Debug + fmt::Disp
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, N: NodeRefAccessorsTrait + NodeRefOperateTrait + fmt::Debug + fmt::Display + Clone>
|
||||
NodeRefAccessorsTrait for NodeRefLockMut<'a, N>
|
||||
impl<N: NodeRefAccessorsTrait + NodeRefOperateTrait + fmt::Debug + fmt::Display + Clone>
|
||||
NodeRefAccessorsTrait for NodeRefLockMut<'_, N>
|
||||
{
|
||||
fn entry(&self) -> Arc<BucketEntry> {
|
||||
self.nr.entry()
|
||||
@ -74,8 +73,8 @@ impl<'a, N: NodeRefAccessorsTrait + NodeRefOperateTrait + fmt::Debug + fmt::Disp
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, N: NodeRefAccessorsTrait + NodeRefOperateTrait + fmt::Debug + fmt::Display + Clone>
|
||||
NodeRefOperateTrait for NodeRefLockMut<'a, N>
|
||||
impl<N: NodeRefAccessorsTrait + NodeRefOperateTrait + fmt::Debug + fmt::Display + Clone>
|
||||
NodeRefOperateTrait for NodeRefLockMut<'_, N>
|
||||
{
|
||||
fn operate<T, F>(&self, f: F) -> T
|
||||
where
|
||||
@ -110,21 +109,21 @@ impl<'a, N: NodeRefAccessorsTrait + NodeRefOperateTrait + fmt::Debug + fmt::Disp
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, N: NodeRefAccessorsTrait + NodeRefOperateTrait + fmt::Debug + fmt::Display + Clone>
|
||||
NodeRefCommonTrait for NodeRefLockMut<'a, N>
|
||||
impl<N: NodeRefAccessorsTrait + NodeRefOperateTrait + fmt::Debug + fmt::Display + Clone>
|
||||
NodeRefCommonTrait for NodeRefLockMut<'_, N>
|
||||
{
|
||||
}
|
||||
|
||||
impl<'a, N: NodeRefAccessorsTrait + NodeRefOperateTrait + fmt::Debug + fmt::Display + Clone>
|
||||
fmt::Display for NodeRefLockMut<'a, N>
|
||||
impl<N: NodeRefAccessorsTrait + NodeRefOperateTrait + fmt::Debug + fmt::Display + Clone>
|
||||
fmt::Display for NodeRefLockMut<'_, N>
|
||||
{
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
write!(f, "{}", self.nr)
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, N: NodeRefAccessorsTrait + NodeRefOperateTrait + fmt::Debug + fmt::Display + Clone>
|
||||
fmt::Debug for NodeRefLockMut<'a, N>
|
||||
impl<N: NodeRefAccessorsTrait + NodeRefOperateTrait + fmt::Debug + fmt::Display + Clone>
|
||||
fmt::Debug for NodeRefLockMut<'_, N>
|
||||
{
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
f.debug_struct("NodeRefLockMut")
|
||||
|
@ -1337,10 +1337,10 @@ impl RoutingTableInner {
|
||||
}
|
||||
|
||||
// reliable nodes come first, pessimistically treating our own node as unreliable
|
||||
let ra = a_entry.as_ref().map_or(false, |x| {
|
||||
let ra = a_entry.as_ref().is_some_and(|x| {
|
||||
x.with_inner(|x| x.check_unreliable(cur_ts).is_none())
|
||||
});
|
||||
let rb = b_entry.as_ref().map_or(false, |x| {
|
||||
let rb = b_entry.as_ref().is_some_and(|x| {
|
||||
x.with_inner(|x| x.check_unreliable(cur_ts).is_none())
|
||||
});
|
||||
if ra != rb {
|
||||
|
@ -30,7 +30,7 @@ impl<'a> RoutingDomainEditorLocalNetwork<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> RoutingDomainEditorCommonTrait for RoutingDomainEditorLocalNetwork<'a> {
|
||||
impl RoutingDomainEditorCommonTrait for RoutingDomainEditorLocalNetwork<'_> {
|
||||
#[instrument(level = "debug", skip(self))]
|
||||
fn clear_dial_info_details(
|
||||
&mut self,
|
||||
|
@ -41,7 +41,7 @@ impl<'a> RoutingDomainEditorPublicInternet<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> RoutingDomainEditorCommonTrait for RoutingDomainEditorPublicInternet<'a> {
|
||||
impl RoutingDomainEditorCommonTrait for RoutingDomainEditorPublicInternet<'_> {
|
||||
#[instrument(level = "debug", skip(self))]
|
||||
fn clear_dial_info_details(
|
||||
&mut self,
|
||||
|
@ -97,7 +97,7 @@ impl SignedNodeInfo {
|
||||
}
|
||||
}
|
||||
// Check our relay if we have one
|
||||
return self
|
||||
self
|
||||
.relay_info()
|
||||
.map(|relay_ni| {
|
||||
for did in relay_ni.dial_info_detail_list() {
|
||||
@ -112,7 +112,7 @@ impl SignedNodeInfo {
|
||||
}
|
||||
false
|
||||
})
|
||||
.unwrap_or_default();
|
||||
.unwrap_or_default()
|
||||
}
|
||||
|
||||
#[cfg(feature = "geolocation")]
|
||||
|
@ -207,7 +207,7 @@ impl RPCProcessor {
|
||||
}
|
||||
|
||||
/////////////////////////////////////
|
||||
/// Initialization
|
||||
// Initialization
|
||||
|
||||
#[expect(clippy::unused_async)]
|
||||
async fn init_async(&self) -> EyreResult<()> {
|
||||
|
@ -234,7 +234,7 @@ impl RoutingContext {
|
||||
}
|
||||
|
||||
///////////////////////////////////
|
||||
/// DHT Records
|
||||
// DHT Records
|
||||
|
||||
/// Deterministicly builds the record key for a given schema and owner public key
|
||||
#[instrument(target = "veilid_api", level = "debug", fields(__VEILID_LOG_KEY = self.log_key()), ret, err)]
|
||||
|
@ -5,7 +5,6 @@ use super::*;
|
||||
/// Required on 32-bit platforms for serialization because Rust aligns u64 on 4 byte boundaries.
|
||||
/// Some zero-copy serialization frameworks also want 8-byte alignment.
|
||||
/// Supports serializing to string for JSON as well, since JSON can't handle 64-bit numbers to Javascript.
|
||||
|
||||
macro_rules! aligned_u64_type {
|
||||
($name:ident) => {
|
||||
#[derive(
|
||||
|
@ -209,7 +209,7 @@ pub extern "C" fn initialize_veilid_flutter(
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
/// C-compatible FFI Functions
|
||||
// C-compatible FFI Functions
|
||||
|
||||
#[no_mangle]
|
||||
#[instrument]
|
||||
|
Loading…
x
Reference in New Issue
Block a user