Skip to content

Commit e9a0c91

Browse files
committed
f remove unnecessary clones
1 parent f44db76 commit e9a0c91

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

lightning/src/onion_message/messenger.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -386,8 +386,11 @@ where
386386
let node_announcement = network_graph
387387
.node(&NodeId::from_pubkey(&first_node))
388388
.and_then(|node_info| node_info.announcement_info.as_ref())
389-
.and_then(|announcement_info| announcement_info.announcement_message().cloned())
390-
.map(|node_announcement| node_announcement.contents);
389+
.and_then(|announcement_info| {
390+
announcement_info
391+
.announcement_message()
392+
.map(|node_announcement| &node_announcement.contents)
393+
});
391394

392395
match node_announcement {
393396
Some(node_announcement) if node_announcement.features.supports_onion_messages() => {

lightning/src/routing/gossip.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1218,13 +1218,13 @@ impl NodeAnnouncementInfo {
12181218
}
12191219

12201220
/// Internet-level addresses via which one can connect to the node
1221-
pub fn addresses(&self) -> Vec<SocketAddress> {
1221+
pub fn addresses(&self) -> &Vec<SocketAddress> {
12221222
match self {
12231223
NodeAnnouncementInfo::Relayed(relayed) => {
1224-
relayed.contents.addresses.clone()
1224+
&relayed.contents.addresses
12251225
}
12261226
NodeAnnouncementInfo::Local(local) => {
1227-
local.addresses.clone()
1227+
&local.addresses
12281228
}
12291229
}
12301230
}
@@ -1259,7 +1259,7 @@ impl Writeable for NodeAnnouncementInfo {
12591259
(4, rgb, required),
12601260
(6, alias, required),
12611261
(8, announcement_message, option),
1262-
(10, addresses, required_vec), // Versions prior to 0.0.115 require this field
1262+
(10, *addresses, required_vec), // Versions prior to 0.0.115 require this field
12631263
});
12641264
Ok(())
12651265
}

0 commit comments

Comments
 (0)