Fix errors from new 1.78 clippy lints

This commit is contained in:
Sashanoraa 2024-05-03 14:40:42 -04:00
parent 5da287fae4
commit b71cb0ea6c
11 changed files with 8 additions and 19 deletions

View File

@ -26,7 +26,6 @@ use std::sync::atomic::{AtomicU64, Ordering};
use std::time::{SystemTime, UNIX_EPOCH}; use std::time::{SystemTime, UNIX_EPOCH};
use thiserror::Error; use thiserror::Error;
////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////
///
struct Dirty<T> struct Dirty<T>
where where
T: PartialEq, T: PartialEq,
@ -373,7 +372,7 @@ impl CursiveUI {
// save edited command to newest history slot // save edited command to newest history slot
let hlen = inner.cmd_history.len(); let hlen = inner.cmd_history.len();
inner.cmd_history_position = hlen - 1; inner.cmd_history_position = hlen - 1;
inner.cmd_history[hlen - 1] = text.to_owned(); text.clone_into(&mut inner.cmd_history[hlen - 1]);
} }
fn enable_command_ui(s: &mut Cursive, enabled: bool) { fn enable_command_ui(s: &mut Cursive, enabled: bool) {
@ -465,7 +464,7 @@ impl CursiveUI {
let mut inner = Self::inner_mut(s); let mut inner = Self::inner_mut(s);
let hlen = inner.cmd_history.len(); let hlen = inner.cmd_history.len();
inner.cmd_history[hlen - 1] = text.to_owned(); text.clone_into(&mut inner.cmd_history[hlen - 1]);
if hlen >= 2 && inner.cmd_history[hlen - 1] == inner.cmd_history[hlen - 2] { if hlen >= 2 && inner.cmd_history[hlen - 1] == inner.cmd_history[hlen - 2] {
inner.cmd_history[hlen - 1] = "".to_string(); inner.cmd_history[hlen - 1] = "".to_string();

View File

@ -186,7 +186,6 @@ impl ServicesContext {
} }
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
///
pub(crate) struct VeilidCoreContext { pub(crate) struct VeilidCoreContext {
pub config: VeilidConfig, pub config: VeilidConfig,
pub update_callback: UpdateCallback, pub update_callback: UpdateCallback,

View File

@ -166,7 +166,7 @@ impl ConnectionTable {
if inner.conn_by_id[protocol_index].contains_key(&id) { if inner.conn_by_id[protocol_index].contains_key(&id) {
panic!("duplicate connection id: {:#?}", network_connection); panic!("duplicate connection id: {:#?}", network_connection);
} }
if inner.protocol_index_by_id.get(&id).is_some() { if inner.protocol_index_by_id.contains_key(&id) {
panic!("duplicate id to protocol index: {:#?}", network_connection); panic!("duplicate id to protocol index: {:#?}", network_connection);
} }
if let Some(ids) = inner.ids_by_remote.get(&flow.remote()) { if let Some(ids) = inner.ids_by_remote.get(&flow.remote()) {

View File

@ -109,7 +109,6 @@ impl RawTcpNetworkConnection {
} }
/////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////
///
#[derive(Clone)] #[derive(Clone)]
pub(in crate::network_manager) struct RawTcpProtocolHandler pub(in crate::network_manager) struct RawTcpProtocolHandler

View File

@ -176,7 +176,6 @@ where
} }
/////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////
///
struct WebsocketProtocolHandlerArc { struct WebsocketProtocolHandlerArc {
tls: bool, tls: bool,
request_path: Vec<u8>, request_path: Vec<u8>,

View File

@ -295,7 +295,7 @@ impl Network {
if split_url.scheme.to_ascii_lowercase() != "ws" { if split_url.scheme.to_ascii_lowercase() != "ws" {
bail!("WS URL must use 'ws://' scheme"); bail!("WS URL must use 'ws://' scheme");
} }
split_url.scheme = "ws".to_owned(); "ws".clone_into(&mut split_url.scheme);
// Resolve static public hostnames // Resolve static public hostnames
let global_socket_addrs = split_url let global_socket_addrs = split_url
@ -413,7 +413,7 @@ impl Network {
if split_url.scheme.to_ascii_lowercase() != "wss" { if split_url.scheme.to_ascii_lowercase() != "wss" {
bail!("WSS URL must use 'wss://' scheme"); bail!("WSS URL must use 'wss://' scheme");
} }
split_url.scheme = "wss".to_owned(); "wss".clone_into(&mut split_url.scheme);
// Resolve static public hostnames // Resolve static public hostnames
let global_socket_addrs = split_url let global_socket_addrs = split_url

View File

@ -1,7 +1,6 @@
use super::*; use super::*;
///////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////
///
#[derive(Clone, Debug, PartialOrd, PartialEq, Eq, Ord, Serialize, Deserialize)] #[derive(Clone, Debug, PartialOrd, PartialEq, Eq, Ord, Serialize, Deserialize)]
pub struct SignedValueData { pub struct SignedValueData {

View File

@ -1,7 +1,6 @@
use super::*; use super::*;
///////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////
///
#[derive(Clone, PartialOrd, PartialEq, Eq, Ord, Serialize, Deserialize)] #[derive(Clone, PartialOrd, PartialEq, Eq, Ord, Serialize, Deserialize)]
pub struct SignedValueDescriptor { pub struct SignedValueDescriptor {

View File

@ -313,8 +313,7 @@ impl TableStore {
log_tstore!(debug "changing dek password"); log_tstore!(debug "changing dek password");
self.config self.config
.with_mut(|c| { .with_mut(|c| {
c.protected_store.device_encryption_key_password = c.protected_store.device_encryption_key_password.clone_from(&new_device_encryption_key_password);
new_device_encryption_key_password.clone();
Ok(new_device_encryption_key_password) Ok(new_device_encryption_key_password)
}) })
.unwrap() .unwrap()

View File

@ -918,7 +918,7 @@ impl VeilidConfig {
// Remove secrets // Remove secrets
safe_cfg.network.routing_table.node_id_secret = TypedSecretGroup::new(); safe_cfg.network.routing_table.node_id_secret = TypedSecretGroup::new();
safe_cfg.protected_store.device_encryption_key_password = "".to_owned(); "".clone_into(&mut safe_cfg.protected_store.device_encryption_key_password);
safe_cfg.protected_store.new_device_encryption_key_password = None; safe_cfg.protected_store.new_device_encryption_key_password = None;
safe_cfg safe_cfg
@ -929,7 +929,7 @@ impl VeilidConfig {
// Remove secrets // Remove secrets
safe_cfg.network.routing_table.node_id_secret = TypedSecretGroup::new(); safe_cfg.network.routing_table.node_id_secret = TypedSecretGroup::new();
safe_cfg.protected_store.device_encryption_key_password = "".to_owned(); "".clone_into(&mut safe_cfg.protected_store.device_encryption_key_password);
safe_cfg.protected_store.new_device_encryption_key_password = None; safe_cfg.protected_store.new_device_encryption_key_password = None;
VeilidConfig { VeilidConfig {

View File

@ -4,12 +4,10 @@ use std::io;
use task::{Context, Poll}; use task::{Context, Poll};
//////// ////////
///
trait SendStream: AsyncRead + AsyncWrite + Send + Unpin {} trait SendStream: AsyncRead + AsyncWrite + Send + Unpin {}
impl<S> SendStream for S where S: AsyncRead + AsyncWrite + Send + Unpin + 'static {} impl<S> SendStream for S where S: AsyncRead + AsyncWrite + Send + Unpin + 'static {}
//////// ////////
///
pub struct Peek<'a> { pub struct Peek<'a> {
aps: AsyncPeekStream, aps: AsyncPeekStream,
@ -55,7 +53,6 @@ impl Future for Peek<'_> {
} }
//////// ////////
///
pub struct PeekExact<'a> { pub struct PeekExact<'a> {
aps: AsyncPeekStream, aps: AsyncPeekStream,
@ -106,7 +103,6 @@ impl Future for PeekExact<'_> {
} }
} }
///////// /////////
///
struct AsyncPeekStreamInner { struct AsyncPeekStreamInner {
stream: Box<dyn SendStream>, stream: Box<dyn SendStream>,
peekbuf: Vec<u8>, peekbuf: Vec<u8>,