Skip to content

Commit

Permalink
Add rustfmt config and apply new rules in code and CI
Browse files Browse the repository at this point in the history
  • Loading branch information
threema-donat committed May 14, 2024
1 parent e2f9864 commit f36f925
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@v1
with:
toolchain: $RUST_VERSION
toolchain: nightly
components: rustfmt
- run: cargo fmt --all --check

Expand Down
1 change: 1 addition & 0 deletions rustfmt.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
imports_granularity = "Crate"
9 changes: 5 additions & 4 deletions src/influxdb.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
use std::str::from_utf8;

use base64::{engine::general_purpose::STANDARD as BASE64, Engine};
use reqwest::header::{AUTHORIZATION, CONTENT_TYPE};
use reqwest::{Body, Client, StatusCode};
use reqwest::{
header::{AUTHORIZATION, CONTENT_TYPE},
Body, Client, StatusCode,
};

use crate::errors::InfluxdbError;
use crate::http_client::make_client;
use crate::{errors::InfluxdbError, http_client::make_client};

/// InfluxDB client.
#[derive(Debug)]
Expand Down
27 changes: 15 additions & 12 deletions src/server.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
use std::{borrow::Cow, collections::HashMap, convert::Into, net::SocketAddr, sync::Arc};

use a2::client::{Client as ApnsClient, Endpoint};
use a2::CollapseId;
use axum::body::Body;
use axum::http::{Request, StatusCode};
use axum::response::Response;
use axum::Router;
use axum::{extract::State, routing::post};
use a2::{
client::{Client as ApnsClient, Endpoint},
CollapseId,
};
use axum::{
body::Body,
extract::State,
http::{Request, StatusCode},
response::Response,
routing::post,
Router,
};
use data_encoding::HEXLOWER_PERMISSIVE;
use futures::future::{BoxFuture, FutureExt};
use reqwest::{header::CONTENT_TYPE, Client as HttpClient};
Expand All @@ -15,17 +20,15 @@ use tower::ServiceBuilder;
use tower_http::trace::{self, TraceLayer};
use tracing::Level;

use crate::errors::PushRelayError;
use crate::push::fcm::FcmStateConfig;
use crate::push::hms::HmsStateConfig;
use crate::{
config::{Config, ThreemaGatewayConfig},
errors::{InfluxdbError, SendPushError, ServiceError},
errors::{InfluxdbError, PushRelayError, SendPushError, ServiceError},
http_client,
influxdb::Influxdb,
push::{
apns, fcm,
hms::{self, HmsContext},
fcm::FcmStateConfig,
hms::{self, HmsContext, HmsStateConfig},
threema_gateway, ApnsToken, FcmToken, HmsToken, PushToken,
},
ThreemaGatewayPrivateKey,
Expand Down

0 comments on commit f36f925

Please sign in to comment.