Enable more lints
This commit is contained in:
parent
3f73578fc9
commit
da0e5f7373
12 changed files with 17 additions and 12 deletions
|
|
@ -1,3 +1,5 @@
|
|||
#![warn(clippy::all, clippy::restriction, clippy::pedantic, clippy::cargo)]
|
||||
|
||||
mod diffs;
|
||||
mod operation_transformation;
|
||||
mod tokenizer;
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
#![warn(clippy::all, clippy::restriction, clippy::pedantic, clippy::cargo)]
|
||||
|
||||
use core::str;
|
||||
|
||||
use base64::{engine::general_purpose::STANDARD_NO_PAD, Engine as _};
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ impl Config {
|
|||
);
|
||||
Self::load_from_file(path).await
|
||||
} else {
|
||||
let config = Config::default();
|
||||
let config = Self::default();
|
||||
config.write(path).await?;
|
||||
warn!(
|
||||
"Configuration file not found, wrote default configuration to {:?}",
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ pub struct DatabaseConfig {
|
|||
|
||||
fn default_sqlite_url() -> String {
|
||||
debug!("Using default sqlite url: {}", DEFAULT_SQLITE_URL);
|
||||
DEFAULT_SQLITE_URL.to_string()
|
||||
DEFAULT_SQLITE_URL.to_owned()
|
||||
}
|
||||
|
||||
fn default_max_connections() -> u32 {
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ pub struct ServerConfig {
|
|||
|
||||
fn default_host() -> String {
|
||||
debug!("Using default server host: {}", DEFAULT_HOST);
|
||||
DEFAULT_HOST.to_string()
|
||||
DEFAULT_HOST.to_owned()
|
||||
}
|
||||
|
||||
fn default_port() -> u16 {
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ pub struct User {
|
|||
|
||||
impl Default for UserConfig {
|
||||
fn default() -> Self {
|
||||
UserConfig {
|
||||
Self {
|
||||
user_tokens: default_users(),
|
||||
}
|
||||
}
|
||||
|
|
@ -29,7 +29,7 @@ impl Default for UserConfig {
|
|||
|
||||
fn default_users() -> Vec<User> {
|
||||
vec![User {
|
||||
name: "admin".to_string(),
|
||||
name: "admin".to_owned(),
|
||||
token: get_random_token(),
|
||||
}]
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
use std::{str::FromStr, time::Duration};
|
||||
use core::{str::FromStr, time::Duration};
|
||||
|
||||
use anyhow::{Context, Result};
|
||||
use models::{
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ pub struct StoredDocumentVersion {
|
|||
pub is_deleted: bool,
|
||||
}
|
||||
|
||||
impl PartialEq<StoredDocumentVersion> for StoredDocumentVersion {
|
||||
impl PartialEq<Self> for StoredDocumentVersion {
|
||||
fn eq(&self, other: &Self) -> bool {
|
||||
self.vault_id == other.vault_id && self.vault_update_id == other.vault_update_id
|
||||
}
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@ impl OperationOutput for SyncServerError {
|
|||
type Inner = Self;
|
||||
}
|
||||
|
||||
pub 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,3 +1,5 @@
|
|||
#![warn(clippy::all, clippy::restriction, clippy::pedantic, clippy::cargo)]
|
||||
|
||||
mod app_state;
|
||||
mod config;
|
||||
mod consts;
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ pub async fn create_server(app_state: AppState) -> Result<()> {
|
|||
|
||||
let mut api = OpenApi {
|
||||
info: Info {
|
||||
description: Some("an example API".to_string()),
|
||||
description: Some("an example API".to_owned()),
|
||||
..Info::default()
|
||||
},
|
||||
..OpenApi::default()
|
||||
|
|
@ -82,7 +82,7 @@ pub async fn create_server(app_state: AppState) -> Result<()> {
|
|||
|
||||
let listener = tokio::net::TcpListener::bind(address.clone())
|
||||
.await
|
||||
.with_context(|| format!("Failed to bind to address: {}", address))?;
|
||||
.with_context(|| format!("Failed to bind to address: {address}"))?;
|
||||
|
||||
info!(
|
||||
"Listening on http://{}",
|
||||
|
|
|
|||
|
|
@ -13,8 +13,7 @@ pub async fn ping(
|
|||
State(state): State<AppState>,
|
||||
) -> Result<Json<PingResponse>, SyncServerError> {
|
||||
let is_authenticated = maybe_auth_header
|
||||
.map(|auth_header| auth(&state, auth_header.token()).is_ok())
|
||||
.unwrap_or(false);
|
||||
.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