♻️ refactor: clippy lints

Signed-off-by: Pauline <git@ethanlibs.co>
This commit is contained in:
Pauline 2024-09-27 06:59:27 +02:00
parent a5a95e6346
commit 8c99ee1b1f
No known key found for this signature in database
GPG key ID: 722BB181973296AE
14 changed files with 60 additions and 163 deletions

View file

@ -206,6 +206,41 @@ features = [
]
default-features = false
[workspace.lints.clippy]
all = { level = "warn", priority = -1 }
pedantic = { level = "warn", priority = -1 }
correctness = { level = "warn", priority = -1 }
perf = { level = "warn", priority = -1 }
style = { level = "warn", priority = -1 }
suspicious = { level = "warn", priority = -1 }
complexity = { level = "warn", priority = -1 }
nursery = { level = "warn", priority = -1 }
unnecessary_cast = "warn"
cast_lossless = "warn"
cast_possible_truncation = "warn"
cast_possible_wrap = "warn"
cast_sign_loss = "warn"
dbg_macro = "warn"
deprecated_cfg_attr = "warn"
separated_literal_suffix = "warn"
missing_errors_doc = "allow"
future_not_send = "allow"
module_name_repetitions = "allow"
struct_field_names = "allow"
cast_precision_loss = "allow"
missing_panics_doc = "allow"
[workspace.lints.rust]
unused_qualifications = "warn"
rust_2018_idioms = { level = "warn", priority = -1 }
trivial_casts = "warn"
trivial_numeric_casts = "warn"
unused_allocation = "warn"
unused_import_braces = "warn"
deprecated = "warn"
deprecated_in_future = "forbid"
unused_must_use = "deny"
[patch.crates-io]
# rspc = { git = "https://github.com/oscartbeaumont/rspc", rev = "9f26d6400affdb501837cb023678268ad72feb9b" }
# rspc-tauri2 = { git = "https://github.com/specta-rs/tauri2", rev = "6b9419566e2a826fb2a62538c7647f4524ab0fea" }

View file

@ -15,6 +15,9 @@ authors = { workspace = true }
name = "onelauncher_gui"
crate-type = [ "staticlib", "cdylib", "lib" ]
[lints]
workspace = true
[build-dependencies]
tauri-build = { workspace = true }

View file

@ -1,8 +1,8 @@
import type { Ref } from '@solid-primitives/refs';
import type { OnUpdatedEventListenerArgs, OverlayScrollbars } from 'overlayscrollbars';
import { ChevronDownDoubleIcon } from '@untitled-theme/icons-solid';
import { OverlayScrollbarsComponent, type OverlayScrollbarsComponentRef } from 'overlayscrollbars-solid';
import { createEffect, createMemo, createSignal, Index, Show, untrack } from 'solid-js';
import type { Ref } from '@solid-primitives/refs';
import type { OnUpdatedEventListenerArgs, OverlayScrollbars } from 'overlayscrollbars';
import Button from '../base/Button';
import styles from './FormattedLog.module.scss';

View file

@ -1,6 +1,6 @@
import type { ManagedPackage, Providers } from '@onelauncher/client/bindings';
import ModrinthImage from '~assets/logos/modrinth.svg?component-solid';
import { type Component, type JSX, Match, Show, splitProps, Switch } from 'solid-js';
import type { ManagedPackage, Providers } from '@onelauncher/client/bindings';
export function getProviderLogoElement(provider: ManagedPackage | Providers): string | Component {
const providerName = (typeof provider === 'string' ? provider : provider.provider)?.toLowerCase() as Lowercase<Providers>;

View file

@ -18,6 +18,9 @@ tauri = [ "dep:tauri", "dep:tauri-specta", "specta" ]
specta = [ "dep:specta" ]
cli = [ "dep:indicatif" ]
[lints]
workspace = true
[dependencies]
# features[default]
onelauncher_macros = { workspace = true }

View file

@ -119,7 +119,10 @@ impl ProxyState {
Ok(value.app.get_webview_window("main").unwrap())
}
#[allow(clippy::unused_async, reason = "clippy doesn't take into account the features")]
#[allow(
clippy::unused_async,
reason = "clippy doesn't take into account the features"
)]
#[cfg(feature = "tauri")]
pub async fn get() -> crate::Result<Arc<Self>> {
Ok(PROXY_STATE.get().ok_or(ProxyError::NotInitialized)?.clone())

View file

@ -2,43 +2,6 @@
//!
//! A library used as a core for our launcher and Rust APIs.
#![warn(
clippy::all,
clippy::pedantic,
clippy::correctness,
clippy::perf,
clippy::style,
clippy::suspicious,
clippy::complexity,
clippy::nursery,
clippy::unwrap_used,
unused_qualifications,
rust_2018_idioms,
trivial_casts,
trivial_numeric_casts,
unused_allocation,
clippy::unnecessary_cast,
clippy::cast_lossless,
clippy::cast_possible_truncation,
clippy::cast_possible_wrap,
clippy::cast_sign_loss,
clippy::dbg_macro,
unused_import_braces,
clippy::deprecated_cfg_attr,
clippy::separated_literal_suffix,
deprecated
)]
#![forbid(deprecated_in_future)]
#![deny(unused_must_use)]
#![allow(
clippy::missing_errors_doc,
clippy::future_not_send,
clippy::module_name_repetitions,
clippy::struct_field_names,
clippy::cast_precision_loss,
clippy::significant_drop_tightening //tmp
)]
#[macro_use]
pub mod utils;

View file

@ -297,13 +297,7 @@ impl Processor {
if let Some(process) = self.get(key) {
let process = process.clone();
let process = process.write().await;
if process
.current_child
.write()
.await
.try_wait()?
.is_none()
{
if process.current_child.write().await.try_wait()?.is_none() {
keys.push(key);
}
}
@ -334,13 +328,7 @@ impl Processor {
if let Some(process) = self.get(key) {
let process = process.clone();
let process = process.write().await;
if process
.current_child
.write()
.await
.try_wait()?
.is_none()
{
if process.current_child.write().await.try_wait()?.is_none() {
clusters.push(process.cluster_path.clone());
}
}
@ -355,13 +343,7 @@ impl Processor {
if let Some(process) = self.get(key) {
let process = process.clone();
let process = process.write().await;
if process
.current_child
.write()
.await
.try_wait()?
.is_none()
{
if process.current_child.write().await.try_wait()?.is_none() {
if let Some(cluster) = cluster::get(&process.cluster_path.clone()).await? {
clusters.push(cluster);
}

View file

@ -10,6 +10,9 @@ readme = { workspace = true }
homepage = { workspace = true }
authors = { workspace = true }
[lints]
workspace = true
[target.'cfg(target_os = "linux")'.dependencies]
libc = { workspace = true }

View file

@ -1,37 +1,4 @@
#![cfg(target_os = "linux")]
#![warn(
clippy::all,
clippy::pedantic,
clippy::correctness,
clippy::perf,
clippy::style,
clippy::suspicious,
clippy::complexity,
clippy::nursery,
clippy::unwrap_used,
unused_qualifications,
rust_2018_idioms,
trivial_casts,
trivial_numeric_casts,
unused_allocation,
clippy::unnecessary_cast,
clippy::cast_lossless,
clippy::cast_possible_truncation,
clippy::cast_possible_wrap,
clippy::cast_sign_loss,
clippy::dbg_macro,
unused_import_braces,
clippy::deprecated_cfg_attr,
clippy::separated_literal_suffix,
deprecated
)]
#![forbid(deprecated_in_future)]
#![deny(unused_must_use)]
#![allow(
clippy::missing_errors_doc,
clippy::future_not_send,
clippy::module_name_repetitions
)]
use libc::pid_t;
use std::ffi::c_int;

View file

@ -10,6 +10,9 @@ readme = { workspace = true }
homepage = { workspace = true }
authors = { workspace = true }
[lints]
workspace = true
[lib]
proc-macro = true

View file

@ -1,37 +1,3 @@
#![warn(
clippy::all,
clippy::pedantic,
clippy::correctness,
clippy::perf,
clippy::style,
clippy::suspicious,
clippy::complexity,
clippy::nursery,
clippy::unwrap_used,
unused_qualifications,
rust_2018_idioms,
trivial_casts,
trivial_numeric_casts,
unused_allocation,
clippy::unnecessary_cast,
clippy::cast_lossless,
clippy::cast_possible_truncation,
clippy::cast_possible_wrap,
clippy::cast_sign_loss,
clippy::dbg_macro,
unused_import_braces,
clippy::deprecated_cfg_attr,
clippy::separated_literal_suffix,
deprecated
)]
#![forbid(deprecated_in_future)]
#![deny(unused_must_use)]
#![allow(
clippy::missing_errors_doc,
clippy::future_not_send,
clippy::module_name_repetitions
)]
use proc_macro::TokenStream;
use quote::quote;
use syn::{parse_macro_input, ItemFn};

View file

@ -10,6 +10,9 @@ readme = { workspace = true }
homepage = { workspace = true }
authors = { workspace = true }
[lints]
workspace = true
[dependencies]
onelauncher_prisma = { workspace = true }
serde = { workspace = true }

View file

@ -5,40 +5,6 @@
//! - [`platform`]: Async utilities for managing OS-specific [`interpulse`] operations and rules.
//! - [`io`]: Async wrapper around [`tokio::fs`] and [`std::io::Error`] for our error system.
#![warn(
clippy::all,
clippy::pedantic,
clippy::correctness,
clippy::perf,
clippy::style,
clippy::suspicious,
clippy::complexity,
clippy::nursery,
clippy::unwrap_used,
unused_qualifications,
rust_2018_idioms,
trivial_casts,
trivial_numeric_casts,
unused_allocation,
clippy::unnecessary_cast,
clippy::cast_lossless,
clippy::cast_possible_truncation,
clippy::cast_possible_wrap,
clippy::cast_sign_loss,
clippy::dbg_macro,
unused_import_braces,
clippy::deprecated_cfg_attr,
clippy::separated_literal_suffix,
deprecated
)]
#![forbid(deprecated_in_future)]
#![deny(unused_must_use)]
#![allow(
clippy::missing_errors_doc,
clippy::future_not_send,
clippy::module_name_repetitions
)]
pub mod io;
pub mod logging;
pub mod platform;