Skip to content

Commit

Permalink
lints: fix clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
XOR-op committed Sep 16, 2024
1 parent 1738095 commit a28b5d8
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions boltconn/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -495,13 +495,13 @@ async fn start_tun_services(
#[cfg(unix)]
let tcp_listener = tokio::net::TcpListener::bind(tun_inbound_tcp.nat_addr())
.await
.or_else(|e| {
.map_err(|e| {
tracing::error!(
"Failed to start NAT at {}: {}",
tun_inbound_tcp.nat_addr(),
e
);
Err(e)
e
})?;
#[cfg(windows)]
let tcp_listener = {
Expand Down
8 changes: 4 additions & 4 deletions boltconn/src/external/uds_controller.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,21 +43,21 @@ impl UnixListenerGuard {
.chown(&path)
.map_err(|e| SystemError::Controller(as_io_err(e)))?;
}
return Ok(Self {
Ok(Self {
path: path.to_string_lossy().to_string(),
listener: Some(listener),
});
})
}
#[cfg(windows)]
{
let listener = ServerOptions::new()
.first_pipe_instance(true)
.create(path)
.map_err(SystemError::Controller)?;
return Ok(Self {
Ok(Self {
path: path.to_string(),
listener: tokio::sync::Mutex::new(listener),
});
})
}
}

Expand Down
2 changes: 1 addition & 1 deletion boltconn/src/platform/process/windows.rs
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ impl RecordSearcher {
for i in 0..(record_cnt as usize) {
let record = data
.get((4 + i * self.item_size)..(4 + (i + 1) * self.item_size))
.ok_or_else(|| std::io::ErrorKind::NotFound)?;
.ok_or(std::io::ErrorKind::NotFound)?;
// only check established TCP record
if let Some(tcp_state_offset) = self.tcp_state {
let tcp_state = slice_to_u32(&record[tcp_state_offset..tcp_state_offset + 4]);
Expand Down
4 changes: 2 additions & 2 deletions boltconn/src/platform/sys/windows_sys.rs
Original file line number Diff line number Diff line change
Expand Up @@ -186,15 +186,15 @@ impl SystemDnsHandle {
impl Drop for SystemDnsHandle {
fn drop(&mut self) {
for record in self.old_dns.iter() {
if let Some(dns) = record.dns_server.get(0) {
if let Some(dns) = record.dns_server.first() {
let _ = run_command(Command::new("netsh").args([
"interface",
"ipv4",
"set",
"dnsservers",
&format!("name={}", record.iface_name),
"source=static",
&format!("address={}", dns.to_string()),
&format!("address={}", dns),
"register=none",
"validate=no",
]));
Expand Down

0 comments on commit a28b5d8

Please sign in to comment.