Skip to content

Commit 72074dd

Browse files
committed
clippy fixes
1 parent bbb4cf0 commit 72074dd

File tree

6 files changed

+21
-36
lines changed

6 files changed

+21
-36
lines changed

src/model.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ impl PluginState {
109109
log::warn!(
110110
"Could not open {}: {}. First time using sling? Creating new file.",
111111
excepts_file.to_str().unwrap(),
112-
e.to_string()
112+
e
113113
);
114114
File::create(excepts_file.clone()).await?;
115115
excepts_tostring = Vec::new();

src/response.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ pub async fn waitsendpay_response(
5050
"{}/{}: Rebalance SUCCESSFULL after {}s. Sent {}sats plus {}msats fee",
5151
task.chan_id,
5252
task.task_id,
53-
now.elapsed().as_secs().to_string(),
53+
now.elapsed().as_secs(),
5454
Amount::msat(&o.amount_msat.unwrap()) / 1_000,
5555
Amount::msat(&o.amount_sent_msat) - Amount::msat(&o.amount_msat.unwrap()),
5656
);
@@ -97,7 +97,7 @@ pub async fn waitsendpay_response(
9797
"{}/{}: Rebalance WAITSENDPAY_TIMEOUT failure after {}s: {}",
9898
task.chan_id,
9999
task.task_id,
100-
now.elapsed().as_secs().to_string(),
100+
now.elapsed().as_secs(),
101101
err.message,
102102
);
103103
let temp_ban_route = &route[..route.len() - 1];
@@ -155,7 +155,7 @@ pub async fn waitsendpay_response(
155155
"{}/{}: Rebalance failure after {}s: {} at node:{} chan:{}",
156156
task.chan_id,
157157
task.task_id,
158-
now.elapsed().as_secs().to_string(),
158+
now.elapsed().as_secs(),
159159
err.message,
160160
ws_error.erring_node,
161161
ws_error.erring_channel,

src/rpc_sling.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ pub async fn slinggo(
122122
match sling(&job_clone, &task, &plugin).await {
123123
Ok(()) => log::info!("{}/{}: Spawned job exited.", chan_id, i),
124124
Err(e) => {
125-
log::warn!("{}/{}: Error in job: {}", chan_id, e.to_string(), i);
125+
log::warn!("{}/{}: Error in job: {}", chan_id, e, i);
126126
match channel_jobstate_update(
127127
plugin.state().job_state.clone(),
128128
&task,

src/slings.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ pub async fn sling(job: &Job, task: &Task, plugin: &Plugin<PluginState>) -> Resu
131131
task.task_id,
132132
fee_ppm_effective,
133133
route.len() - 1,
134-
now.elapsed().as_millis().to_string()
134+
now.elapsed().as_millis()
135135
);
136136

137137
if fee_ppm_effective > job.maxppm {
@@ -210,7 +210,7 @@ pub async fn sling(job: &Job, task: &Task, plugin: &Plugin<PluginState>) -> Resu
210210
"{}/{}: Sent on route. Total: {}ms",
211211
task.chan_id,
212212
task.task_id,
213-
now.elapsed().as_millis().to_string()
213+
now.elapsed().as_millis()
214214
);
215215

216216
match waitsendpay_response(

src/tasks.rs

Lines changed: 9 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ pub async fn refresh_aliasmap(plugin: Plugin<PluginState>) -> Result<(), Error>
4141
}
4242
log::info!(
4343
"Refreshing alias map done in {}ms!",
44-
now.elapsed().as_millis().to_string()
44+
now.elapsed().as_millis()
4545
);
4646
time::sleep(Duration::from_secs(interval)).await;
4747
}
@@ -77,10 +77,7 @@ pub async fn refresh_listpeerchannels(plugin: &Plugin<PluginState>) -> Result<()
7777
.into_iter()
7878
.filter_map(|channel| channel.short_channel_id.map(|id| (id, channel)))
7979
.collect();
80-
log::debug!(
81-
"Peerchannels refreshed in {}ms",
82-
now.elapsed().as_millis().to_string()
83-
);
80+
log::debug!("Peerchannels refreshed in {}ms", now.elapsed().as_millis());
8481
Ok(())
8582
}
8683

@@ -108,7 +105,7 @@ pub async fn refresh_graph(plugin: Plugin<PluginState>) -> Result<(), Error> {
108105
read_gossip_store(plugin.clone(), &mut offset).await?;
109106
log::debug!(
110107
"Reading gossip store done after {}ms!",
111-
now.elapsed().as_millis().to_string()
108+
now.elapsed().as_millis()
112109
);
113110

114111
let mut lngraph = plugin.state().graph.lock();
@@ -120,7 +117,7 @@ pub async fn refresh_graph(plugin: Plugin<PluginState>) -> Result<(), Error> {
120117
.flatten()
121118
.filter(|(_, y)| y.scid_alias.is_none())
122119
.count(),
123-
now.elapsed().as_millis().to_string()
120+
now.elapsed().as_millis()
124121
);
125122

126123
let local_channels = plugin.state().peer_channels.lock().clone();
@@ -131,7 +128,7 @@ pub async fn refresh_graph(plugin: Plugin<PluginState>) -> Result<(), Error> {
131128
log::debug!(
132129
"Got {} local channels after {}ms!",
133130
local_channels.len(),
134-
now.elapsed().as_millis().to_string()
131+
now.elapsed().as_millis()
135132
);
136133
for chan in local_channels.values() {
137134
let private = if let Some(pri) = chan.private {
@@ -294,15 +291,12 @@ pub async fn refresh_graph(plugin: Plugin<PluginState>) -> Result<(), Error> {
294291
.flatten()
295292
.filter(|(_, y)| y.scid_alias.is_some())
296293
.count(),
297-
now.elapsed().as_millis().to_string()
294+
now.elapsed().as_millis()
298295
);
299296

300297
lngraph.graph.retain(|_, v| !v.is_empty());
301298
}
302-
log::debug!(
303-
"Refreshed graph in {}ms!",
304-
now.elapsed().as_millis().to_string()
305-
);
299+
log::debug!("Refreshed graph in {}ms!", now.elapsed().as_millis());
306300
}
307301
time::sleep(Duration::from_secs(interval)).await;
308302
}
@@ -314,10 +308,7 @@ pub async fn refresh_liquidity(plugin: Plugin<PluginState>) -> Result<(), Error>
314308
let interval = plugin.state().config.lock().reset_liquidity_interval;
315309
let now = Instant::now();
316310
plugin.state().graph.lock().refresh_liquidity(interval);
317-
log::info!(
318-
"Refreshed Liquidity in {}ms!",
319-
now.elapsed().as_millis().to_string()
320-
);
311+
log::info!("Refreshed Liquidity in {}ms!", now.elapsed().as_millis());
321312
}
322313
time::sleep(Duration::from_secs(120)).await;
323314
}
@@ -474,10 +465,7 @@ pub async fn clear_stats(plugin: Plugin<PluginState>) -> Result<(), Error> {
474465
.await?;
475466
file.write_all(&content).await?;
476467
}
477-
log::debug!(
478-
"Pruned stats successfully in {}s!",
479-
now.elapsed().as_secs().to_string()
480-
);
468+
log::debug!("Pruned stats successfully in {}s!", now.elapsed().as_secs());
481469
}
482470
time::sleep(Duration::from_secs(21_600)).await;
483471
}

src/util.rs

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ pub async fn refresh_joblists(p: Plugin<PluginState>) -> Result<(), Error> {
6767
"Read {} pull jobs and {} push jobs in {}ms",
6868
pull_jobs.len(),
6969
push_jobs.len(),
70-
now.elapsed().as_millis().to_string(),
70+
now.elapsed().as_millis(),
7171
);
7272

7373
Ok(())
@@ -88,7 +88,7 @@ pub async fn read_jobs(
8888
log::warn!(
8989
"Couldn't open {}: {}. First time using sling? Creating new file.",
9090
jobfile.to_str().unwrap(),
91-
e.to_string()
91+
e
9292
);
9393
File::create(jobfile.clone()).await?;
9494
jobs = BTreeMap::new();
@@ -212,7 +212,7 @@ pub async fn read_graph(sling_dir: &PathBuf) -> Result<LnGraph, Error> {
212212
graph = match serde_json::from_str(&file) {
213213
Ok(o) => o,
214214
Err(e) => {
215-
log::warn!("could not read graph: {}", e.to_string());
215+
log::warn!("could not read graph: {}", e);
216216
LnGraph::new()
217217
}
218218
}
@@ -221,7 +221,7 @@ pub async fn read_graph(sling_dir: &PathBuf) -> Result<LnGraph, Error> {
221221
log::warn!(
222222
"Could not open {}: {}. First time using sling? Creating new file.",
223223
graphfile.to_str().unwrap(),
224-
e.to_string()
224+
e
225225
);
226226
File::create(graphfile.clone()).await?;
227227
graph = LnGraph::new();
@@ -235,10 +235,7 @@ pub async fn write_graph(plugin: Plugin<PluginState>) -> Result<(), Error> {
235235
let sling_dir = Path::new(&plugin.configuration().lightning_dir).join(PLUGIN_NAME);
236236
let now = Instant::now();
237237
fs::write(sling_dir.join(GRAPH_FILE_NAME), graph_string).await?;
238-
log::debug!(
239-
"Wrote graph to disk in {}ms",
240-
now.elapsed().as_millis().to_string()
241-
);
238+
log::debug!("Wrote graph to disk in {}ms", now.elapsed().as_millis());
242239
Ok(())
243240
}
244241

0 commit comments

Comments
 (0)