mirror of
https://github.com/safing/portmaster
synced 2025-09-01 10:09:11 +00:00
[windows_kext] Fix clippy warnings
This commit is contained in:
parent
b72cf2577a
commit
9fe140bd02
5 changed files with 8 additions and 10 deletions
|
@ -59,7 +59,7 @@ impl ConnectionCache {
|
|||
process_connection: fn(&ConnectionV4) -> Option<T>,
|
||||
) -> Option<T> {
|
||||
let _guard = self.lock_v4.read_lock();
|
||||
self.connections_v4.read(&key, process_connection)
|
||||
self.connections_v4.read(key, process_connection)
|
||||
}
|
||||
|
||||
pub fn read_connection_v6<T>(
|
||||
|
@ -68,7 +68,7 @@ impl ConnectionCache {
|
|||
process_connection: fn(&ConnectionV6) -> Option<T>,
|
||||
) -> Option<T> {
|
||||
let _guard = self.lock_v6.read_lock();
|
||||
self.connections_v6.read(&key, process_connection)
|
||||
self.connections_v6.read(key, process_connection)
|
||||
}
|
||||
|
||||
pub fn end_connection_v4(&mut self, key: Key) -> Option<ConnectionV4> {
|
||||
|
|
|
@ -111,7 +111,7 @@ impl<T: Connection + Clone> ConnectionMap<T> {
|
|||
|
||||
pub fn end(&mut self, key: Key) -> Option<T> {
|
||||
if let Some(connections) = self.0.get_mut(&key.small()) {
|
||||
for (_, conn) in connections.iter_mut().enumerate() {
|
||||
for conn in connections.iter_mut() {
|
||||
if conn.remote_equals(&key) {
|
||||
conn.end(wdk::utils::get_system_timestamp_ms());
|
||||
return Some(conn.clone());
|
||||
|
@ -124,7 +124,7 @@ impl<T: Connection + Clone> ConnectionMap<T> {
|
|||
pub fn end_all_on_port(&mut self, key: (IpProtocol, u16)) -> Option<Vec<T>> {
|
||||
if let Some(connections) = self.0.get_mut(&key) {
|
||||
let mut vec = Vec::with_capacity(connections.len());
|
||||
for (_, conn) in connections.iter_mut().enumerate() {
|
||||
for conn in connections.iter_mut() {
|
||||
if !conn.has_ended() {
|
||||
conn.end(wdk::utils::get_system_timestamp_ms());
|
||||
vec.push(conn.clone());
|
||||
|
|
|
@ -46,9 +46,7 @@ impl Device {
|
|||
Err(err) => return Err(alloc::format!("filter engine error: {}", err)),
|
||||
};
|
||||
|
||||
if let Err(err) = filter_engine.commit(callouts::get_callout_vec()) {
|
||||
return Err(err);
|
||||
}
|
||||
filter_engine.commit(callouts::get_callout_vec())?;
|
||||
|
||||
Ok(Self {
|
||||
filter_engine,
|
||||
|
|
|
@ -56,7 +56,7 @@ impl IdCache {
|
|||
}
|
||||
}
|
||||
|
||||
fn get_payload<'a>(packet: &'a Packet) -> Option<&'a [u8]> {
|
||||
fn get_payload(packet: &Packet) -> Option<&[u8]> {
|
||||
match packet {
|
||||
Packet::PacketLayer(nbl, _) => nbl.get_data(),
|
||||
Packet::AleLayer(defer) => {
|
||||
|
|
|
@ -278,7 +278,7 @@ fn get_connection_info(
|
|||
) -> Option<ConnectionInfo> {
|
||||
if ipv6 {
|
||||
let conn_info = connection_cache.read_connection_v6(
|
||||
&key,
|
||||
key,
|
||||
|conn: &ConnectionV6| -> Option<ConnectionInfo> {
|
||||
// Function is is behind spin lock. Just copy and return.
|
||||
Some(ConnectionInfo::from_connection(conn))
|
||||
|
@ -287,7 +287,7 @@ fn get_connection_info(
|
|||
return conn_info;
|
||||
} else {
|
||||
let conn_info = connection_cache.read_connection_v4(
|
||||
&key,
|
||||
key,
|
||||
|conn: &ConnectionV4| -> Option<ConnectionInfo> {
|
||||
// Function is is behind spin lock. Just copy and return.
|
||||
Some(ConnectionInfo::from_connection(conn))
|
||||
|
|
Loading…
Add table
Reference in a new issue