Add lints

This commit is contained in:
Andras Schmelczer 2024-12-20 11:08:14 +00:00
parent 70ec88b824
commit ec9845577a
No known key found for this signature in database
GPG key ID: FC8F2C3D3D1A718C
5 changed files with 38 additions and 4 deletions

View file

@ -7,6 +7,9 @@ members = [
"sync_lib"
]
[workspace.package]
rust-version = "1.83"
[workspace.dependencies]
serde = { version = "1.0.214", default-features = false, features = ["derive"] }
thiserror = { version = "1.0.66", default-features = false }
@ -19,4 +22,36 @@ codegen-units = 1
lto = true
opt-level = 3
[workspace.lints.rust]
unsafe_code = "forbid"
rust_2018_idioms = { level = "warn", priority = -1 }
missing_debug_implementations = "warn"
[workspace.lints.clippy]
await_holding_lock = "warn"
dbg_macro = "warn"
empty_enum = "warn"
enum_glob_use = "warn"
exit = "warn"
filter_map_next = "warn"
fn_params_excessive_bools = "warn"
if_let_mutex = "warn"
imprecise_flops = "warn"
inefficient_to_string = "warn"
linkedlist = "warn"
lossy_float_literal = "warn"
macro_use_imports = "warn"
match_on_vec_items = "warn"
match_wildcard_for_single_variants = "warn"
mem_forget = "warn"
needless_borrow = "warn"
needless_continue = "warn"
option_option = "warn"
rest_pat_in_fully_bound_structs = "warn"
str_to_string = "warn"
suboptimal_flops = "warn"
todo = "warn"
uninlined_format_args = "warn"
unnested_or_patterns = "warn"
unused_self = "warn"
verbose_file_reads = "warn"

View file

@ -1,7 +1,6 @@
#![no_main]
use libfuzzer_sys::fuzz_target;
extern crate reconcile;
fuzz_target!(|texts: (String, String, String)| {
let (original, left, right) = texts;

View file

@ -363,7 +363,7 @@ mod tests {
#[test]
fn test_apply_delete_with_create() {
let builder = StringBuilder::new("hello world");
let operation = Operation::<()>::create_delete_with_text(5, " world".to_string()).unwrap();
let operation = Operation::<()>::create_delete_with_text(5, " world".to_owned()).unwrap();
assert_eq!(operation.apply(builder).build(), "hello");
}

View file

@ -11,7 +11,7 @@ pub struct StringBuilder<'a> {
}
impl StringBuilder<'_> {
pub fn new(original: &str) -> StringBuilder {
pub fn new(original: &str) -> StringBuilder<'_> {
StringBuilder {
original,
last_old_char_index: 0,

View file

@ -16,7 +16,7 @@ pub async fn ping(
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(),
server_version: env!("CARGO_PKG_VERSION").to_owned(),
is_authenticated,
}))
}