Skip to content

Commit 1fa1a2c

Browse files
authored
Merge pull request #97 from tnull/2026-01-add-weekly-nightly-rustfmt-job
2 parents ebef52e + 32d49e9 commit 1fa1a2c

30 files changed

Lines changed: 198 additions & 120 deletions
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Nightly rustfmt
2+
3+
permissions:
4+
contents: write
5+
pull-requests: write
6+
7+
on:
8+
schedule:
9+
- cron: "0 0 * * 0" # runs weekly on Sunday at 00:00
10+
workflow_dispatch: # allows manual triggering
11+
jobs:
12+
format:
13+
name: Nightly rustfmt
14+
runs-on: ubuntu-24.04
15+
steps:
16+
- uses: actions/checkout@v5
17+
- uses: dtolnay/rust-toolchain@nightly
18+
with:
19+
components: rustfmt
20+
- name: Run Nightly rustfmt
21+
# Run the formatter and manually remove trailing whitespace.
22+
run: cargo +nightly fmt && git ls-files -- '*.rs' -z | xargs sed -E -i'' -e 's/[[:space:]]+$//'
23+
- name: Get the current date
24+
run: echo "date=$(date +'%Y-%m-%d')" >> $GITHUB_ENV
25+
- name: Create Pull Request
26+
uses: peter-evans/create-pull-request@v7
27+
with:
28+
author: Fmt Bot <bot@example.com>
29+
title: Automated nightly rustfmt (${{ env.date }})
30+
body: |
31+
Automated nightly `rustfmt` changes by [create-pull-request](https://github.com/peter-evans/create-pull-request) GitHub action
32+
commit-message: ${{ env.date }} automated rustfmt nightly
33+
labels: rustfmt

ldk-server-client/src/client.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,8 @@
77
// You may not use this file except in accordance with one or both of these
88
// licenses.
99

10-
use prost::Message;
10+
use std::time::{SystemTime, UNIX_EPOCH};
1111

12-
use crate::error::LdkServerError;
13-
use crate::error::LdkServerErrorCode::{
14-
AuthError, InternalError, InternalServerError, InvalidRequestError, LightningError,
15-
};
1612
use bitcoin_hashes::hmac::{Hmac, HmacEngine};
1713
use bitcoin_hashes::{sha256, Hash, HashEngine};
1814
use ldk_server_protos::api::{
@@ -32,9 +28,14 @@ use ldk_server_protos::endpoints::{
3228
OPEN_CHANNEL_PATH, SPLICE_IN_PATH, SPLICE_OUT_PATH, UPDATE_CHANNEL_CONFIG_PATH,
3329
};
3430
use ldk_server_protos::error::{ErrorCode, ErrorResponse};
31+
use prost::Message;
3532
use reqwest::header::CONTENT_TYPE;
3633
use reqwest::{Certificate, Client};
37-
use std::time::{SystemTime, UNIX_EPOCH};
34+
35+
use crate::error::LdkServerError;
36+
use crate::error::LdkServerErrorCode::{
37+
AuthError, InternalError, InternalServerError, InvalidRequestError, LightningError,
38+
};
3839

3940
const APPLICATION_OCTET_STREAM: &str = "application/octet-stream";
4041

ldk-server/src/api/bolt11_receive.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,11 @@
77
// You may not use this file except in accordance with one or both of these
88
// licenses.
99

10+
use ldk_server_protos::api::{Bolt11ReceiveRequest, Bolt11ReceiveResponse};
11+
1012
use crate::api::error::LdkServerError;
1113
use crate::service::Context;
1214
use crate::util::proto_adapter::proto_to_bolt11_description;
13-
use ldk_server_protos::api::{Bolt11ReceiveRequest, Bolt11ReceiveResponse};
1415

1516
pub(crate) fn handle_bolt11_receive_request(
1617
context: Context, request: Bolt11ReceiveRequest,

ldk-server/src/api/bolt11_send.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,15 @@
77
// You may not use this file except in accordance with one or both of these
88
// licenses.
99

10-
use crate::api::error::LdkServerError;
11-
use crate::api::error::LdkServerErrorCode::InvalidRequestError;
12-
use crate::service::Context;
10+
use std::str::FromStr;
11+
1312
use ldk_node::lightning::routing::router::RouteParametersConfig;
1413
use ldk_node::lightning_invoice::Bolt11Invoice;
1514
use ldk_server_protos::api::{Bolt11SendRequest, Bolt11SendResponse};
16-
use std::str::FromStr;
15+
16+
use crate::api::error::LdkServerError;
17+
use crate::api::error::LdkServerErrorCode::InvalidRequestError;
18+
use crate::service::Context;
1719

1820
pub(crate) fn handle_bolt11_send_request(
1921
context: Context, request: Bolt11SendRequest,

ldk-server/src/api/bolt12_receive.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,10 @@
77
// You may not use this file except in accordance with one or both of these
88
// licenses.
99

10+
use ldk_server_protos::api::{Bolt12ReceiveRequest, Bolt12ReceiveResponse};
11+
1012
use crate::api::error::LdkServerError;
1113
use crate::service::Context;
12-
use ldk_server_protos::api::{Bolt12ReceiveRequest, Bolt12ReceiveResponse};
1314

1415
pub(crate) fn handle_bolt12_receive_request(
1516
context: Context, request: Bolt12ReceiveRequest,

ldk-server/src/api/bolt12_send.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,15 @@
77
// You may not use this file except in accordance with one or both of these
88
// licenses.
99

10-
use crate::api::error::LdkServerError;
11-
use crate::api::error::LdkServerErrorCode::InvalidRequestError;
12-
use crate::service::Context;
10+
use std::str::FromStr;
11+
1312
use ldk_node::lightning::offers::offer::Offer;
1413
use ldk_node::lightning::routing::router::RouteParametersConfig;
1514
use ldk_server_protos::api::{Bolt12SendRequest, Bolt12SendResponse};
16-
use std::str::FromStr;
15+
16+
use crate::api::error::LdkServerError;
17+
use crate::api::error::LdkServerErrorCode::InvalidRequestError;
18+
use crate::service::Context;
1719

1820
pub(crate) fn handle_bolt12_send_request(
1921
context: Context, request: Bolt12SendRequest,

ldk-server/src/api/close_channel.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,17 @@
77
// You may not use this file except in accordance with one or both of these
88
// licenses.
99

10-
use crate::api::error::LdkServerError;
11-
use crate::api::error::LdkServerErrorCode::InvalidRequestError;
12-
use crate::service::Context;
10+
use std::str::FromStr;
11+
1312
use ldk_node::bitcoin::secp256k1::PublicKey;
1413
use ldk_node::UserChannelId;
1514
use ldk_server_protos::api::{
1615
CloseChannelRequest, CloseChannelResponse, ForceCloseChannelRequest, ForceCloseChannelResponse,
1716
};
18-
use std::str::FromStr;
17+
18+
use crate::api::error::LdkServerError;
19+
use crate::api::error::LdkServerErrorCode::InvalidRequestError;
20+
use crate::service::Context;
1921

2022
pub(crate) fn handle_close_channel_request(
2123
context: Context, request: CloseChannelRequest,

ldk-server/src/api/error.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,10 @@
77
// You may not use this file except in accordance with one or both of these
88
// licenses.
99

10-
use ldk_node::NodeError;
1110
use std::fmt;
1211

12+
use ldk_node::NodeError;
13+
1314
#[derive(Clone, Debug, PartialEq, Eq)]
1415
pub(crate) struct LdkServerError {
1516
// The error message containing a generic description of the error condition in English.

ldk-server/src/api/get_balances.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,11 @@
77
// You may not use this file except in accordance with one or both of these
88
// licenses.
99

10+
use ldk_server_protos::api::{GetBalancesRequest, GetBalancesResponse};
11+
1012
use crate::api::error::LdkServerError;
1113
use crate::service::Context;
1214
use crate::util::proto_adapter::{lightning_balance_to_proto, pending_sweep_balance_to_proto};
13-
use ldk_server_protos::api::{GetBalancesRequest, GetBalancesResponse};
1415

1516
pub(crate) fn handle_get_balances_request(
1617
context: Context, _request: GetBalancesRequest,

ldk-server/src/api/get_node_info.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,12 @@
77
// You may not use this file except in accordance with one or both of these
88
// licenses.
99

10-
use crate::api::error::LdkServerError;
11-
use crate::service::Context;
1210
use ldk_server_protos::api::{GetNodeInfoRequest, GetNodeInfoResponse};
1311
use ldk_server_protos::types::BestBlock;
1412

13+
use crate::api::error::LdkServerError;
14+
use crate::service::Context;
15+
1516
pub(crate) fn handle_get_node_info_request(
1617
context: Context, _request: GetNodeInfoRequest,
1718
) -> Result<GetNodeInfoResponse, LdkServerError> {

0 commit comments

Comments
 (0)