Make lints pass
This commit is contained in:
parent
da0e5f7373
commit
0c92bf959b
10 changed files with 30 additions and 20 deletions
|
|
@ -7,9 +7,21 @@ members = [
|
|||
"sync_lib"
|
||||
]
|
||||
|
||||
[workspace.lints.clippy]
|
||||
single_call_fn = "allow"
|
||||
missing_docs_in_private_items = "allow"
|
||||
question_mark_used = "allow"
|
||||
implicit_return = "allow"
|
||||
|
||||
|
||||
[workspace.dependencies]
|
||||
serde = { version = "1.0.214", default-features = false, features = ["derive"] }
|
||||
thiserror = { version = "1.0.66", default-features = false }
|
||||
uuid = { version = "1.11.0", default-features = false, features = ["v4", "serde"] }
|
||||
log = { version = "0.4.22", default-features = false }
|
||||
anyhow = { version = "1.0.94", features = ["backtrace"] }
|
||||
|
||||
[profile.release]
|
||||
codegen-units = 1
|
||||
lto = true
|
||||
opt-level = 3
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ version = "0.1.0"
|
|||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
|
||||
# optional dependencies
|
||||
serde = { version = "1.0.215", optional = true }
|
||||
|
||||
|
|
@ -15,3 +14,6 @@ serde = [ "dep:serde" ]
|
|||
insta = "1.41.1"
|
||||
pretty_assertions = "1.4.1"
|
||||
test-case = "3.3.1"
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
#![warn(clippy::all, clippy::restriction, clippy::pedantic, clippy::cargo)]
|
||||
|
||||
mod diffs;
|
||||
mod operation_transformation;
|
||||
mod tokenizer;
|
||||
|
|
|
|||
|
|
@ -25,3 +25,7 @@ wasm-bindgen-test = "0.3.34"
|
|||
|
||||
[features]
|
||||
default = ["console_error_panic_hook"]
|
||||
wee_alloc = []
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
|
@ -1,5 +1,3 @@
|
|||
#![warn(clippy::all, clippy::restriction, clippy::pedantic, clippy::cargo)]
|
||||
|
||||
use core::str;
|
||||
|
||||
use base64::{engine::general_purpose::STANDARD_NO_PAD, Engine as _};
|
||||
|
|
|
|||
|
|
@ -24,3 +24,6 @@ schemars = { version = "0.8.21", features = ["chrono", "uuid1"] }
|
|||
rand = "0.8.5"
|
||||
axum-extra = { version = "0.9.6", features = ["typed-header"] }
|
||||
tower-http = { version = "0.6.1", features = ["cors"] }
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ pub enum SyncServerError {
|
|||
#[error("Unauthorized: {0}")]
|
||||
Unauthorized(#[source] anyhow::Error),
|
||||
|
||||
#[allow(dead_code)]
|
||||
#[error("Permission denied error: {0}")]
|
||||
PermissionDeniedError(#[source] anyhow::Error),
|
||||
}
|
||||
|
|
@ -82,7 +83,9 @@ impl OperationOutput for SyncServerError {
|
|||
type Inner = Self;
|
||||
}
|
||||
|
||||
pub const fn init_error(error: anyhow::Error) -> SyncServerError { SyncServerError::InitError(error) }
|
||||
pub const fn init_error(error: anyhow::Error) -> SyncServerError {
|
||||
SyncServerError::InitError(error)
|
||||
}
|
||||
|
||||
pub fn server_error(error: anyhow::Error) -> SyncServerError {
|
||||
warn!("Server error: {:?}", error);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
#![warn(clippy::all, clippy::restriction, clippy::pedantic, clippy::cargo)]
|
||||
|
||||
mod app_state;
|
||||
mod config;
|
||||
mod consts;
|
||||
|
|
|
|||
|
|
@ -8,9 +8,9 @@ use aide::{
|
|||
};
|
||||
use anyhow::{Context, Result};
|
||||
use axum::{
|
||||
extract::{DefaultBodyLimit, WebSocketUpgrade},
|
||||
extract::DefaultBodyLimit,
|
||||
http::{self, HeaderValue, Method},
|
||||
response::{IntoResponse, Response},
|
||||
response::IntoResponse,
|
||||
Extension, Json,
|
||||
};
|
||||
use log::info;
|
||||
|
|
@ -63,7 +63,6 @@ pub async fn create_server(app_state: AppState) -> Result<()> {
|
|||
"/vaults/:vault_id/documents/:document_id",
|
||||
delete(delete_document::delete_document),
|
||||
)
|
||||
.api_route("/ws", get(handler))
|
||||
.route("/", Scalar::new("/api.json").axum_route())
|
||||
.route("/api.json", axum::routing::get(serve_api))
|
||||
.layer(DefaultBodyLimit::max(
|
||||
|
|
@ -96,11 +95,4 @@ pub async fn create_server(app_state: AppState) -> Result<()> {
|
|||
.context("Failed to start server")
|
||||
}
|
||||
|
||||
async fn handler(ws: WebSocketUpgrade) -> Response {
|
||||
ws.protocols(["graphql-ws", "graphql-transport-ws"])
|
||||
.on_upgrade(|socket| async {
|
||||
// ...
|
||||
})
|
||||
}
|
||||
|
||||
async fn serve_api(Extension(api): Extension<OpenApi>) -> impl IntoResponse { Json(api) }
|
||||
|
|
|
|||
|
|
@ -12,8 +12,8 @@ pub async fn ping(
|
|||
maybe_auth_header: Option<TypedHeader<Authorization<Bearer>>>,
|
||||
State(state): State<AppState>,
|
||||
) -> Result<Json<PingResponse>, SyncServerError> {
|
||||
let is_authenticated = maybe_auth_header
|
||||
.is_some_and(|auth_header| auth(&state, auth_header.token()).is_ok());
|
||||
let is_authenticated =
|
||||
maybe_auth_header.is_some_and(|auth_header| auth(&state, auth_header.token()).is_ok());
|
||||
|
||||
Ok(Json(PingResponse {
|
||||
server_version: env!("CARGO_PKG_VERSION").to_string(),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue