From da2396e19a73ed6b042a78bf037ca7d2894f8946 Mon Sep 17 00:00:00 2001 From: "Osma S. Rautila" <44613540+xosxos@users.noreply.github.com> Date: Mon, 6 Jan 2025 19:24:56 +0200 Subject: [PATCH] chore(linting): add workspace lints (#228) Hey, nice work. There's a lot of potential, and the idea of custom channels with custom run commands is very appealing. I was looking at the source, but clippy pedantic lints threw a lot of warnings and I noticed the project did not have a linting profile. I threw together a profile here, but it does leave a fair amount of warnings in. Maybe some variation of this, or another linting profile could be considered to guide future contributors on style decisions. Cheers --------- Co-authored-by: Alexandre Pasmantier --- Cargo.toml | 22 ++++++++++++++++++++++ crates/television-channels/Cargo.toml | 2 ++ crates/television-derive/Cargo.toml | 2 ++ crates/television-fuzzy/Cargo.toml | 3 +++ crates/television-previewers/Cargo.toml | 2 ++ crates/television-screen/Cargo.toml | 3 +++ crates/television-utils/Cargo.toml | 3 +++ crates/television-utils/src/input.rs | 2 +- 8 files changed, 38 insertions(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 1136fcc..3918ddb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -123,3 +123,25 @@ lto = "fat" [profile.deb] inherits = "release" debug = false + +[lints] +workspace = true + +[workspace.lints.clippy] +pedantic = { level = "warn", priority = -1 } + +must_use_candidate = "allow" +too_many_lines = "allow" +missing_panics_doc = "allow" +missing_errors_doc = "allow" +module_name_repetitions = "allow" +cast_precision_loss = "allow" +map_unwrap_or = "allow" +return_self_not_must_use = "allow" +uninlined_format_args = "allow" +similar_names = "allow" +float_cmp = "allow" +implicit_hasher = "allow" +wildcard_imports = "allow" +from_iter_instead_of_collect = "allow" + diff --git a/crates/television-channels/Cargo.toml b/crates/television-channels/Cargo.toml index 0fc8624..2b940ed 100644 --- a/crates/television-channels/Cargo.toml +++ b/crates/television-channels/Cargo.toml @@ -30,3 +30,5 @@ lazy_static = "1.5.0" toml = "0.8.19" regex = "1.11.1" +[lints] +workspace = true diff --git a/crates/television-derive/Cargo.toml b/crates/television-derive/Cargo.toml index 3cac795..7bb3945 100644 --- a/crates/television-derive/Cargo.toml +++ b/crates/television-derive/Cargo.toml @@ -21,3 +21,5 @@ syn = "2.0.79" [lib] proc-macro = true +[lints] +workspace = true diff --git a/crates/television-fuzzy/Cargo.toml b/crates/television-fuzzy/Cargo.toml index ff35122..49ac832 100644 --- a/crates/television-fuzzy/Cargo.toml +++ b/crates/television-fuzzy/Cargo.toml @@ -15,3 +15,6 @@ rust-version.workspace = true [dependencies] nucleo = "0.5.0" parking_lot = "0.12.3" + +[lints] +workspace = true diff --git a/crates/television-previewers/Cargo.toml b/crates/television-previewers/Cargo.toml index 6bd4798..4658771 100644 --- a/crates/television-previewers/Cargo.toml +++ b/crates/television-previewers/Cargo.toml @@ -34,3 +34,5 @@ simd = ["dep:simdutf8"] zero-copy = [] default = ["zero-copy", "simd"] +[lints] +workspace = true diff --git a/crates/television-screen/Cargo.toml b/crates/television-screen/Cargo.toml index 54132fa..28ad99a 100644 --- a/crates/television-screen/Cargo.toml +++ b/crates/television-screen/Cargo.toml @@ -20,3 +20,6 @@ television-channels = { path = "../television-channels", version = "0.0.18" } television-previewers = { path = "../television-previewers", version = "0.0.18" } color-eyre = "0.6.3" syntect = "5.2.0" + +[lints] +workspace = true diff --git a/crates/television-utils/Cargo.toml b/crates/television-utils/Cargo.toml index 2cc51e0..2b63c21 100644 --- a/crates/television-utils/Cargo.toml +++ b/crates/television-utils/Cargo.toml @@ -27,3 +27,6 @@ unicode-width = "0.2.0" [target.'cfg(windows)'.dependencies] winapi-util = "0.1.9" + +[lints] +workspace = true diff --git a/crates/television-utils/src/input.rs b/crates/television-utils/src/input.rs index 390682d..6261ca7 100644 --- a/crates/television-utils/src/input.rs +++ b/crates/television-utils/src/input.rs @@ -218,7 +218,7 @@ impl Input { None } else { let cursor = self.cursor; - self.value = "".into(); + self.value = String::new(); self.cursor = 0; Some(StateChanged { value: true,