Skip to content

Commit 37db6de

Browse files
committed
Replace to_owned with clone where that's implicitly what was going on
1 parent 4659d9a commit 37db6de

File tree

9 files changed

+12
-15
lines changed

9 files changed

+12
-15
lines changed

mullvad-cli/src/cmds/proxies.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -168,8 +168,8 @@ impl ProxyEditParams {
168168
pub fn merge_shadowsocks(self, shadowsocks: &Shadowsocks) -> Shadowsocks {
169169
let ip = self.ip.unwrap_or(shadowsocks.endpoint.ip());
170170
let port = self.port.unwrap_or(shadowsocks.endpoint.port());
171-
let password = self.password.unwrap_or(shadowsocks.password.to_owned());
172-
let cipher = self.cipher.unwrap_or(shadowsocks.cipher.to_owned());
171+
let password = self.password.unwrap_or(shadowsocks.password.clone());
172+
let cipher = self.cipher.unwrap_or(shadowsocks.cipher.clone());
173173
Shadowsocks::new((ip, port), cipher, password)
174174
}
175175
}

mullvad-daemon/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -809,7 +809,7 @@ impl Daemon {
809809
}
810810
});
811811
settings.register_change_listener(move |settings| {
812-
let _ = param_gen_tx.unbounded_send(settings.tunnel_options.to_owned());
812+
let _ = param_gen_tx.unbounded_send(settings.tunnel_options.clone());
813813
});
814814

815815
// Register a listener for generic settings changes.

mullvad-relay-selector/src/relay_selector/parsed_relays.rs

+1-4
Original file line numberDiff line numberDiff line change
@@ -150,10 +150,7 @@ impl ParsedRelays {
150150
fn parse_relay_list(relay_list: &RelayList, overrides: &[RelayOverride]) -> RelayList {
151151
let mut remaining_overrides = HashMap::new();
152152
for relay_override in overrides {
153-
remaining_overrides.insert(
154-
relay_override.hostname.to_owned(),
155-
relay_override.to_owned(),
156-
);
153+
remaining_overrides.insert(relay_override.hostname.clone(), relay_override.to_owned());
157154
}
158155

159156
let mut parsed_list = relay_list.clone();

mullvad-version/build.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ fn get_product_version(target: Target) -> String {
6262
// Compute the expected tag name for the release named `product_version`
6363
let release_tag = match target {
6464
Target::Android => format!("android/{release_version}"),
65-
Target::Desktop => release_version.to_owned(),
65+
Target::Desktop => release_version.clone(),
6666
};
6767

6868
format!("{release_version}{}", get_suffix(&release_tag))

talpid-core/src/split_tunnel/macos/default.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,9 @@ pub async fn get_default_interface(
5757
if v4_default.interface != v6_default.interface {
5858
return Err(Error::DefaultInterfaceMismatch);
5959
}
60-
v4_default.interface.to_owned()
60+
v4_default.interface.clone()
6161
}
62-
(Some(default), None) | (None, Some(default)) => default.interface.to_owned(),
62+
(Some(default), None) | (None, Some(default)) => default.interface.clone(),
6363
(None, None) => return Err(Error::NoDefaultInterface),
6464
};
6565

talpid-core/src/split_tunnel/macos/process.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ impl ProcessStates {
332332

333333
// Check if own path is excluded
334334
if paths.contains(&info.exec_path) && !new_exclude_paths.contains(&info.exec_path) {
335-
new_exclude_paths.insert(info.exec_path.to_owned());
335+
new_exclude_paths.insert(info.exec_path.clone());
336336
}
337337

338338
info.excluded_by_paths = new_exclude_paths;
@@ -413,7 +413,7 @@ impl InnerProcessStates {
413413

414414
// Exclude if path is excluded
415415
if self.exclude_paths.contains(&info.exec_path) {
416-
info.excluded_by_paths.insert(info.exec_path.to_owned());
416+
info.excluded_by_paths.insert(info.exec_path.clone());
417417
log::trace!("Excluding {pid} by path: {}", info.exec_path.display());
418418
}
419419
}

talpid-openvpn/src/wintun.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ impl WintunAdapter {
108108
}
109109

110110
pub fn name(&self) -> U16CString {
111-
self.name.to_owned()
111+
self.name.clone()
112112
}
113113

114114
pub fn luid(&self) -> NET_LUID_LH {

test/test-manager/src/tests/helpers.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -568,7 +568,7 @@ pub async fn geoip_lookup_with_retries(rpc: &ServiceClient) -> Result<AmIMullvad
568568

569569
loop {
570570
let result = rpc
571-
.geoip_lookup(TEST_CONFIG.mullvad_host.to_owned())
571+
.geoip_lookup(TEST_CONFIG.mullvad_host.clone())
572572
.await
573573
.map_err(Error::GeoipLookup);
574574

test/test-manager/src/vm/network/macos.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ pub(crate) fn find_vm_bridge(guest_ip: &Ipv4Addr) -> Result<(String, Ipv4Addr)>
6767
ipnetwork::Ipv4Network::with_netmask(address, netmask)
6868
.ok()
6969
.filter(|ip_v4_network| ip_v4_network.contains(*guest_ip))
70-
.map(|_| (interface_name.to_owned(), address))
70+
.map(|_| (interface_name.clone(), address))
7171
})
7272
.ok_or_else(|| anyhow!("Failed to identify bridge used by tart -- not running?"))
7373
}

0 commit comments

Comments
 (0)