Skip to content

Commit 42d50d0

Browse files
author
Maciej Wójcik
committed
lint fixes
1 parent 4239ccf commit 42d50d0

File tree

3 files changed

+11
-10
lines changed

3 files changed

+11
-10
lines changed

src/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ impl TryFrom<&InterfaceConfiguration> for Host {
139139
}
140140
}
141141

142+
#[cfg(not(target_os = "windows"))]
142143
/// Utility function which checks external command output status.
143144
fn check_command_output_status(output: Output) -> Result<(), WireguardInterfaceError> {
144145
if !output.status.success() {

src/utils.rs

+6-5
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,19 @@
22
use std::io::{BufRead, BufReader, Cursor, Error as IoError};
33
#[cfg(any(target_os = "freebsd", target_os = "macos", target_os = "netbsd"))]
44
use std::net::{Ipv4Addr, Ipv6Addr};
5+
use std::net::{SocketAddr, ToSocketAddrs};
56
#[cfg(target_os = "linux")]
67
use std::{collections::HashSet, fs::OpenOptions};
78
#[cfg(any(target_os = "freebsd", target_os = "linux", target_os = "netbsd"))]
89
use std::{io::Write, process::Stdio};
9-
use std::{
10-
net::{IpAddr, SocketAddr, ToSocketAddrs},
11-
process::Command,
12-
};
10+
#[cfg(not(target_os = "windows"))]
11+
use std::{net::IpAddr, process::Command};
1312

1413
#[cfg(target_os = "freebsd")]
1514
use crate::check_command_output_status;
15+
#[cfg(not(target_os = "windows"))]
16+
use crate::Peer;
17+
use crate::WireguardInterfaceError;
1618
#[cfg(any(target_os = "freebsd", target_os = "macos", target_os = "netbsd"))]
1719
use crate::{
1820
bsd::{add_gateway, add_linked_route, get_gateway},
@@ -21,7 +23,6 @@ use crate::{
2123
};
2224
#[cfg(target_os = "linux")]
2325
use crate::{check_command_output_status, netlink, IpVersion};
24-
use crate::{Peer, WireguardInterfaceError};
2526

2627
#[cfg(any(target_os = "freebsd", target_os = "linux", target_os = "netbsd"))]
2728
pub(crate) fn configure_dns(

src/wgapi_windows.rs

+4-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use std::{
22
env,
33
fs::File,
4-
io::{self, BufRead, BufReader, Cursor, Write},
4+
io::{BufRead, BufReader, Cursor, Write},
55
net::{IpAddr, SocketAddr},
66
process::Command,
77
str::FromStr,
@@ -94,9 +94,8 @@ impl WireguardInterfaceApi for WGApi<Kernel> {
9494
}
9595

9696
for peer in &config.peers {
97-
wireguard_configuration.push_str(
98-
format!("\n[Peer]\nPublicKey = {}", peer.public_key.to_string()).as_str(),
99-
);
97+
wireguard_configuration
98+
.push_str(format!("\n[Peer]\nPublicKey = {}", peer.public_key).as_str());
10099

101100
if let Some(preshared_key) = &peer.preshared_key {
102101
wireguard_configuration
@@ -175,7 +174,7 @@ impl WireguardInterfaceApi for WGApi<Kernel> {
175174
break;
176175
}
177176

178-
counter = counter + 1;
177+
counter += 1;
179178
}
180179
debug!("Finished waiting for service to be removed, the service is considered to be removed, proceeding further");
181180
}

0 commit comments

Comments
 (0)