Skip to content

Commit 9d975ae

Browse files
Make LSPSDateTime Copy rather than explicitely _clone_ing
1 parent 27e5350 commit 9d975ae

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

lightning-liquidity/src/lsps0/ser.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ impl wire::Type for RawLSPSMessage {
218218
pub struct LSPSRequestId(pub String);
219219

220220
/// An object representing datetimes as described in bLIP-50 / LSPS0.
221-
#[derive(Clone, Debug, PartialEq, Eq, Hash, Deserialize, Serialize)]
221+
#[derive(Clone, Debug, Copy, PartialEq, Eq, Hash, Deserialize, Serialize)]
222222
#[serde(transparent)]
223223
pub struct LSPSDateTime(pub chrono::DateTime<chrono::Utc>);
224224

lightning-liquidity/src/lsps1/service.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ where
262262
let order_id = self.generate_order_id();
263263
let channel = OutboundCRChannel::new(
264264
params.order.clone(),
265-
created_at.clone(),
265+
created_at,
266266
order_id.clone(),
267267
payment.clone(),
268268
);

lightning-liquidity/src/lsps5/service.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ where
172172
Entry::Occupied(mut entry) => {
173173
no_change = entry.get().url == params.webhook;
174174
let (last_used, last_notification_sent) = if no_change {
175-
(entry.get().last_used.clone(), entry.get().last_notification_sent.clone())
175+
(entry.get().last_used, entry.get().last_notification_sent.clone())
176176
} else {
177177
(now, new_hash_map())
178178
};
@@ -392,11 +392,11 @@ where
392392
if webhook
393393
.last_notification_sent
394394
.get(&notification.method)
395-
.map(|last_sent| now.clone().duration_since(&last_sent))
395+
.map(|last_sent| now.duration_since(&last_sent))
396396
.map_or(true, |duration| duration >= self.config.notification_cooldown_hours)
397397
{
398-
webhook.last_notification_sent.insert(notification.method.clone(), now.clone());
399-
webhook.last_used = now.clone();
398+
webhook.last_notification_sent.insert(notification.method.clone(), now);
399+
webhook.last_used = now;
400400
self.send_notification(
401401
client_id,
402402
app_name.clone(),

0 commit comments

Comments
 (0)