diff --git a/.github/workflows/bencher.yml b/.github/workflows/bencher.yml index ae16bf387..1df951832 100644 --- a/.github/workflows/bencher.yml +++ b/.github/workflows/bencher.yml @@ -787,7 +787,7 @@ jobs: # this step can take a long time to fail. timeout-minutes: 3 continue-on-error: true - uses: lycheeverse/lychee-action@v2.3.0 + uses: lycheeverse/lychee-action@v2.4.1 with: args: --config ./services/console/lychee.toml ./services/console/dist diff --git a/Cargo.toml b/Cargo.toml index 4b2e83db6..4d83dee10 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,13 +8,13 @@ members = [ "xtask", ] exclude = ["services/benchers", "services/cargo-bencher"] -resolver = "2" +resolver = "3" [workspace.package] homepage = "https://bencher.dev" version = "0.5.1" authors = ["Everett Pompeii "] -edition = "2021" +edition = "2024" license-file = "LICENSE.md" [workspace.dependencies] @@ -111,7 +111,6 @@ single_use_lifetimes = "warn" trivial_casts = "warn" trivial_numeric_casts = "warn" unsafe_code = "warn" -unsafe_op_in_unsafe_fn = "warn" unused_crate_dependencies = "warn" unused_import_braces = "warn" unused_lifetimes = "warn" @@ -130,15 +129,17 @@ multiple_crate_versions = "allow" # Checks to see if multiple versions o pedantic = { level = "warn", priority = -1 } missing_errors_doc = "allow" # Checks the doc comments of publicly visible functions that return a Result type and warns if there is no # Errors section. missing_panics_doc = "allow" # Checks the doc comments of publicly visible functions that may panic and warns if there is no # Panics section. -module_name_repetitions = "allow" # Detects type names that are prefixed or suffixed by the containing module’s name. must_use_candidate = "allow" # Checks for public functions that have no #[must_use] attribute, but return something not already marked must-use, have no mutable arg and mutate no statics. # restriction absolute_paths = "warn" # Checks for usage of items through absolute paths, like std::env::current_dir. +allow_attributes = "warn" # Checks for usage of the #[allow] attribute and suggests replacing it with the #[expect] +as_pointer_underscore = "warn" # Checks for the usage of as *const _ or as *mut _ conversion using inferred type. as_underscore = "warn" # Checks for the usage of as _ conversion using inferred type. big_endian_bytes = "warn" # Checks for the usage of the to_be_bytes method and/or the function from_be_bytes. cfg_not_test = "warn" # Checks for usage of cfg that excludes code from test builds. (i.e., #[cfg(not(test))]) dbg_macro = "warn" # Checks for usage of the dbg! macro. decimal_literal_representation = "warn" # Warns if there is a better representation for a numeric literal. +doc_include_without_cfg = "warn" # Checks if included files in doc comments are included only for cfg(doc). error_impl_error = "warn" # Checks for types named Error that implement Error. empty_enum_variants_with_brackets = "warn" # Finds enum variants without fields that are declared with empty brackets. exit = "warn" # Detects calls to the exit() function which terminates the program. @@ -162,6 +163,7 @@ large_include_file = "warn" # Checks for the inclusion of large f little_endian_bytes = "warn" # Checks for the usage of the to_le_bytes method and/or the function from_le_bytes. lossy_float_literal = "warn" # Checks for whole number float literals that cannot be represented as the underlying type without loss. map_err_ignore = "warn" # Checks for instances of map_err(|_| Some::Enum) +map_with_unused_argument_over_ranges = "warn" # Checks for Iterator::map over ranges without using the parameter which could be more clearly expressed using std::iter::repeat(...).take(...) or std::iter::repeat_n. mem_forget = "warn" # Checks for usage of std::mem::forget(t) where t is Drop or has a field that implements Drop. missing_assert_message = "warn" # Checks assertions without a custom panic message. missing_asserts_for_indexing = "warn" # Checks for repeated slice indexing without asserting beforehand that the length is greater than the largest index used to index into the slice. @@ -169,10 +171,13 @@ mixed_read_write_in_expression = "warn" # Checks for a read and a write to th modulo_arithmetic = "warn" # Checks for modulo arithmetic. multiple_inherent_impl = "warn" # Checks for multiple inherent implementations of a struct mutex_atomic = "warn" # Checks for usage of Mutex where an atomic will do. +mutex_integer = "warn" # Checks for usage of Mutex where X is an integral type. needless_raw_strings = "warn" # Checks for raw string literals where a string literal can be used instead. +non_zero_suggestions = "warn" # Checks for conversions from NonZero types to regular integer types, and suggests using NonZero types for the target as well. panic = "warn" # Checks for usage of panic!. partial_pub_fields = "warn" # Checks whether partial fields of a struct are public. pathbuf_init_then_push = "warn" # Checks for calls to push immediately after creating a new PathBuf. +precedence_bits = "warn" # Checks for bit shifting operations combined with bit masking/combining operators and suggest using parentheses. print_stdout = "warn" # Checks for printing on stdout. The purpose of this lint is to catch debugging remnants. print_stderr = "warn" # Checks for printing on stderr. The purpose of this lint is to catch debugging remnants. rc_buffer = "warn" # Checks for Rc and Arc when T is a mutable buffer type such as String or Vec. @@ -201,6 +206,7 @@ unnecessary_safety_doc = "warn" # Checks for the doc comments of publ unnecessary_self_imports = "warn" # Checks for imports ending in ::{self}. unreachable = "warn" # Checks for usage of unreachable!. unused_result_ok = "warn" # Checks for calls to Result::ok() without using the returned Option. +unused_trait_names = "warn" # Checks for `use Trait` where the Trait is only used for its methods and not referenced by a path directly. unwrap_used = "warn" # Checks for .unwrap() or .unwrap_err() calls on Results and .unwrap() call on Options. use_debug = "warn" # Checks for usage of Debug formatting. The purpose of this lint is to catch debugging remnants. verbose_file_reads = "warn" # Checks for usage of File::read_to_end and File::read_to_string. diff --git a/clippy.toml b/clippy.toml index c7d55cfe0..4ebcb7af5 100644 --- a/clippy.toml +++ b/clippy.toml @@ -3,5 +3,8 @@ absolute-paths-allowed-crates = ["diesel"] absolute-paths-max-segments = 3 -allow-unwrap-in-tests = true +allow-dbg-in-tests = true allow-expect-in-tests = true +allow-indexing-slicing-in-tests = true +allow-print-in-tests = true +allow-unwrap-in-tests = true diff --git a/examples/rust/custom/benches/play_game.rs b/examples/rust/custom/benches/play_game.rs index 7f9af48db..8e6194a8c 100644 --- a/examples/rust/custom/benches/play_game.rs +++ b/examples/rust/custom/benches/play_game.rs @@ -1,4 +1,4 @@ -#![allow(clippy::unit_arg)] +#![expect(clippy::unit_arg)] #[global_allocator] static ALLOC: dhat::Alloc = dhat::Alloc; diff --git a/lib/api_auth/src/accept.rs b/lib/api_auth/src/accept.rs index 3cbeeeeea..744254194 100644 --- a/lib/api_auth/src/accept.rs +++ b/lib/api_auth/src/accept.rs @@ -7,7 +7,7 @@ use bencher_schema::{ }; use dropshot::{endpoint, HttpError, RequestContext, TypedBody}; -#[allow(clippy::no_effect_underscore_binding, clippy::unused_async)] +#[expect(clippy::no_effect_underscore_binding, clippy::unused_async)] #[endpoint { method = OPTIONS, path = "/v0/auth/accept", diff --git a/lib/api_auth/src/confirm.rs b/lib/api_auth/src/confirm.rs index 44ac01f70..70acf049d 100644 --- a/lib/api_auth/src/confirm.rs +++ b/lib/api_auth/src/confirm.rs @@ -10,7 +10,7 @@ use dropshot::{endpoint, HttpError, RequestContext, TypedBody}; use super::CLIENT_TOKEN_TTL; -#[allow(clippy::no_effect_underscore_binding, clippy::unused_async)] +#[expect(clippy::no_effect_underscore_binding, clippy::unused_async)] #[endpoint { method = OPTIONS, path = "/v0/auth/confirm", diff --git a/lib/api_auth/src/github.rs b/lib/api_auth/src/github.rs index d3df3aaa2..e58dbc325 100644 --- a/lib/api_auth/src/github.rs +++ b/lib/api_auth/src/github.rs @@ -18,7 +18,7 @@ use super::CLIENT_TOKEN_TTL; pub const GITHUB_OAUTH2: &str = "GitHub OAuth2"; -#[allow(clippy::no_effect_underscore_binding, clippy::unused_async)] +#[expect(clippy::no_effect_underscore_binding, clippy::unused_async)] #[endpoint { method = OPTIONS, path = "/v0/auth/github", diff --git a/lib/api_auth/src/login.rs b/lib/api_auth/src/login.rs index 4eadec759..66d8289fd 100644 --- a/lib/api_auth/src/login.rs +++ b/lib/api_auth/src/login.rs @@ -12,7 +12,7 @@ use slog::Logger; use super::AUTH_TOKEN_TTL; use super::TOKEN_ARG; -#[allow(clippy::no_effect_underscore_binding, clippy::unused_async)] +#[expect(clippy::no_effect_underscore_binding, clippy::unused_async)] #[endpoint { method = OPTIONS, path = "/v0/auth/login", diff --git a/lib/api_auth/src/signup.rs b/lib/api_auth/src/signup.rs index a057cf4c2..9a244bf23 100644 --- a/lib/api_auth/src/signup.rs +++ b/lib/api_auth/src/signup.rs @@ -12,7 +12,7 @@ use slog::Logger; use super::AUTH_TOKEN_TTL; use super::TOKEN_ARG; -#[allow(clippy::no_effect_underscore_binding, clippy::unused_async)] +#[expect(clippy::no_effect_underscore_binding, clippy::unused_async)] #[endpoint { method = OPTIONS, path = "/v0/auth/signup", diff --git a/lib/api_checkout/src/checkout.rs b/lib/api_checkout/src/checkout.rs index 8e4c573e4..f655779fa 100644 --- a/lib/api_checkout/src/checkout.rs +++ b/lib/api_checkout/src/checkout.rs @@ -17,7 +17,7 @@ use bencher_schema::{ }; use dropshot::{endpoint, HttpError, RequestContext, TypedBody}; -#[allow(clippy::no_effect_underscore_binding, clippy::unused_async)] +#[expect(clippy::no_effect_underscore_binding, clippy::unused_async)] #[endpoint { method = OPTIONS, path = "/v0/checkout", diff --git a/lib/api_organizations/src/allowed.rs b/lib/api_organizations/src/allowed.rs index 055b57ef7..f170f7234 100644 --- a/lib/api_organizations/src/allowed.rs +++ b/lib/api_organizations/src/allowed.rs @@ -20,7 +20,7 @@ pub struct OrgAllowedParams { pub permission: OrganizationPermission, } -#[allow(clippy::no_effect_underscore_binding, clippy::unused_async)] +#[expect(clippy::no_effect_underscore_binding, clippy::unused_async)] #[endpoint { method = OPTIONS, path = "/v0/organizations/{organization}/allowed/{permission}", diff --git a/lib/api_organizations/src/claim.rs b/lib/api_organizations/src/claim.rs index 410a57348..576d64cde 100644 --- a/lib/api_organizations/src/claim.rs +++ b/lib/api_organizations/src/claim.rs @@ -18,7 +18,7 @@ pub struct OrgClaimParams { pub organization: ResourceId, } -#[allow(clippy::no_effect_underscore_binding, clippy::unused_async)] +#[expect(clippy::no_effect_underscore_binding, clippy::unused_async)] #[endpoint { method = OPTIONS, path = "/v0/organizations/{organization}/claim", diff --git a/lib/api_organizations/src/members.rs b/lib/api_organizations/src/members.rs index 57ee3c8fc..4b013ffc2 100644 --- a/lib/api_organizations/src/members.rs +++ b/lib/api_organizations/src/members.rs @@ -22,7 +22,7 @@ use bencher_schema::{ schema, INVITE_TOKEN_TTL, }; use diesel::{ - BoolExpressionMethods, ExpressionMethods, QueryDsl, RunQueryDsl, TextExpressionMethods, + BoolExpressionMethods as _, ExpressionMethods as _, QueryDsl as _, RunQueryDsl as _, TextExpressionMethods as _, }; use dropshot::{endpoint, HttpError, Path, Query, RequestContext, TypedBody}; use schemars::JsonSchema; @@ -53,7 +53,7 @@ pub struct OrgMembersQuery { pub search: Option, } -#[allow(clippy::no_effect_underscore_binding, clippy::unused_async)] +#[expect(clippy::no_effect_underscore_binding, clippy::unused_async)] #[endpoint { method = OPTIONS, path = "/v0/organizations/{organization}/members", @@ -327,7 +327,7 @@ pub struct OrgMemberParams { pub user: ResourceId, } -#[allow(clippy::no_effect_underscore_binding, clippy::unused_async)] +#[expect(clippy::no_effect_underscore_binding, clippy::unused_async)] #[endpoint { method = OPTIONS, path = "/v0/organizations/{organization}/members/{user}", diff --git a/lib/api_organizations/src/organizations.rs b/lib/api_organizations/src/organizations.rs index 5dacfe1e0..cdf0e03df 100644 --- a/lib/api_organizations/src/organizations.rs +++ b/lib/api_organizations/src/organizations.rs @@ -18,7 +18,7 @@ use bencher_schema::{ schema, }; use diesel::{ - BoolExpressionMethods, ExpressionMethods, QueryDsl, RunQueryDsl, TextExpressionMethods, + BoolExpressionMethods as _, ExpressionMethods as _, QueryDsl as _, RunQueryDsl as _, TextExpressionMethods as _, }; use dropshot::{endpoint, HttpError, Path, Query, RequestContext, TypedBody}; use schemars::JsonSchema; @@ -42,7 +42,7 @@ pub struct OrganizationsQuery { pub search: Option, } -#[allow(clippy::no_effect_underscore_binding, clippy::unused_async)] +#[expect(clippy::no_effect_underscore_binding, clippy::unused_async)] #[endpoint { method = OPTIONS, path = "/v0/organizations", @@ -192,7 +192,7 @@ pub struct OrganizationParams { pub organization: ResourceId, } -#[allow(clippy::no_effect_underscore_binding, clippy::unused_async)] +#[expect(clippy::no_effect_underscore_binding, clippy::unused_async)] #[endpoint { method = OPTIONS, path = "/v0/organizations/{organization}", diff --git a/lib/api_organizations/src/plan.rs b/lib/api_organizations/src/plan.rs index fe0367935..d986d4d4e 100644 --- a/lib/api_organizations/src/plan.rs +++ b/lib/api_organizations/src/plan.rs @@ -26,7 +26,7 @@ use bencher_schema::{ }, schema, }; -use diesel::{BelongingToDsl, ExpressionMethods, QueryDsl, RunQueryDsl}; +use diesel::{BelongingToDsl as _, ExpressionMethods as _, QueryDsl as _, RunQueryDsl as _}; use dropshot::{endpoint, HttpError, Path, Query, RequestContext, TypedBody}; use schemars::JsonSchema; use serde::Deserialize; @@ -37,7 +37,7 @@ pub struct OrgPlanParams { pub organization: ResourceId, } -#[allow(clippy::no_effect_underscore_binding, clippy::unused_async)] +#[expect(clippy::no_effect_underscore_binding, clippy::unused_async)] #[endpoint { method = OPTIONS, path = "/v0/organizations/{organization}/plan", diff --git a/lib/api_organizations/src/projects.rs b/lib/api_organizations/src/projects.rs index 66b3186b0..eaaefae8d 100644 --- a/lib/api_organizations/src/projects.rs +++ b/lib/api_organizations/src/projects.rs @@ -27,8 +27,8 @@ use bencher_schema::{ schema, }; use diesel::{ - BelongingToDsl, BoolExpressionMethods, ExpressionMethods, QueryDsl, RunQueryDsl, - TextExpressionMethods, + BelongingToDsl as _, BoolExpressionMethods as _, ExpressionMethods as _, QueryDsl as _, RunQueryDsl as _, + TextExpressionMethods as _, }; use dropshot::{endpoint, HttpError, Path, Query, RequestContext, TypedBody}; use schemars::JsonSchema; @@ -59,7 +59,7 @@ pub struct OrgProjectsQuery { pub search: Option, } -#[allow(clippy::no_effect_underscore_binding, clippy::unused_async)] +#[expect(clippy::no_effect_underscore_binding, clippy::unused_async)] #[endpoint { method = OPTIONS, path = "/v0/organizations/{organization}/projects", diff --git a/lib/api_organizations/src/usage.rs b/lib/api_organizations/src/usage.rs index d42721166..f573a54c9 100644 --- a/lib/api_organizations/src/usage.rs +++ b/lib/api_organizations/src/usage.rs @@ -18,7 +18,7 @@ use bencher_schema::{ user::auth::{AuthUser, BearerToken}, }, }; -use diesel::{BelongingToDsl, RunQueryDsl}; +use diesel::{BelongingToDsl as _, RunQueryDsl as _}; use dropshot::{endpoint, HttpError, Path, RequestContext}; use schemars::JsonSchema; use serde::Deserialize; @@ -32,7 +32,7 @@ pub struct OrgUsageParams { pub organization: ResourceId, } -#[allow(clippy::no_effect_underscore_binding, clippy::unused_async)] +#[expect(clippy::no_effect_underscore_binding, clippy::unused_async)] #[endpoint { method = OPTIONS, path = "/v0/organizations/{organization}/usage", @@ -66,7 +66,7 @@ pub async fn org_usage_get( Ok(Get::auth_response_ok(json)) } -#[allow(clippy::too_many_lines)] +#[expect(clippy::too_many_lines)] async fn get_inner( context: &ApiContext, path_params: OrgUsageParams, diff --git a/lib/api_projects/src/alerts.rs b/lib/api_projects/src/alerts.rs index c95ff196e..e41000407 100644 --- a/lib/api_projects/src/alerts.rs +++ b/lib/api_projects/src/alerts.rs @@ -17,7 +17,7 @@ use bencher_schema::{ }, schema, }; -use diesel::{BoolExpressionMethods, ExpressionMethods, QueryDsl, RunQueryDsl, SelectableHelper}; +use diesel::{BoolExpressionMethods as _, ExpressionMethods as _, QueryDsl as _, RunQueryDsl as _, SelectableHelper as _}; use dropshot::{endpoint, HttpError, Path, Query, RequestContext, TypedBody}; use schemars::JsonSchema; use serde::Deserialize; @@ -50,7 +50,7 @@ pub struct ProjAlertsQuery { pub archived: Option, } -#[allow(clippy::no_effect_underscore_binding, clippy::unused_async)] +#[expect(clippy::no_effect_underscore_binding, clippy::unused_async)] #[endpoint { method = OPTIONS, path = "/v0/projects/{project}/alerts", @@ -190,7 +190,7 @@ fn get_ls_query<'q>( .and(schema::testbed::archived.is_null()) .and(schema::measure::archived.is_null()), ); - }; + } match pagination_params.order() { ProjAlertsSort::Created => match pagination_params.direction { @@ -286,7 +286,7 @@ pub struct ProjAlertParams { pub alert: AlertUuid, } -#[allow(clippy::no_effect_underscore_binding, clippy::unused_async)] +#[expect(clippy::no_effect_underscore_binding, clippy::unused_async)] #[endpoint { method = OPTIONS, path = "/v0/projects/{project}/alerts/{alert}", diff --git a/lib/api_projects/src/allowed.rs b/lib/api_projects/src/allowed.rs index 11969d81b..d4d987dfd 100644 --- a/lib/api_projects/src/allowed.rs +++ b/lib/api_projects/src/allowed.rs @@ -20,7 +20,7 @@ pub struct ProjAllowedParams { pub permission: ProjectPermission, } -#[allow(clippy::no_effect_underscore_binding, clippy::unused_async)] +#[expect(clippy::no_effect_underscore_binding, clippy::unused_async)] #[endpoint { method = OPTIONS, path = "/v0/projects/{project}/allowed/{permission}", diff --git a/lib/api_projects/src/benchmarks.rs b/lib/api_projects/src/benchmarks.rs index e57458229..f7fddcbad 100644 --- a/lib/api_projects/src/benchmarks.rs +++ b/lib/api_projects/src/benchmarks.rs @@ -22,8 +22,8 @@ use bencher_schema::{ schema, }; use diesel::{ - BelongingToDsl, BoolExpressionMethods, ExpressionMethods, QueryDsl, RunQueryDsl, - TextExpressionMethods, + BelongingToDsl as _, BoolExpressionMethods as _, ExpressionMethods as _, QueryDsl as _, RunQueryDsl as _, + TextExpressionMethods as _, }; use dropshot::{endpoint, HttpError, Path, Query, RequestContext, TypedBody}; use schemars::JsonSchema; @@ -56,7 +56,7 @@ pub struct ProjBenchmarksQuery { pub archived: Option, } -#[allow(clippy::no_effect_underscore_binding, clippy::unused_async)] +#[expect(clippy::no_effect_underscore_binding, clippy::unused_async)] #[endpoint { method = OPTIONS, path = "/v0/projects/{project}/benchmarks", @@ -169,7 +169,7 @@ fn get_ls_query<'q>( query = query.filter(schema::benchmark::archived.is_not_null()); } else { query = query.filter(schema::benchmark::archived.is_null()); - }; + } match pagination_params.order() { ProjBenchmarksSort::Name => match pagination_params.direction { @@ -233,7 +233,7 @@ pub struct ProjBenchmarkParams { pub benchmark: ResourceId, } -#[allow(clippy::no_effect_underscore_binding, clippy::unused_async)] +#[expect(clippy::no_effect_underscore_binding, clippy::unused_async)] #[endpoint { method = OPTIONS, path = "/v0/projects/{project}/benchmarks/{benchmark}", diff --git a/lib/api_projects/src/branches.rs b/lib/api_projects/src/branches.rs index 0d2d28e8f..80948b5ad 100644 --- a/lib/api_projects/src/branches.rs +++ b/lib/api_projects/src/branches.rs @@ -23,8 +23,8 @@ use bencher_schema::{ schema, }; use diesel::{ - BelongingToDsl, BoolExpressionMethods, ExpressionMethods, QueryDsl, RunQueryDsl, - TextExpressionMethods, + BelongingToDsl as _, BoolExpressionMethods as _, ExpressionMethods as _, QueryDsl as _, RunQueryDsl as _, + TextExpressionMethods as _, }; use dropshot::{endpoint, HttpError, Path, Query, RequestContext, TypedBody}; use schemars::JsonSchema; @@ -58,7 +58,7 @@ pub struct ProjBranchesQuery { pub archived: Option, } -#[allow(clippy::no_effect_underscore_binding, clippy::unused_async)] +#[expect(clippy::no_effect_underscore_binding, clippy::unused_async)] #[endpoint { method = OPTIONS, path = "/v0/projects/{project}/branches", @@ -178,7 +178,7 @@ fn get_ls_query<'q>( query = query.filter(schema::branch::archived.is_not_null()); } else { query = query.filter(schema::branch::archived.is_null()); - }; + } match pagination_params.order() { ProjBranchesSort::Name => match pagination_params.direction { @@ -253,7 +253,7 @@ pub struct ProjBranchQuery { pub head: Option, } -#[allow(clippy::no_effect_underscore_binding, clippy::unused_async)] +#[expect(clippy::no_effect_underscore_binding, clippy::unused_async)] #[endpoint { method = OPTIONS, path = "/v0/projects/{project}/branches/{branch}", diff --git a/lib/api_projects/src/macros.rs b/lib/api_projects/src/macros.rs index eab729824..57f2c7fbf 100644 --- a/lib/api_projects/src/macros.rs +++ b/lib/api_projects/src/macros.rs @@ -1,6 +1,6 @@ macro_rules! filter_name_id { ($name:ident, $query:ident, $table:ident, $name_id:ident) => { - #[allow(unused_qualifications)] + #[expect(unused_qualifications)] match $name_id.try_into().map_err(|e| { bencher_schema::error::issue_error( "Failed to parse name ID", diff --git a/lib/api_projects/src/measures.rs b/lib/api_projects/src/measures.rs index f42f5525e..3014c4442 100644 --- a/lib/api_projects/src/measures.rs +++ b/lib/api_projects/src/measures.rs @@ -21,8 +21,8 @@ use bencher_schema::{ schema, }; use diesel::{ - BelongingToDsl, BoolExpressionMethods, ExpressionMethods, QueryDsl, RunQueryDsl, - TextExpressionMethods, + BelongingToDsl as _, BoolExpressionMethods as _, ExpressionMethods as _, QueryDsl as _, RunQueryDsl as _, + TextExpressionMethods as _, }; use dropshot::{endpoint, HttpError, Path, Query, RequestContext, TypedBody}; use schemars::JsonSchema; @@ -55,7 +55,7 @@ pub struct ProjMeasuresQuery { pub archived: Option, } -#[allow(clippy::no_effect_underscore_binding, clippy::unused_async)] +#[expect(clippy::no_effect_underscore_binding, clippy::unused_async)] #[endpoint { method = OPTIONS, path = "/v0/projects/{project}/measures", @@ -168,7 +168,7 @@ fn get_ls_query<'q>( query = query.filter(schema::measure::archived.is_not_null()); } else { query = query.filter(schema::measure::archived.is_null()); - }; + } match pagination_params.order() { ProjMeasuresSort::Name => match pagination_params.direction { @@ -232,7 +232,7 @@ pub struct ProjMeasureParams { pub measure: ResourceId, } -#[allow(clippy::no_effect_underscore_binding, clippy::unused_async)] +#[expect(clippy::no_effect_underscore_binding, clippy::unused_async)] #[endpoint { method = OPTIONS, path = "/v0/projects/{project}/measures/{measure}", diff --git a/lib/api_projects/src/metrics.rs b/lib/api_projects/src/metrics.rs index 74077e145..f7edeb212 100644 --- a/lib/api_projects/src/metrics.rs +++ b/lib/api_projects/src/metrics.rs @@ -23,8 +23,8 @@ use bencher_schema::{ schema, view, }; use diesel::{ - ExpressionMethods, JoinOnDsl, NullableExpressionMethods, QueryDsl, RunQueryDsl, - SelectableHelper, + ExpressionMethods as _, JoinOnDsl as _, NullableExpressionMethods as _, QueryDsl as _, RunQueryDsl as _, + SelectableHelper as _, }; use dropshot::{endpoint, HttpError, Path, RequestContext}; use schemars::JsonSchema; @@ -40,7 +40,7 @@ pub struct ProjMetricParams { pub metric: MetricUuid, } -#[allow(clippy::no_effect_underscore_binding, clippy::unused_async)] +#[expect(clippy::no_effect_underscore_binding, clippy::unused_async)] #[endpoint { method = OPTIONS, path = "/v0/projects/{project}/metrics/{metric}", diff --git a/lib/api_projects/src/perf/img.rs b/lib/api_projects/src/perf/img.rs index d6e4e9857..c515b96e6 100644 --- a/lib/api_projects/src/perf/img.rs +++ b/lib/api_projects/src/perf/img.rs @@ -14,7 +14,7 @@ use http::Response; use super::ProjPerfParams; -#[allow(clippy::no_effect_underscore_binding, clippy::unused_async)] +#[expect(clippy::no_effect_underscore_binding, clippy::unused_async)] #[endpoint { method = OPTIONS, path = "/v0/projects/{project}/perf/img", diff --git a/lib/api_projects/src/perf/mod.rs b/lib/api_projects/src/perf/mod.rs index 2ff797e25..ab50e71a9 100644 --- a/lib/api_projects/src/perf/mod.rs +++ b/lib/api_projects/src/perf/mod.rs @@ -31,8 +31,8 @@ use bencher_schema::{ schema, view, }; use diesel::{ - ExpressionMethods, JoinOnDsl, NullableExpressionMethods, QueryDsl, RunQueryDsl, - SelectableHelper, + ExpressionMethods as _, JoinOnDsl as _, NullableExpressionMethods as _, QueryDsl as _, RunQueryDsl as _, + SelectableHelper as _, }; use dropshot::{endpoint, HttpError, Path, Query, RequestContext}; use schemars::JsonSchema; @@ -48,7 +48,7 @@ pub struct ProjPerfParams { pub project: ResourceId, } -#[allow(clippy::no_effect_underscore_binding, clippy::unused_async)] +#[expect(clippy::no_effect_underscore_binding, clippy::unused_async)] #[endpoint { method = OPTIONS, path = "/v0/projects/{project}/perf", @@ -152,7 +152,7 @@ struct Times { end_time: Option, } -#[allow(clippy::too_many_arguments)] +#[expect(clippy::too_many_arguments)] async fn perf_results( context: &ApiContext, project: &QueryProject, @@ -219,7 +219,7 @@ async fn perf_results( Ok(results) } -#[allow(clippy::too_many_arguments, clippy::too_many_lines)] +#[expect(clippy::too_many_arguments, clippy::too_many_lines)] async fn perf_query( context: &ApiContext, project: &QueryProject, diff --git a/lib/api_projects/src/plots.rs b/lib/api_projects/src/plots.rs index 936af8719..ee9fccfc8 100644 --- a/lib/api_projects/src/plots.rs +++ b/lib/api_projects/src/plots.rs @@ -21,8 +21,8 @@ use bencher_schema::{ schema, }; use diesel::{ - BelongingToDsl, BoolExpressionMethods, ExpressionMethods, NullableExpressionMethods, QueryDsl, - RunQueryDsl, TextExpressionMethods, + BelongingToDsl as _, BoolExpressionMethods as _, ExpressionMethods as _, NullableExpressionMethods as _, QueryDsl as _, + RunQueryDsl as _, TextExpressionMethods as _, }; use dropshot::{endpoint, HttpError, Path, Query, RequestContext, TypedBody}; use schemars::JsonSchema; @@ -54,7 +54,7 @@ pub struct ProjPlotsQuery { pub search: Option, } -#[allow(clippy::no_effect_underscore_binding, clippy::unused_async)] +#[expect(clippy::no_effect_underscore_binding, clippy::unused_async)] #[endpoint { method = OPTIONS, path = "/v0/projects/{project}/plots", @@ -239,7 +239,7 @@ pub struct ProjPlotParams { pub plot: PlotUuid, } -#[allow(clippy::no_effect_underscore_binding, clippy::unused_async)] +#[expect(clippy::no_effect_underscore_binding, clippy::unused_async)] #[endpoint { method = OPTIONS, path = "/v0/projects/{project}/plots/{plot}", diff --git a/lib/api_projects/src/projects.rs b/lib/api_projects/src/projects.rs index f247135a3..819be506c 100644 --- a/lib/api_projects/src/projects.rs +++ b/lib/api_projects/src/projects.rs @@ -19,7 +19,7 @@ use bencher_schema::{ schema, }; use diesel::{ - BoolExpressionMethods, ExpressionMethods, QueryDsl, RunQueryDsl, TextExpressionMethods, + BoolExpressionMethods as _, ExpressionMethods as _, QueryDsl as _, RunQueryDsl as _, TextExpressionMethods as _, }; use dropshot::{endpoint, HttpError, Path, Query, RequestContext, TypedBody}; use schemars::JsonSchema; @@ -44,7 +44,7 @@ pub struct ProjectsQuery { pub search: Option, } -#[allow(clippy::no_effect_underscore_binding, clippy::unused_async)] +#[expect(clippy::no_effect_underscore_binding, clippy::unused_async)] #[endpoint { method = OPTIONS, path = "/v0/projects", @@ -180,7 +180,7 @@ pub struct ProjectParams { pub project: ResourceId, } -#[allow(clippy::no_effect_underscore_binding, clippy::unused_async)] +#[expect(clippy::no_effect_underscore_binding, clippy::unused_async)] #[endpoint { method = OPTIONS, path = "/v0/projects/{project}", diff --git a/lib/api_projects/src/reports.rs b/lib/api_projects/src/reports.rs index 1980463cc..73fea1b60 100644 --- a/lib/api_projects/src/reports.rs +++ b/lib/api_projects/src/reports.rs @@ -30,8 +30,8 @@ use bencher_schema::{ schema, }; use diesel::{ - dsl::count, BelongingToDsl, BoolExpressionMethods, ExpressionMethods, JoinOnDsl, QueryDsl, - RunQueryDsl, SelectableHelper, + dsl::count, BelongingToDsl as _, BoolExpressionMethods as _, ExpressionMethods as _, JoinOnDsl as _, QueryDsl as _, + RunQueryDsl as _, SelectableHelper as _, }; use dropshot::{endpoint, HttpError, Path, Query, RequestContext, TypedBody}; use schemars::JsonSchema; @@ -56,7 +56,7 @@ pub enum ProjReportsSort { DateTime, } -#[allow(clippy::no_effect_underscore_binding, clippy::unused_async)] +#[expect(clippy::no_effect_underscore_binding, clippy::unused_async)] #[endpoint { method = OPTIONS, path = "/v0/projects/{project}/reports", @@ -200,7 +200,7 @@ fn get_ls_query<'q>( .is_null() .and(schema::testbed::archived.is_null()), ); - }; + } Ok(match pagination_params.order() { ProjReportsSort::DateTime => match pagination_params.direction { @@ -305,7 +305,7 @@ pub struct ProjReportParams { pub report: ReportUuid, } -#[allow(clippy::no_effect_underscore_binding, clippy::unused_async)] +#[expect(clippy::no_effect_underscore_binding, clippy::unused_async)] #[endpoint { method = OPTIONS, path = "/v0/projects/{project}/reports/{report}", diff --git a/lib/api_projects/src/testbeds.rs b/lib/api_projects/src/testbeds.rs index 1ca6f761e..2e9234b4c 100644 --- a/lib/api_projects/src/testbeds.rs +++ b/lib/api_projects/src/testbeds.rs @@ -21,8 +21,8 @@ use bencher_schema::{ schema, }; use diesel::{ - BelongingToDsl, BoolExpressionMethods, ExpressionMethods, QueryDsl, RunQueryDsl, - TextExpressionMethods, + BelongingToDsl as _, BoolExpressionMethods as _, ExpressionMethods as _, QueryDsl as _, RunQueryDsl as _, + TextExpressionMethods as _, }; use dropshot::{endpoint, HttpError, Path, Query, RequestContext, TypedBody}; use schemars::JsonSchema; @@ -55,7 +55,7 @@ pub struct ProjTestbedsQuery { pub archived: Option, } -#[allow(clippy::no_effect_underscore_binding, clippy::unused_async)] +#[expect(clippy::no_effect_underscore_binding, clippy::unused_async)] #[endpoint { method = OPTIONS, path = "/v0/projects/{project}/testbeds", @@ -168,7 +168,7 @@ fn get_ls_query<'q>( query = query.filter(schema::testbed::archived.is_not_null()); } else { query = query.filter(schema::testbed::archived.is_null()); - }; + } match pagination_params.order() { ProjTestbedsSort::Name => match pagination_params.direction { @@ -232,7 +232,7 @@ pub struct ProjTestbedParams { pub testbed: ResourceId, } -#[allow(clippy::no_effect_underscore_binding, clippy::unused_async)] +#[expect(clippy::no_effect_underscore_binding, clippy::unused_async)] #[endpoint { method = OPTIONS, path = "/v0/projects/{project}/testbeds/{testbed}", diff --git a/lib/api_projects/src/thresholds.rs b/lib/api_projects/src/thresholds.rs index 20f465975..863ec6901 100644 --- a/lib/api_projects/src/thresholds.rs +++ b/lib/api_projects/src/thresholds.rs @@ -30,8 +30,8 @@ use bencher_schema::{ schema, }; use diesel::{ - BelongingToDsl, BoolExpressionMethods, ExpressionMethods, QueryDsl, RunQueryDsl, - SelectableHelper, + BelongingToDsl as _, BoolExpressionMethods as _, ExpressionMethods as _, QueryDsl as _, RunQueryDsl as _, + SelectableHelper as _, }; use dropshot::{endpoint, HttpError, Path, Query, RequestContext, TypedBody}; use schemars::JsonSchema; @@ -57,7 +57,7 @@ pub enum ProjThresholdsSort { Modified, } -#[allow(clippy::no_effect_underscore_binding, clippy::unused_async)] +#[expect(clippy::no_effect_underscore_binding, clippy::unused_async)] #[endpoint { method = OPTIONS, path = "/v0/projects/{project}/thresholds", @@ -195,7 +195,7 @@ fn get_ls_query<'q>( .and(schema::testbed::archived.is_null()) .and(schema::measure::archived.is_null()), ); - }; + } Ok(match pagination_params.order() { ProjThresholdsSort::Created => match pagination_params.direction { @@ -321,7 +321,7 @@ pub struct ProjThresholdQuery { pub model: Option, } -#[allow(clippy::no_effect_underscore_binding, clippy::unused_async)] +#[expect(clippy::no_effect_underscore_binding, clippy::unused_async)] #[endpoint { method = OPTIONS, path = "/v0/projects/{project}/thresholds/{threshold}", diff --git a/lib/api_run/src/run.rs b/lib/api_run/src/run.rs index 6252db801..ab8636052 100644 --- a/lib/api_run/src/run.rs +++ b/lib/api_run/src/run.rs @@ -13,7 +13,7 @@ use bencher_schema::{ use dropshot::{endpoint, HttpError, RequestContext, TypedBody}; use slog::Logger; -#[allow(clippy::no_effect_underscore_binding, clippy::unused_async)] +#[expect(clippy::no_effect_underscore_binding, clippy::unused_async)] #[endpoint { method = OPTIONS, path = "/v0/run", diff --git a/lib/api_server/src/backup.rs b/lib/api_server/src/backup.rs index 15cc78abb..42258cac5 100644 --- a/lib/api_server/src/backup.rs +++ b/lib/api_server/src/backup.rs @@ -12,16 +12,16 @@ use bencher_schema::{ model::user::{admin::AdminUser, auth::BearerToken}, }; use chrono::Utc; -use diesel::connection::SimpleConnection; +use diesel::connection::SimpleConnection as _; use dropshot::{endpoint, HttpError, RequestContext, TypedBody}; use tokio::{ fs::remove_file, - io::{AsyncReadExt, AsyncWriteExt, BufReader, BufWriter}, + io::{AsyncReadExt as _, AsyncWriteExt as _, BufReader, BufWriter}, }; const BUFFER_SIZE: usize = 1024; -#[allow(clippy::no_effect_underscore_binding, clippy::unused_async)] +#[expect(clippy::no_effect_underscore_binding, clippy::unused_async)] #[endpoint { method = OPTIONS, path = "/v0/server/backup", @@ -111,7 +111,7 @@ async fn backup( .map_err(BackupError::DataStore)?; } else { return Err(BackupError::NoDataStore); - }; + } } // Remove the remaining database backup diff --git a/lib/api_server/src/config.rs b/lib/api_server/src/config.rs index 55494dcc4..771c84897 100644 --- a/lib/api_server/src/config.rs +++ b/lib/api_server/src/config.rs @@ -5,6 +5,7 @@ use bencher_json::{ JsonConfig, }; use bencher_schema::{ + conn_lock, context::ApiContext, error::{bad_request_error, issue_error}, model::user::{ @@ -17,7 +18,7 @@ use slog::Logger; use super::restart::countdown; -#[allow(clippy::no_effect_underscore_binding, clippy::unused_async)] +#[expect(clippy::no_effect_underscore_binding, clippy::unused_async)] #[endpoint { method = OPTIONS, path = "/v0/server/config", @@ -91,7 +92,16 @@ async fn put_inner( // TODO add validation here let config_str = serde_json::to_string(&config).map_err(bad_request_error)?; - std::env::set_var(BENCHER_CONFIG, &config_str); + { + let _conn = conn_lock!(context); + // SAFETY: This is safe because we are setting the environment variable + // while holding a lock on the database connection. + // This guarantees that no other thread is writing to the environment variable + #[expect(unsafe_code, reason = "set environment variable")] + unsafe { + std::env::set_var(BENCHER_CONFIG, &config_str); + } + } Config::write(log, config_str.as_bytes()) .await .map_err(|e| { @@ -108,7 +118,7 @@ async fn put_inner( Ok(json_config) } -#[allow(clippy::no_effect_underscore_binding, clippy::unused_async)] +#[expect(clippy::no_effect_underscore_binding, clippy::unused_async)] #[endpoint { method = OPTIONS, path = "/v0/server/config/console", diff --git a/lib/api_server/src/restart.rs b/lib/api_server/src/restart.rs index 6ee387601..d70571a10 100644 --- a/lib/api_server/src/restart.rs +++ b/lib/api_server/src/restart.rs @@ -10,7 +10,7 @@ use tokio::sync::mpsc::Sender; const DEFAULT_DELAY: u64 = 3; -#[allow(clippy::no_effect_underscore_binding, clippy::unused_async)] +#[expect(clippy::no_effect_underscore_binding, clippy::unused_async)] #[endpoint { method = OPTIONS, path = "/v0/server/restart", @@ -42,7 +42,7 @@ pub async fn server_restart_post( Ok(Post::auth_response_accepted(())) } -#[allow(clippy::no_effect_underscore_binding, clippy::unused_async)] +#[expect(clippy::no_effect_underscore_binding, clippy::unused_async)] async fn post_inner( log: &Logger, context: &ApiContext, diff --git a/lib/api_server/src/root.rs b/lib/api_server/src/root.rs index fb958c1f7..f6af74282 100644 --- a/lib/api_server/src/root.rs +++ b/lib/api_server/src/root.rs @@ -4,7 +4,7 @@ use bencher_endpoint::{CorsResponse, Endpoint, Get, ResponseOk}; use bencher_schema::context::ApiContext; use dropshot::{endpoint, HttpError, RequestContext}; -#[allow(clippy::no_effect_underscore_binding, clippy::unused_async)] +#[expect(clippy::no_effect_underscore_binding, clippy::unused_async)] #[endpoint { method = OPTIONS, path = "/", @@ -24,7 +24,7 @@ pub async fn server_root_options( ])) } -#[allow(clippy::no_effect_underscore_binding, clippy::unused_async)] +#[expect(clippy::no_effect_underscore_binding, clippy::unused_async)] #[endpoint { method = GET, path = "/", diff --git a/lib/api_server/src/spec.rs b/lib/api_server/src/spec.rs index 52d548617..ace069af4 100644 --- a/lib/api_server/src/spec.rs +++ b/lib/api_server/src/spec.rs @@ -6,11 +6,11 @@ use bencher_schema::context::ApiContext; use dropshot::{endpoint, HttpError, RequestContext}; pub const SPEC_STR: &str = include_str!("../../../services/api/openapi.json"); -#[allow(clippy::expect_used)] +#[expect(clippy::expect_used)] pub static SPEC: LazyLock = LazyLock::new(|| JsonSpec(SPEC_STR.parse().expect("Failed to parse OpenAPI spec"))); -#[allow(clippy::no_effect_underscore_binding, clippy::unused_async)] +#[expect(clippy::no_effect_underscore_binding, clippy::unused_async)] #[endpoint { method = OPTIONS, path = "/v0/server/spec", @@ -26,7 +26,7 @@ pub async fn server_spec_options( /// /// View the API server OpenAPI specification. /// The OpenAPI specification can be used to generate API client code. -#[allow( +#[expect( clippy::no_effect_underscore_binding, clippy::doc_markdown, clippy::unused_async diff --git a/lib/api_server/src/stats.rs b/lib/api_server/src/stats.rs index db4933d94..07588185b 100644 --- a/lib/api_server/src/stats.rs +++ b/lib/api_server/src/stats.rs @@ -14,7 +14,7 @@ use bencher_schema::{ use dropshot::{endpoint, HttpError, RequestContext, TypedBody}; use slog::Logger; -#[allow(clippy::no_effect_underscore_binding, clippy::unused_async)] +#[expect(clippy::no_effect_underscore_binding, clippy::unused_async)] #[endpoint { method = OPTIONS, path = "/v0/server/stats", diff --git a/lib/api_server/src/version.rs b/lib/api_server/src/version.rs index 4827208ad..a60bba580 100644 --- a/lib/api_server/src/version.rs +++ b/lib/api_server/src/version.rs @@ -3,7 +3,7 @@ use bencher_json::JsonApiVersion; use bencher_schema::{context::ApiContext, API_VERSION}; use dropshot::{endpoint, HttpError, RequestContext}; -#[allow(clippy::no_effect_underscore_binding, clippy::unused_async)] +#[expect(clippy::no_effect_underscore_binding, clippy::unused_async)] #[endpoint { method = OPTIONS, path = "/v0/server/version", @@ -20,7 +20,7 @@ pub async fn server_version_options( /// View the API server version. /// This is used to verify that the CLI and API server are compatible. /// It can also be used as a simple endpoint to verify that the server is running. -#[allow(clippy::no_effect_underscore_binding, clippy::unused_async)] +#[expect(clippy::no_effect_underscore_binding, clippy::unused_async)] #[endpoint { method = GET, path = "/v0/server/version", diff --git a/lib/api_users/src/tokens.rs b/lib/api_users/src/tokens.rs index 41a1f96ca..be29b5bb2 100644 --- a/lib/api_users/src/tokens.rs +++ b/lib/api_users/src/tokens.rs @@ -18,7 +18,7 @@ use bencher_schema::{ schema, }; use diesel::{ - BoolExpressionMethods, ExpressionMethods, QueryDsl, RunQueryDsl, TextExpressionMethods, + BoolExpressionMethods as _, ExpressionMethods as _, QueryDsl as _, RunQueryDsl as _, TextExpressionMethods as _, }; use dropshot::{endpoint, HttpError, Path, Query, RequestContext, TypedBody}; use schemars::JsonSchema; @@ -49,7 +49,7 @@ pub struct UserTokensQuery { pub search: Option, } -#[allow(clippy::no_effect_underscore_binding, clippy::unused_async)] +#[expect(clippy::no_effect_underscore_binding, clippy::unused_async)] #[endpoint { method = OPTIONS, path = "/v0/users/{user}/tokens", @@ -226,7 +226,7 @@ pub struct UserTokenParams { pub token: Uuid, } -#[allow(clippy::no_effect_underscore_binding, clippy::unused_async)] +#[expect(clippy::no_effect_underscore_binding, clippy::unused_async)] #[endpoint { method = OPTIONS, path = "/v0/users/{user}/tokens/{token}", diff --git a/lib/api_users/src/users.rs b/lib/api_users/src/users.rs index 4369653fa..a1fe63ec4 100644 --- a/lib/api_users/src/users.rs +++ b/lib/api_users/src/users.rs @@ -1,6 +1,6 @@ use bencher_endpoint::{CorsResponse, Endpoint, Get, Patch, ResponseOk, TotalCount}; use bencher_json::{ - user::JsonUsers, JsonDirection, JsonPagination, JsonUpdateUser, JsonUser, ResourceId, Sanitize, + user::JsonUsers, JsonDirection, JsonPagination, JsonUpdateUser, JsonUser, ResourceId, Sanitize as _, Search, UserName, }; use bencher_schema::{ @@ -15,7 +15,7 @@ use bencher_schema::{ schema, }; use diesel::{ - BoolExpressionMethods, ExpressionMethods, QueryDsl, RunQueryDsl, TextExpressionMethods, + BoolExpressionMethods as _, ExpressionMethods as _, QueryDsl as _, RunQueryDsl as _, TextExpressionMethods as _, }; use dropshot::{endpoint, HttpError, Path, Query, RequestContext, TypedBody}; use schemars::JsonSchema; @@ -39,7 +39,7 @@ pub struct UsersQuery { pub search: Option, } -#[allow(clippy::no_effect_underscore_binding, clippy::unused_async)] +#[expect(clippy::no_effect_underscore_binding, clippy::unused_async)] #[endpoint { method = OPTIONS, path = "/v0/users", @@ -138,7 +138,7 @@ pub struct UserParams { pub user: ResourceId, } -#[allow(clippy::no_effect_underscore_binding, clippy::unused_async)] +#[expect(clippy::no_effect_underscore_binding, clippy::unused_async)] #[endpoint { method = OPTIONS, path = "/v0/users/{user}", diff --git a/lib/bencher_adapter/benches/adapter.rs b/lib/bencher_adapter/benches/adapter.rs index 4d36246c4..07db9466f 100644 --- a/lib/bencher_adapter/benches/adapter.rs +++ b/lib/bencher_adapter/benches/adapter.rs @@ -1,8 +1,8 @@ -#![allow(unused_crate_dependencies)] +#![expect(unused_crate_dependencies)] -use criterion::{criterion_group, criterion_main, Criterion}; +use criterion::{Criterion, criterion_group, criterion_main}; -use bencher_adapter::{Adaptable, Settings}; +use bencher_adapter::{Adaptable as _, Settings}; use bencher_json::project::report::Adapter; const JSON_RESULT: &str = r#"{ @@ -50,7 +50,7 @@ fn adapter_json(c: &mut Criterion) { }); } -#[allow(clippy::non_ascii_literal)] +#[expect(clippy::non_ascii_literal)] const RUST_RESULT: &str = " running 5 tests test tests::ignored ... ignored diff --git a/lib/bencher_adapter/src/adapters/cpp/catch2.rs b/lib/bencher_adapter/src/adapters/cpp/catch2.rs index 99fe25b05..c8e7bdbb7 100644 --- a/lib/bencher_adapter/src/adapters/cpp/catch2.rs +++ b/lib/bencher_adapter/src/adapters/cpp/catch2.rs @@ -131,7 +131,7 @@ fn parse_catch2_benchmark_time(input: &str) -> IResult<&str, (Option, Or )(input) } -#[allow(dead_code)] +#[expect(dead_code)] struct Prelude { samples: u64, iterations: u64, diff --git a/lib/bencher_adapter/src/adapters/mod.rs b/lib/bencher_adapter/src/adapters/mod.rs index ab7c5c27d..db14ee696 100644 --- a/lib/bencher_adapter/src/adapters/mod.rs +++ b/lib/bencher_adapter/src/adapters/mod.rs @@ -13,7 +13,7 @@ pub mod rust; pub mod shell; mod util; -#[allow(dead_code, clippy::print_stdout, clippy::unnecessary_wraps)] +#[expect(dead_code, clippy::print_stdout, clippy::unnecessary_wraps)] fn print_ln(input: &str) -> IResult<&str, ()> { println!("--- START ---"); println!("{input}"); @@ -22,12 +22,12 @@ fn print_ln(input: &str) -> IResult<&str, ()> { } #[cfg(test)] -#[allow(clippy::panic, clippy::unwrap_used)] +#[expect(clippy::panic, clippy::unwrap_used)] pub(crate) mod test_util { use bencher_json::project::{ measure::built_in::{ default::{Latency, Throughput}, - BuiltInMeasure, + BuiltInMeasure as _, }, report::JsonAverage, }; diff --git a/lib/bencher_adapter/src/adapters/python/pytest.rs b/lib/bencher_adapter/src/adapters/python/pytest.rs index 9d128df81..d9706b560 100644 --- a/lib/bencher_adapter/src/adapters/python/pytest.rs +++ b/lib/bencher_adapter/src/adapters/python/pytest.rs @@ -52,7 +52,7 @@ pub struct Stats { } impl Pytest { - #[allow(clippy::unnecessary_wraps)] + #[expect(clippy::unnecessary_wraps)] fn convert(self, settings: Settings) -> Result, AdapterError> { let benchmarks = self.benchmarks.0; let mut benchmark_metrics = Vec::with_capacity(benchmarks.len()); diff --git a/lib/bencher_adapter/src/adapters/rust/bench.rs b/lib/bencher_adapter/src/adapters/rust/bench.rs index 0f860bb9e..f2039a236 100644 --- a/lib/bencher_adapter/src/adapters/rust/bench.rs +++ b/lib/bencher_adapter/src/adapters/rust/bench.rs @@ -237,7 +237,7 @@ pub(crate) mod test_rust_bench { } #[test] - #[allow(clippy::unreadable_literal)] + #[expect(clippy::unreadable_literal)] fn test_issue_390() { let results = convert_rust_bench("issue_390"); assert_eq!(results.inner.len(), 4); diff --git a/lib/bencher_adapter/src/adapters/rust/criterion.rs b/lib/bencher_adapter/src/adapters/rust/criterion.rs index 0b8ef904c..c37d8e608 100644 --- a/lib/bencher_adapter/src/adapters/rust/criterion.rs +++ b/lib/bencher_adapter/src/adapters/rust/criterion.rs @@ -107,7 +107,7 @@ pub(crate) mod test_rust_criterion { use crate::{ adapters::test_util::{convert_file_path, opt_convert_file_path, validate_latency}, - Adaptable, AdapterResults, Settings, + Adaptable as _, AdapterResults, Settings, }; use super::{parse_criterion, AdapterRustCriterion}; diff --git a/lib/bencher_adapter/src/adapters/rust/iai.rs b/lib/bencher_adapter/src/adapters/rust/iai.rs index ac1acb51c..9ccf85efe 100644 --- a/lib/bencher_adapter/src/adapters/rust/iai.rs +++ b/lib/bencher_adapter/src/adapters/rust/iai.rs @@ -2,7 +2,7 @@ use bencher_json::{ project::{ measure::built_in::{ iai::{EstimatedCycles, Instructions, L1Accesses, L2Accesses, RamAccesses}, - BuiltInMeasure, + BuiltInMeasure as _, }, report::JsonAverage, }, @@ -60,7 +60,7 @@ fn parse_iai_lines( lines; let name = benchmark_name_line.parse().ok()?; - #[allow(trivial_casts)] + #[expect(trivial_casts)] let metrics = [ ( Instructions::NAME_STR, @@ -98,7 +98,7 @@ fn parse_iai_lines( Some((name, metrics)) } -#[allow(clippy::cast_precision_loss)] +#[expect(clippy::cast_precision_loss)] fn parse_iai_metric<'a>(input: &'a str, measure: &'static str) -> IResult<&'a str, JsonNewMetric> { map( tuple(( @@ -142,12 +142,12 @@ pub(crate) mod test_rust_iai { use crate::{ adapters::test_util::convert_file_path, results::adapter_metrics::AdapterMetrics, - Adaptable, AdapterResults, + Adaptable as _, AdapterResults, }; use bencher_json::{ project::measure::built_in::{ iai::{EstimatedCycles, Instructions, L1Accesses, L2Accesses, RamAccesses}, - BuiltInMeasure, + BuiltInMeasure as _, }, JsonNewMetric, }; diff --git a/lib/bencher_adapter/src/adapters/rust/iai_callgrind.rs b/lib/bencher_adapter/src/adapters/rust/iai_callgrind.rs index ddb2b8edc..d993dad17 100644 --- a/lib/bencher_adapter/src/adapters/rust/iai_callgrind.rs +++ b/lib/bencher_adapter/src/adapters/rust/iai_callgrind.rs @@ -1,6 +1,6 @@ use bencher_json::{ project::{ - measure::built_in::{iai_callgrind, BuiltInMeasure}, + measure::built_in::{iai_callgrind, BuiltInMeasure as _}, report::JsonAverage, }, BenchmarkName, JsonNewMetric, @@ -30,7 +30,7 @@ impl Adaptable for AdapterRustIaiCallgrind { Some(JsonAverage::Mean | JsonAverage::Median) => { return None; // 'iai_callgrind' results are for a single run only. }, - }; + } // Clean up the input by removing ANSI escape codes: let input = strip_ansi_escapes::strip_str(input); @@ -215,7 +215,7 @@ fn metric_line<'a>( line_ending(), )), |(_, _, _, _, current_value, _, _, _)| JsonNewMetric { - #[allow(clippy::cast_precision_loss)] + #[expect(clippy::cast_precision_loss)] value: (current_value as f64).into(), lower_value: None, upper_value: None, @@ -235,7 +235,7 @@ fn not_line_ending<'a>() -> impl FnMut(&'a str) -> IResult<&'a str, &'a str> { #[cfg(test)] pub(crate) mod test_rust_iai_callgrind { use crate::{adapters::test_util::convert_file_path, AdapterResults}; - use bencher_json::project::measure::built_in::{iai_callgrind, BuiltInMeasure}; + use bencher_json::project::measure::built_in::{iai_callgrind, BuiltInMeasure as _}; use ordered_float::OrderedFloat; use pretty_assertions::assert_eq; diff --git a/lib/bencher_adapter/src/adapters/shell/hyperfine.rs b/lib/bencher_adapter/src/adapters/shell/hyperfine.rs index 547c596bd..d59546ffc 100644 --- a/lib/bencher_adapter/src/adapters/shell/hyperfine.rs +++ b/lib/bencher_adapter/src/adapters/shell/hyperfine.rs @@ -43,7 +43,7 @@ pub struct HyperfineResult { } impl Hyperfine { - #[allow(clippy::unnecessary_wraps)] + #[expect(clippy::unnecessary_wraps)] fn convert(self, settings: Settings) -> Result, AdapterError> { let results = self.results; let mut benchmark_metrics = Vec::with_capacity(results.len()); diff --git a/lib/bencher_adapter/src/adapters/util.rs b/lib/bencher_adapter/src/adapters/util.rs index 36657fe51..894d9d76c 100644 --- a/lib/bencher_adapter/src/adapters/util.rs +++ b/lib/bencher_adapter/src/adapters/util.rs @@ -11,7 +11,7 @@ use nom::{ IResult, }; use ordered_float::OrderedFloat; -use rust_decimal::prelude::ToPrimitive; +use rust_decimal::prelude::ToPrimitive as _; use rust_decimal::Decimal; use serde::{ de::{self, Visitor}, @@ -75,7 +75,7 @@ impl From for Time { } impl Time { - #[allow(clippy::cast_precision_loss)] + #[expect(clippy::cast_precision_loss)] fn as_f64(&self) -> f64 { match self { Self::UInt64(int) => *int as f64, @@ -132,7 +132,7 @@ impl FromStr for Units { type Err = AdapterError; fn from_str(units_str: &str) -> Result { - #[allow(clippy::map_err_ignore)] + #[expect(clippy::map_err_ignore)] let (remainder, units) = parse_units(units_str).map_err(|_| Self::Err::BenchmarkUnits(units_str.into()))?; if remainder.is_empty() { diff --git a/lib/bencher_adapter/src/results/adapter_metrics.rs b/lib/bencher_adapter/src/results/adapter_metrics.rs index 9337d8f57..35eea443a 100644 --- a/lib/bencher_adapter/src/results/adapter_metrics.rs +++ b/lib/bencher_adapter/src/results/adapter_metrics.rs @@ -1,4 +1,4 @@ -use std::{collections::HashMap, str::FromStr}; +use std::{collections::HashMap, str::FromStr as _}; use bencher_json::{JsonNewMetric, MeasureNameId}; use serde::{Deserialize, Serialize}; diff --git a/lib/bencher_adapter/src/results/adapter_results.rs b/lib/bencher_adapter/src/results/adapter_results.rs index 90bd77f5d..f037a2a8f 100644 --- a/lib/bencher_adapter/src/results/adapter_results.rs +++ b/lib/bencher_adapter/src/results/adapter_results.rs @@ -1,8 +1,8 @@ -use std::{collections::HashMap, str::FromStr}; +use std::{collections::HashMap, str::FromStr as _}; use bencher_json::{ project::{ - measure::built_in::{self, BuiltInMeasure}, + measure::built_in::{self, BuiltInMeasure as _}, metric::Mean, }, BenchmarkName, JsonNewMetric, diff --git a/lib/bencher_adapter/src/results/mod.rs b/lib/bencher_adapter/src/results/mod.rs index 288310174..6f8f5d101 100644 --- a/lib/bencher_adapter/src/results/mod.rs +++ b/lib/bencher_adapter/src/results/mod.rs @@ -1,11 +1,11 @@ use std::collections::HashMap; use bencher_json::project::{ - metric::Mean, + metric::Mean as _, report::{Adapter, JsonFold}, }; -use crate::{Adaptable, AdapterError, Settings}; +use crate::{Adaptable as _, AdapterError, Settings}; pub mod adapter_metrics; pub mod adapter_results; diff --git a/lib/bencher_adapter/src/results/results_reducer.rs b/lib/bencher_adapter/src/results/results_reducer.rs index e4c82f57c..b0da65f4b 100644 --- a/lib/bencher_adapter/src/results/results_reducer.rs +++ b/lib/bencher_adapter/src/results/results_reducer.rs @@ -1,6 +1,6 @@ use std::collections::HashMap; -use bencher_json::{project::metric::Median, BenchmarkName, JsonNewMetric, MeasureNameId}; +use bencher_json::{project::metric::Median as _, BenchmarkName, JsonNewMetric, MeasureNameId}; use super::{ adapter_metrics::AdapterMetrics, adapter_results::AdapterResults, AdapterResultsArray, diff --git a/lib/bencher_boundary/src/boundary.rs b/lib/bencher_boundary/src/boundary.rs index 1cde1cb8b..598798219 100644 --- a/lib/bencher_boundary/src/boundary.rs +++ b/lib/bencher_boundary/src/boundary.rs @@ -90,7 +90,7 @@ impl MetricsBoundary { log, datum, data, - #[allow(clippy::cast_precision_loss)] + #[expect(clippy::cast_precision_loss)] NormalTestKind::T { freedom: (data.len() - 1) as f64, }, diff --git a/lib/bencher_boundary/src/limits/limit.rs b/lib/bencher_boundary/src/limits/limit.rs index 477c2eed1..f8e6bc1d8 100644 --- a/lib/bencher_boundary/src/limits/limit.rs +++ b/lib/bencher_boundary/src/limits/limit.rs @@ -87,7 +87,7 @@ impl From for MetricsLimit { } #[cfg(test)] -#[allow(clippy::float_cmp, clippy::unwrap_used)] +#[expect(clippy::float_cmp, clippy::unwrap_used)] mod test { use pretty_assertions::assert_eq; diff --git a/lib/bencher_boundary/src/limits/mod.rs b/lib/bencher_boundary/src/limits/mod.rs index f55d953fe..a0d1172eb 100644 --- a/lib/bencher_boundary/src/limits/mod.rs +++ b/lib/bencher_boundary/src/limits/mod.rs @@ -2,7 +2,7 @@ use bencher_json::{ project::boundary::BoundaryLimit, Boundary, CdfBoundary, IqrBoundary, PercentageBoundary, }; use slog::{debug, Logger}; -use statrs::distribution::{ContinuousCDF, LogNormal, Normal, StudentsT}; +use statrs::distribution::{ContinuousCDF as _, LogNormal, Normal, StudentsT}; use crate::{ln::Ln, quartiles::Quartiles, BoundaryError}; @@ -217,7 +217,7 @@ impl MetricsLimits { } #[cfg(test)] -#[allow(clippy::expect_used, clippy::unreadable_literal, clippy::unwrap_used)] +#[expect(clippy::expect_used, clippy::unreadable_literal, clippy::unwrap_used)] mod test { use std::sync::LazyLock; diff --git a/lib/bencher_boundary/src/ln.rs b/lib/bencher_boundary/src/ln.rs index 0748bc2ef..a4a01e277 100644 --- a/lib/bencher_boundary/src/ln.rs +++ b/lib/bencher_boundary/src/ln.rs @@ -17,7 +17,7 @@ impl Ln { } #[cfg(test)] -#[allow(clippy::float_cmp, clippy::unreadable_literal, clippy::unwrap_used)] +#[expect(clippy::float_cmp, clippy::unreadable_literal, clippy::unwrap_used)] mod test { use pretty_assertions::assert_eq; diff --git a/lib/bencher_boundary/src/mean.rs b/lib/bencher_boundary/src/mean.rs index 473853b93..00544d4ec 100644 --- a/lib/bencher_boundary/src/mean.rs +++ b/lib/bencher_boundary/src/mean.rs @@ -4,7 +4,7 @@ pub struct Mean { } impl Mean { - #[allow(clippy::cast_precision_loss)] + #[expect(clippy::cast_precision_loss)] pub fn new(data: &[f64]) -> Option { mean(data).map(|mean| Self { mean }) } @@ -18,7 +18,7 @@ pub fn mean(data: &[f64]) -> Option { if data.is_empty() { None } else { - #[allow(clippy::cast_precision_loss)] + #[expect(clippy::cast_precision_loss)] let mean = data.iter().sum::() / data.len() as f64; mean.is_finite().then_some(mean) } @@ -37,7 +37,7 @@ fn variance(location: f64, data: &[f64]) -> Option { if data.len() < 2 { None } else { - #[allow(clippy::cast_precision_loss)] + #[expect(clippy::cast_precision_loss)] Some( data.iter() .map(|&value| (value - location).powi(2)) @@ -49,7 +49,7 @@ fn variance(location: f64, data: &[f64]) -> Option { } #[cfg(test)] -#[allow(clippy::float_cmp, clippy::unreadable_literal, clippy::unwrap_used)] +#[expect(clippy::float_cmp, clippy::unreadable_literal, clippy::unwrap_used)] mod test { use std::sync::LazyLock; @@ -308,7 +308,7 @@ mod test { } #[test] - #[allow(clippy::approx_constant)] + #[expect(clippy::approx_constant)] fn test_std_dev_two() { let std_dev = MEAN_ZERO.std_deviation(DATA_TWO).unwrap(); assert_eq!(std_dev, 1.5811388300841898); @@ -345,7 +345,7 @@ mod test { } #[test] - #[allow(clippy::approx_constant)] + #[expect(clippy::approx_constant)] fn test_std_dev_five() { let std_dev = MEAN_ZERO.std_deviation(DATA_FIVE).unwrap(); assert_eq!(std_dev, 3.3166247903554); @@ -364,7 +364,7 @@ mod test { } #[test] - #[allow(clippy::approx_constant)] + #[expect(clippy::approx_constant)] fn test_std_dev_five_desc() { let std_dev = MEAN_ZERO.std_deviation(DATA_FIVE_DESC).unwrap(); assert_eq!(std_dev, 3.3166247903554); @@ -383,7 +383,7 @@ mod test { } #[test] - #[allow(clippy::approx_constant)] + #[expect(clippy::approx_constant)] fn test_std_dev_five_neg() { let std_dev = MEAN_ZERO.std_deviation(DATA_FIVE_NEG).unwrap(); assert_eq!(std_dev, 3.3166247903554); diff --git a/lib/bencher_boundary/src/quartiles.rs b/lib/bencher_boundary/src/quartiles.rs index 7c2fa98b1..e0cafcbc1 100644 --- a/lib/bencher_boundary/src/quartiles.rs +++ b/lib/bencher_boundary/src/quartiles.rs @@ -10,7 +10,7 @@ pub struct Quartiles { } impl Quartiles { - #[allow(clippy::indexing_slicing, clippy::integer_division)] + #[expect(clippy::indexing_slicing, clippy::integer_division)] pub fn new(data: &[f64]) -> Option { if data.is_empty() { return None; @@ -57,7 +57,7 @@ impl Quartiles { Self::percentile_of_sorted(data, 0.75).and_then(|q| q.is_finite().then_some(q)) } - #[allow( + #[expect( clippy::cast_possible_truncation, clippy::cast_precision_loss, clippy::cast_sign_loss, @@ -89,7 +89,7 @@ impl Quartiles { // https://github.com/rust-lang/rustc-perf/blob/4f313add609f43e928e98132358e8426ed3969ae/site/src/comparison.rs#L1219 fn percent_changes(data: &[f64]) -> Vec { const WINDOW_SIZE: usize = 2; - #[allow(clippy::indexing_slicing, clippy::missing_asserts_for_indexing)] + #[expect(clippy::indexing_slicing, clippy::missing_asserts_for_indexing)] let mut changes = data .windows(WINDOW_SIZE) .map(|window| { @@ -111,7 +111,7 @@ impl Quartiles { } #[cfg(test)] -#[allow(clippy::float_cmp, clippy::unreadable_literal, clippy::unwrap_used)] +#[expect(clippy::float_cmp, clippy::unreadable_literal, clippy::unwrap_used)] mod test { use std::sync::LazyLock; diff --git a/lib/bencher_client/build.rs b/lib/bencher_client/build.rs index ab8d8002c..251e4fbe0 100644 --- a/lib/bencher_client/build.rs +++ b/lib/bencher_client/build.rs @@ -1,4 +1,4 @@ -#![allow(let_underscore_drop, clippy::unwrap_used)] +#![expect(let_underscore_drop, clippy::unwrap_used)] #[cfg(unix)] use std::os::unix; diff --git a/lib/bencher_client/src/client.rs b/lib/bencher_client/src/client.rs index e4922e9d0..6662b312d 100644 --- a/lib/bencher_client/src/client.rs +++ b/lib/bencher_client/src/client.rs @@ -1,4 +1,4 @@ -#![allow(clippy::absolute_paths)] +#![expect(clippy::absolute_paths)] use std::env; @@ -13,7 +13,7 @@ const DEFAULT_TIMEOUT: Duration = Duration::from_secs(15); const DEFAULT_ATTEMPTS: usize = 10; const DEFAULT_RETRY_AFTER: u64 = 1; -#[allow(clippy::struct_excessive_bools)] +#[expect(clippy::struct_excessive_bools)] /// A client for the Bencher API #[derive(Debug, Clone)] pub struct BencherClient { @@ -28,7 +28,7 @@ pub struct BencherClient { pub log: bool, } -#[allow(clippy::absolute_paths)] +#[expect(clippy::absolute_paths)] #[derive(thiserror::Error, Debug)] pub enum ClientError { #[error("Failed to build. Missing `host` field.")] @@ -108,7 +108,7 @@ impl BencherClient { pub async fn send(&self, sender: F) -> Result where F: Fn(crate::codegen::Client) -> R, - R: std::future::Future< + R: Future< Output = Result< progenitor_client::ResponseValue, crate::codegen::Error, @@ -133,11 +133,11 @@ impl BencherClient { /// # Returns /// /// A `Result` containing the response JSON or an `Error` - #[allow(clippy::too_many_lines)] + #[expect(clippy::too_many_lines)] pub async fn send_with(&self, sender: F) -> Result where F: Fn(crate::codegen::Client) -> R, - R: std::future::Future< + R: Future< Output = Result< progenitor_client::ResponseValue, crate::codegen::Error, @@ -167,7 +167,7 @@ impl BencherClient { self.log_json(&json_response)?; return Ok(json_response); }, - #[allow(clippy::print_stderr)] + #[expect(clippy::print_stderr)] Err(crate::codegen::Error::CommunicationError(e)) => { if self.log { eprintln!("\nSend attempt #{}/{attempts}: {e}", attempt + 1); @@ -310,7 +310,7 @@ impl BencherClient { } fn log_str(&self, err: &str) { - #[allow(clippy::print_stdout)] + #[expect(clippy::print_stdout)] if self.log { println!("{err}"); } @@ -329,7 +329,7 @@ pub struct ErrorResponse { impl std::fmt::Display for ErrorResponse { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { writeln!(f, "Status: {}", self.status)?; - #[allow(clippy::use_debug)] + #[expect(clippy::use_debug)] writeln!(f, "Headers: {:?}", self.headers)?; writeln!(f, "Request ID: {}", self.request_id)?; if let Some(error_code) = &self.error_code { diff --git a/lib/bencher_client/src/lib.rs b/lib/bencher_client/src/lib.rs index 204914b7f..37bdd0f37 100644 --- a/lib/bencher_client/src/lib.rs +++ b/lib/bencher_client/src/lib.rs @@ -1,5 +1,5 @@ mod codegen { - #![allow( + #![expect( unused_qualifications, variant_size_differences, clippy::all, diff --git a/lib/bencher_client/src/tls.rs b/lib/bencher_client/src/tls.rs index 8711bf81e..fb4fee980 100644 --- a/lib/bencher_client/src/tls.rs +++ b/lib/bencher_client/src/tls.rs @@ -2,7 +2,7 @@ use reqwest::Identity; use std::ffi::OsStr; -use std::io::Read; +use std::io::Read as _; #[derive(thiserror::Error, Debug)] pub(crate) enum CertificateError { diff --git a/lib/bencher_comment/src/lib.rs b/lib/bencher_comment/src/lib.rs index e5acfbb9e..eace18bda 100644 --- a/lib/bencher_comment/src/lib.rs +++ b/lib/bencher_comment/src/lib.rs @@ -629,7 +629,7 @@ impl ReportComment { }) } - #[cfg_attr(not(feature = "plus"), allow(clippy::unused_self))] + #[cfg_attr(not(feature = "plus"), expect(clippy::unused_self))] fn is_bencher_cloud(&self) -> bool { #[cfg(feature = "plus")] { diff --git a/lib/bencher_config/src/config_tx.rs b/lib/bencher_config/src/config_tx.rs index d41d5991f..d73167b5b 100644 --- a/lib/bencher_config/src/config_tx.rs +++ b/lib/bencher_config/src/config_tx.rs @@ -4,30 +4,30 @@ use bencher_endpoint::Registrar; #[cfg(feature = "plus")] use bencher_json::system::config::{JsonLitestream, JsonPlus}; use bencher_json::{ + JsonConfig, system::config::{ IfExists, JsonConsole, JsonDatabase, JsonLogging, JsonSecurity, JsonServer, JsonSmtp, JsonTls, LogLevel, ServerLog, }, - JsonConfig, }; use bencher_rbac::init_rbac; use bencher_schema::context::{ApiContext, Database, DbConnection}; #[cfg(feature = "plus")] use bencher_schema::{context::RateLimiting, model::server::QueryServer}; use bencher_token::TokenKey; +use diesel::Connection as _; #[cfg(feature = "plus")] -use diesel::connection::SimpleConnection; -use diesel::Connection; +use diesel::connection::SimpleConnection as _; use dropshot::{ ApiDescription, ConfigDropshot, ConfigLogging, ConfigLoggingIfExists, ConfigLoggingLevel, ConfigTls, HttpServer, }; -use slog::{debug, error, info, Logger}; +use slog::{Logger, debug, error, info}; use tokio::sync::mpsc::Sender; use super::Config; #[cfg(feature = "plus")] -use super::{plus::Plus, DEFAULT_BUSY_TIMEOUT}; +use super::{DEFAULT_BUSY_TIMEOUT, plus::Plus}; const DATABASE_URL: &str = "DATABASE_URL"; @@ -273,7 +273,12 @@ fn diesel_database_url(log: &Logger, database_path: &str) { debug!(log, "Failed to find \"{DATABASE_URL}\""); } debug!(log, "Setting \"{DATABASE_URL}\" to {database_path}"); - std::env::set_var(DATABASE_URL, database_path); + // SAFETY: This is safe because we are setting the environment variable + // from a single thread at startup. + #[expect(unsafe_code, reason = "set environment variable")] + unsafe { + std::env::set_var(DATABASE_URL, database_path); + } } #[cfg(feature = "plus")] @@ -313,7 +318,7 @@ fn run_litestream( Ok(()) } -#[allow(clippy::needless_pass_by_value)] +#[expect(clippy::needless_pass_by_value)] fn into_config_dropshot(server: JsonServer) -> ConfigDropshot { let JsonServer { bind_address, diff --git a/lib/bencher_config/src/lib.rs b/lib/bencher_config/src/lib.rs index 963397c73..90c2df740 100644 --- a/lib/bencher_config/src/lib.rs +++ b/lib/bencher_config/src/lib.rs @@ -50,7 +50,7 @@ const DEFAULT_LOG_LEVEL: LogLevel = LogLevel::Info; const DEFAULT_BUSY_TIMEOUT: u32 = 5_000; const DEFAULT_CONSOLE_URL_STR: &str = "http://localhost:3000"; -#[allow(clippy::panic)] +#[expect(clippy::panic)] static DEFAULT_CONSOLE_URL: LazyLock = LazyLock::new(|| { DEFAULT_CONSOLE_URL_STR.parse().unwrap_or_else(|e| { panic!("Failed to parse default console URL \"{DEFAULT_CONSOLE_URL_STR}\": {e}") diff --git a/lib/bencher_context/src/client/fingerprint/mod.rs b/lib/bencher_context/src/client/fingerprint/mod.rs index 695c5121e..e4b5d504f 100644 --- a/lib/bencher_context/src/client/fingerprint/mod.rs +++ b/lib/bencher_context/src/client/fingerprint/mod.rs @@ -25,7 +25,7 @@ impl fmt::Display for Fingerprint { not(target_os = "windows") ))] impl Fingerprint { - #[allow(clippy::unnecessary_wraps)] + #[expect(clippy::unnecessary_wraps)] pub fn current() -> Option { None } @@ -42,7 +42,7 @@ fn encode_uuid(uuid: Uuid) -> String { let mut result = String::new(); while num > 0 { - #[allow(clippy::cast_possible_truncation)] + #[expect(clippy::cast_possible_truncation)] let remainder = (num % base) as usize; if let Some(c) = chars.get(remainder) { result.push(*c); @@ -60,7 +60,7 @@ fn encode_uuid(uuid: Uuid) -> String { // https://stackoverflow.com/a/27952689 // https://www.boost.org/doc/libs/1_43_0/doc/html/hash/reference.html#boost.hash_combine // https://softwareengineering.stackexchange.com/a/402543 -#[allow(clippy::unreadable_literal)] +#[expect(clippy::unreadable_literal)] const GOLDEN_RATIO: u64 = 0x9e3779b97f4a7c15; fn hash_combined(lhs: u64, rhs: u64) -> u64 { lhs ^ (rhs diff --git a/lib/bencher_context/src/client/fingerprint/windows.rs b/lib/bencher_context/src/client/fingerprint/windows.rs index 6a56a3d13..5073661bc 100644 --- a/lib/bencher_context/src/client/fingerprint/windows.rs +++ b/lib/bencher_context/src/client/fingerprint/windows.rs @@ -34,7 +34,7 @@ fn digital_product_id() -> Option { // Safety: The accuracy of the data returned by `RegGetValueW` is not of any importance, // rather the consistency of the data is what is important. // https://learn.microsoft.com/en-us/windows/win32/api/winreg/nf-winreg-reggetvaluew - #[allow(unsafe_code)] + #[expect(unsafe_code)] unsafe { RegGetValueW( HKEY_LOCAL_MACHINE, diff --git a/lib/bencher_context/src/client/mod.rs b/lib/bencher_context/src/client/mod.rs index 81576f8f0..58716ae16 100644 --- a/lib/bencher_context/src/client/mod.rs +++ b/lib/bencher_context/src/client/mod.rs @@ -12,7 +12,7 @@ use operating_system::OperatingSystem; const ROOT: &str = "root"; -#[allow(clippy::multiple_inherent_impl)] +#[expect(clippy::multiple_inherent_impl)] impl RunContext { pub fn current() -> Self { let mut context = RunContext::default(); @@ -27,7 +27,7 @@ impl RunContext { } } -#[allow(clippy::implicit_hasher)] +#[expect(clippy::implicit_hasher)] impl From for HashMap { fn from(context: RunContext) -> Self { context.0 diff --git a/lib/bencher_context/src/lib.rs b/lib/bencher_context/src/lib.rs index b85f54054..f39ea0664 100644 --- a/lib/bencher_context/src/lib.rs +++ b/lib/bencher_context/src/lib.rs @@ -17,7 +17,7 @@ const VERSION: &str = "v0"; #[cfg_attr(feature = "schema", derive(JsonSchema))] pub struct RunContext(pub HashMap); -#[allow(clippy::multiple_inherent_impl)] +#[expect(clippy::multiple_inherent_impl)] impl RunContext { fn key(path: &str) -> String { format!("{BENCHER_DEV}/{VERSION}{path}") diff --git a/lib/bencher_context/src/server/mod.rs b/lib/bencher_context/src/server/mod.rs index f5ec36653..dc8622751 100644 --- a/lib/bencher_context/src/server/mod.rs +++ b/lib/bencher_context/src/server/mod.rs @@ -2,7 +2,7 @@ use bencher_valid::{ResourceName, Slug}; use crate::{ContextPath, RunContext}; -#[allow(clippy::multiple_inherent_impl)] +#[expect(clippy::multiple_inherent_impl)] impl RunContext { fn get(&self, path: &str) -> Option<&String> { let key = Self::key(path); @@ -72,7 +72,7 @@ fn truncate_name(name: &str) -> String { const SHORT_NAME_LEN: usize = 42; const SHORT_HASH_LEN: usize = 7; const SHORT_FINGERPRINT_LEN: usize = 13; -#[allow(dead_code)] +#[expect(dead_code)] const DASH_LEN: usize = 1; // Statically assert that the sum of the lengths of the short names diff --git a/lib/bencher_github/src/lib.rs b/lib/bencher_github/src/lib.rs index 74173e98a..5820dc744 100644 --- a/lib/bencher_github/src/lib.rs +++ b/lib/bencher_github/src/lib.rs @@ -3,18 +3,18 @@ use std::sync::LazyLock; use bencher_valid::{Email, NonEmpty, Secret, UserName}; use oauth2::{ basic::BasicClient, reqwest, AuthUrl, AuthorizationCode, ClientId, ClientSecret, - EndpointNotSet, EndpointSet, TokenResponse, TokenUrl, + EndpointNotSet, EndpointSet, TokenResponse as _, TokenUrl, }; use octocrab::Octocrab; use serde::Deserialize; -#[allow(clippy::expect_used)] +#[expect(clippy::expect_used)] static AUTH_URL: LazyLock = LazyLock::new(|| { AuthUrl::new("https://github.com/login/oauth/authorize".to_owned()) .expect("Invalid authorization endpoint URL") }); -#[allow(clippy::expect_used)] +#[expect(clippy::expect_used)] static TOKEN_URL: LazyLock = LazyLock::new(|| { TokenUrl::new("https://github.com/login/oauth/access_token".to_owned()) .expect("Invalid token endpoint URL") @@ -26,7 +26,7 @@ pub struct GitHub { BasicClient, } -#[allow(clippy::absolute_paths)] +#[expect(clippy::absolute_paths)] #[derive(Debug, thiserror::Error)] pub enum GitHubError { #[error("Failed to create a reqwest client: {0}")] @@ -120,6 +120,6 @@ struct GitHubUserEmail { email: String, verified: bool, primary: bool, - #[allow(dead_code)] + #[expect(dead_code)] visibility: Option, } diff --git a/lib/bencher_json/src/lib.rs b/lib/bencher_json/src/lib.rs index 6bf372496..e009b4f54 100644 --- a/lib/bencher_json/src/lib.rs +++ b/lib/bencher_json/src/lib.rs @@ -86,19 +86,19 @@ pub const BENCHER_URL_STR: &str = LOCALHOST_BENCHER_URL_STR; #[cfg(not(debug_assertions))] pub const BENCHER_URL_STR: &str = PROD_BENCHER_URL_STR; -#[allow(clippy::panic)] +#[expect(clippy::panic)] pub static BENCHER_URL: LazyLock = LazyLock::new(|| { BENCHER_URL_STR .parse() .unwrap_or_else(|e| panic!("Failed to parse endpoint \"{BENCHER_URL_STR}\": {e}")) }); -#[allow(clippy::panic)] +#[expect(clippy::panic)] pub static DEVEL_BENCHER_URL: LazyLock = LazyLock::new(|| { DEVEL_BENCHER_URL_STR .parse() .unwrap_or_else(|e| panic!("Failed to parse endpoint \"{DEVEL_BENCHER_URL_STR}\": {e}")) }); -#[allow(clippy::panic)] +#[expect(clippy::panic)] pub static PROD_BENCHER_URL: LazyLock = LazyLock::new(|| { PROD_BENCHER_URL_STR .parse() @@ -127,31 +127,31 @@ pub const BENCHER_API_URL_STR: &str = LOCALHOST_BENCHER_API_URL_STR; #[cfg(not(debug_assertions))] pub const BENCHER_API_URL_STR: &str = PROD_BENCHER_API_URL_STR; -#[allow(clippy::panic)] +#[expect(clippy::panic)] pub static BENCHER_API_URL: LazyLock = LazyLock::new(|| { BENCHER_API_URL_STR .parse() .unwrap_or_else(|e| panic!("Failed to parse endpoint \"{BENCHER_API_URL_STR}\": {e}")) }); -#[allow(clippy::panic)] +#[expect(clippy::panic)] pub static LOCALHOST_BENCHER_API_URL: LazyLock = LazyLock::new(|| { LOCALHOST_BENCHER_API_URL_STR.parse().unwrap_or_else(|e| { panic!("Failed to parse endpoint \"{LOCALHOST_BENCHER_API_URL_STR}\": {e}") }) }); -#[allow(clippy::panic)] +#[expect(clippy::panic)] pub static DEV_BENCHER_API_URL: LazyLock = LazyLock::new(|| { DEV_BENCHER_API_URL_STR .parse() .unwrap_or_else(|e| panic!("Failed to parse endpoint \"{DEV_BENCHER_API_URL_STR}\": {e}")) }); -#[allow(clippy::panic)] +#[expect(clippy::panic)] pub static TEST_BENCHER_API_URL: LazyLock = LazyLock::new(|| { TEST_BENCHER_API_URL_STR .parse() .unwrap_or_else(|e| panic!("Failed to parse endpoint \"{TEST_BENCHER_API_URL_STR}\": {e}")) }); -#[allow(clippy::panic)] +#[expect(clippy::panic)] pub static PROD_BENCHER_API_URL: LazyLock = LazyLock::new(|| { PROD_BENCHER_API_URL_STR .parse() diff --git a/lib/bencher_json/src/project/boundary.rs b/lib/bencher_json/src/project/boundary.rs index 34d246d07..e378f6f78 100644 --- a/lib/bencher_json/src/project/boundary.rs +++ b/lib/bencher_json/src/project/boundary.rs @@ -61,7 +61,7 @@ mod boundary_limit { bool: diesel::deserialize::FromSql, { fn from_sql(bytes: DB::RawValue<'_>) -> diesel::deserialize::Result { - #[allow(clippy::match_bool)] + #[expect(clippy::match_bool)] match bool::from_sql(bytes)? { LOWER_BOOL => Ok(Self::Lower), UPPER_BOOL => Ok(Self::Upper), diff --git a/lib/bencher_json/src/project/branch.rs b/lib/bencher_json/src/project/branch.rs index 70c32ceab..cf8c19add 100644 --- a/lib/bencher_json/src/project/branch.rs +++ b/lib/bencher_json/src/project/branch.rs @@ -13,19 +13,19 @@ crate::typed_uuid::typed_uuid!(BranchUuid); pub const START_POINT_MAX_VERSIONS: u32 = 255; pub const BRANCH_MAIN_STR: &str = "main"; -#[allow(clippy::expect_used)] +#[expect(clippy::expect_used)] pub static DEFAULT_BRANCH: LazyLock = LazyLock::new(|| { BRANCH_MAIN_STR .parse() .expect("Failed to parse branch name.") }); -#[allow(clippy::expect_used)] +#[expect(clippy::expect_used)] static BRANCH_MAIN: LazyLock = LazyLock::new(|| { BRANCH_MAIN_STR .parse() .expect("Failed to parse branch name.") }); -#[allow(clippy::expect_used)] +#[expect(clippy::expect_used)] static BRANCH_MAIN_SLUG: LazyLock> = LazyLock::new(|| { Some( BRANCH_MAIN_STR diff --git a/lib/bencher_json/src/project/measure/mod.rs b/lib/bencher_json/src/project/measure/mod.rs index e08c76c45..f66709327 100644 --- a/lib/bencher_json/src/project/measure/mod.rs +++ b/lib/bencher_json/src/project/measure/mod.rs @@ -1,4 +1,4 @@ -#![allow(clippy::expect_used)] +#![expect(clippy::expect_used)] use std::fmt; diff --git a/lib/bencher_json/src/project/metric/median.rs b/lib/bencher_json/src/project/metric/median.rs index ec5df2aa7..22352e793 100644 --- a/lib/bencher_json/src/project/metric/median.rs +++ b/lib/bencher_json/src/project/metric/median.rs @@ -1,5 +1,5 @@ pub trait Median { - #[allow(clippy::indexing_slicing, clippy::integer_division)] + #[expect(clippy::indexing_slicing, clippy::integer_division)] fn median(mut array: Vec) -> Option where Self: diff --git a/lib/bencher_json/src/project/metric/mod.rs b/lib/bencher_json/src/project/metric/mod.rs index ee19a7132..4c19f5cc1 100644 --- a/lib/bencher_json/src/project/metric/mod.rs +++ b/lib/bencher_json/src/project/metric/mod.rs @@ -141,7 +141,7 @@ impl Sum for JsonNewMetric { impl std::ops::Div for JsonNewMetric { type Output = Self; - #[allow(clippy::cast_precision_loss)] + #[expect(clippy::cast_precision_loss)] fn div(self, rhs: usize) -> Self::Output { Self { value: self.value / rhs as f64, diff --git a/lib/bencher_json/src/project/perf.rs b/lib/bencher_json/src/project/perf.rs index bb66307fa..7e816029a 100644 --- a/lib/bencher_json/src/project/perf.rs +++ b/lib/bencher_json/src/project/perf.rs @@ -1,6 +1,6 @@ #[cfg(feature = "schema")] use schemars::JsonSchema; -use serde::ser::{self, SerializeStruct}; +use serde::ser::{self, SerializeStruct as _}; use serde::{Deserialize, Serialize, Serializer}; use url::Url; diff --git a/lib/bencher_json/src/project/plot.rs b/lib/bencher_json/src/project/plot.rs index 690fcf80c..cdf549a0b 100644 --- a/lib/bencher_json/src/project/plot.rs +++ b/lib/bencher_json/src/project/plot.rs @@ -15,7 +15,7 @@ crate::typed_uuid::typed_uuid!(PlotUuid); #[typeshare::typeshare] #[derive(Debug, Clone, Serialize, Deserialize)] #[cfg_attr(feature = "schema", derive(JsonSchema))] -#[allow(clippy::struct_excessive_bools)] +#[expect(clippy::struct_excessive_bools)] pub struct JsonNewPlot { /// The index of the plot. /// Maximum index is 64. @@ -59,7 +59,7 @@ crate::from_vec!(JsonPlots[JsonPlot]); #[typeshare::typeshare] #[derive(Debug, Clone, Deserialize, Serialize)] #[cfg_attr(feature = "schema", derive(JsonSchema))] -#[allow(clippy::struct_excessive_bools)] +#[expect(clippy::struct_excessive_bools)] pub struct JsonPlot { pub uuid: PlotUuid, pub project: ProjectUuid, diff --git a/lib/bencher_json/src/project/testbed.rs b/lib/bencher_json/src/project/testbed.rs index c436e3e9a..982c228e1 100644 --- a/lib/bencher_json/src/project/testbed.rs +++ b/lib/bencher_json/src/project/testbed.rs @@ -9,19 +9,19 @@ use serde::{Deserialize, Serialize}; use crate::ProjectUuid; pub const TESTBED_LOCALHOST_STR: &str = "localhost"; -#[allow(clippy::expect_used)] +#[expect(clippy::expect_used)] pub static DEFAULT_TESTBED: LazyLock = LazyLock::new(|| { TESTBED_LOCALHOST_STR .parse() .expect("Failed to parse testbed name.") }); -#[allow(clippy::expect_used)] +#[expect(clippy::expect_used)] static TESTBED_LOCALHOST: LazyLock = LazyLock::new(|| { TESTBED_LOCALHOST_STR .parse() .expect("Failed to parse testbed name.") }); -#[allow(clippy::expect_used)] +#[expect(clippy::expect_used)] static TESTBED_LOCALHOST_SLUG: LazyLock> = LazyLock::new(|| { Some( TESTBED_LOCALHOST_STR diff --git a/lib/bencher_json/src/system/config/logging.rs b/lib/bencher_json/src/system/config/logging.rs index c58c5b863..d2fb6d50b 100644 --- a/lib/bencher_json/src/system/config/logging.rs +++ b/lib/bencher_json/src/system/config/logging.rs @@ -12,7 +12,7 @@ pub struct JsonLogging { #[derive(Debug, Clone, Serialize, Deserialize)] #[cfg_attr(feature = "schema", derive(JsonSchema))] #[serde(rename_all = "snake_case")] -#[allow(variant_size_differences)] +#[expect(variant_size_differences)] pub enum ServerLog { StderrTerminal { level: LogLevel, diff --git a/lib/bencher_json/src/system/config/plus/litestream.rs b/lib/bencher_json/src/system/config/plus/litestream.rs index 5f9744866..e7e9365ba 100644 --- a/lib/bencher_json/src/system/config/plus/litestream.rs +++ b/lib/bencher_json/src/system/config/plus/litestream.rs @@ -284,7 +284,7 @@ mod db { } impl From for LitestreamReplica { - #[allow(clippy::too_many_lines)] + #[expect(clippy::too_many_lines)] fn from(replica: JsonReplica) -> Self { match replica { JsonReplica::File { diff --git a/lib/bencher_json/src/typed_uuid.rs b/lib/bencher_json/src/typed_uuid.rs index 5d4cc32e5..43321ce8a 100644 --- a/lib/bencher_json/src/typed_uuid.rs +++ b/lib/bencher_json/src/typed_uuid.rs @@ -1,6 +1,6 @@ // This exists solely to export a `Uuid` type to Typescript that then aliases to `string`. #[typeshare::typeshare] -#[allow(dead_code)] +#[expect(dead_code)] pub struct Uuid(pub uuid::Uuid); macro_rules! typed_uuid { @@ -22,38 +22,38 @@ macro_rules! typed_uuid { #[cfg_attr(feature = "schema", derive(JsonSchema))] #[cfg_attr(feature = "db", derive(diesel::FromSqlRow, diesel::AsExpression))] #[cfg_attr(feature = "db", diesel(sql_type = diesel::sql_types::Text))] - #[allow(unused_qualifications)] + #[expect(unused_qualifications)] pub struct $name(uuid::Uuid); - #[allow(unused_qualifications)] + #[expect(unused_qualifications)] impl From<$name> for uuid::Uuid { fn from(uuid: $name) -> Self { uuid.0 } } - #[allow(unused_qualifications)] + #[expect(unused_qualifications)] impl From for $name { fn from(uuid: uuid::Uuid) -> Self { Self(uuid) } } - #[allow(unused_qualifications)] + #[expect(unused_qualifications)] impl From<$name> for crate::ResourceId { fn from(uuid: $name) -> Self { uuid.0.into() } } - #[allow(unused_qualifications)] + #[expect(unused_qualifications)] impl From<$name> for crate::NameId { fn from(uuid: $name) -> Self { uuid.0.into() } } - #[allow(unused_qualifications)] + #[expect(unused_qualifications)] impl std::str::FromStr for $name { type Err = uuid::Error; @@ -62,7 +62,7 @@ macro_rules! typed_uuid { } } - #[allow(unused_qualifications)] + #[expect(unused_qualifications)] impl AsRef for $name { fn as_ref(&self) -> &uuid::Uuid { &self.0 @@ -70,7 +70,7 @@ macro_rules! typed_uuid { } impl $name { - #[allow(unused_qualifications)] + #[expect(unused_qualifications)] pub fn new() -> Self { Self(uuid::Uuid::new_v4()) } diff --git a/lib/bencher_json/src/urlencoded.rs b/lib/bencher_json/src/urlencoded.rs index 7de4f4e0e..97cbd5e7b 100644 --- a/lib/bencher_json/src/urlencoded.rs +++ b/lib/bencher_json/src/urlencoded.rs @@ -81,7 +81,7 @@ where { let decoded = percent_decode(input.as_bytes()); let decoded = decoded.decode_utf8()?; - #[allow(clippy::map_err_ignore)] + #[expect(clippy::map_err_ignore)] decoded .parse() .map_err(|_| UrlEncodedError::Urlencoded(input.into())) diff --git a/lib/bencher_logger/src/lib.rs b/lib/bencher_logger/src/lib.rs index 141bb4f65..0bc29c197 100644 --- a/lib/bencher_logger/src/lib.rs +++ b/lib/bencher_logger/src/lib.rs @@ -1,6 +1,6 @@ use std::sync::Mutex; -use slog::{Drain, Logger}; +use slog::{Drain as _, Logger}; pub fn bootstrap_logger() -> Logger { let decorator = slog_term::TermDecorator::new().build(); diff --git a/lib/bencher_plot/src/line.rs b/lib/bencher_plot/src/line.rs index 6204cbf94..d5de1320e 100644 --- a/lib/bencher_plot/src/line.rs +++ b/lib/bencher_plot/src/line.rs @@ -2,19 +2,19 @@ use crate::PlotError; use bencher_json::{project::perf::JsonPerfMetrics, JsonPerf}; use bencher_json::{JsonMeasure, Units}; use chrono::{DateTime, Duration, Utc}; -use image::{GenericImageView, ImageBuffer}; -use ordered_float::{FloatCore, OrderedFloat}; +use image::{GenericImageView as _, ImageBuffer}; +use ordered_float::{FloatCore as _, OrderedFloat}; use plotters::chart::{ChartContext, DualCoordChartContext}; use plotters::coord::ranged1d::{DefaultFormatting, KeyPointHint}; -use plotters::prelude::{Cartesian2d, IntoLogRange, LogCoord, RangedDateTime}; +use plotters::prelude::{Cartesian2d, IntoLogRange as _, LogCoord, RangedDateTime}; use plotters::{ coord::{types::RangedCoordf64, Shift}, prelude::{ - BitMapBackend, BitMapElement, ChartBuilder, DrawingArea, IntoDrawingArea, MultiLineText, + BitMapBackend, BitMapElement, ChartBuilder, DrawingArea, IntoDrawingArea as _, MultiLineText, Ranged, Rectangle, }, series::LineSeries, - style::{Color, FontFamily, RGBColor, ShapeStyle, WHITE}, + style::{Color as _, FontFamily, RGBColor, ShapeStyle, WHITE}, }; use std::sync::LazyLock; use std::{io::Cursor, ops::Range}; @@ -37,7 +37,7 @@ const BUFFER_SIZE: usize = IMG_WIDTH as usize * IMG_HEIGHT as usize * 3; const MAX_LINES: usize = 10; pub const BENCHER_WORDMARK: &[u8; 4406] = include_bytes!("../wordmark.png"); -#[allow(clippy::expect_used)] +#[expect(clippy::expect_used)] static WORDMARK_ELEMENT: LazyLock> = LazyLock::new(|| { let wordmark_cursor = Cursor::new(BENCHER_WORDMARK); let wordmark_image = @@ -201,7 +201,7 @@ impl From> for RangedCoord { } // https://github.com/plotters-rs/plotters/blob/v0.3.7/plotters/examples/two-scales.rs -#[allow(clippy::large_enum_variant, clippy::type_complexity)] +#[expect(clippy::large_enum_variant, clippy::type_complexity)] enum Chart<'b> { Single( ChartContext< @@ -243,13 +243,13 @@ impl<'b> Chart<'b> { }) } - #[allow(clippy::items_after_statements)] + #[expect(clippy::items_after_statements)] fn layout_plot(&mut self, perf_data: &PerfData) -> Result<(), PlotError> { const AXIS_DESC_STYLE: (FontFamily, u32) = (FontFamily::Monospace, 20); const X_DESC: &str = "Benchmark Date and Time"; let x_labels = usize::try_from(X_LABELS)?; const X_LABEL_STYLE: (FontFamily, u32) = (FontFamily::Monospace, 16); - #[allow(clippy::type_complexity)] + #[expect(clippy::type_complexity)] let x_label_formatter: Box) -> String> = Box::new(move |x| perf_data.x_label_fmt(x)); const Y_LABEL_STYLE: (FontFamily, u32) = (FontFamily::Monospace, 12); @@ -490,7 +490,7 @@ impl PerfData { (factor, y_desc) } - #[allow(clippy::cast_possible_truncation, clippy::cast_precision_loss)] + #[expect(clippy::cast_possible_truncation, clippy::cast_precision_loss)] fn x_range(&self) -> Range> { let diff = Duration::seconds(((self.x.1 - self.x.0).num_seconds() as f64 * 0.04) as i64); self.x.0..(self.x.1 + diff) @@ -590,7 +590,7 @@ impl PerfData { let box_x_left = std::cmp::max(MIN_GAP, KEY_LEFT_MARGIN - (extra_lines * 8)); let box_gap = std::cmp::max(MIN_GAP, BOX_GAP - extra_lines); let box_gaps = lines_len * box_gap; - #[allow(clippy::integer_division)] + #[expect(clippy::integer_division)] let width = (usize::try_from(IMG_WIDTH)? - box_x_left - box_gaps) / lines_len; (box_x_left, width, box_gap) } else { @@ -765,7 +765,7 @@ const TABLEAU_10: [(u8, u8, u8); 10] = [ // #bab0ab (186, 176, 171), ]; -#[allow(clippy::expect_used)] +#[expect(clippy::expect_used)] static TABLEAU_10_RGB: LazyLock<[RGBColor; 10]> = LazyLock::new(|| { TABLEAU_10 .into_iter() @@ -776,7 +776,7 @@ static TABLEAU_10_RGB: LazyLock<[RGBColor; 10]> = LazyLock::new(|| { }); impl LineData { - #[allow(clippy::indexing_slicing)] + #[expect(clippy::indexing_slicing)] fn color(index: usize) -> RGBColor { TABLEAU_10_RGB[index % 10] } @@ -790,9 +790,9 @@ impl LineData { } #[cfg(test)] -#[allow(clippy::expect_used, clippy::unwrap_used)] +#[expect(clippy::expect_used, clippy::unwrap_used)] mod test { - use std::{fs::File, io::Write, sync::LazyLock}; + use std::{fs::File, io::Write as _, sync::LazyLock}; use bencher_json::JsonPerf; diff --git a/lib/bencher_rank/src/generator.rs b/lib/bencher_rank/src/generator.rs index 2778abe4b..4ad615cef 100644 --- a/lib/bencher_rank/src/generator.rs +++ b/lib/bencher_rank/src/generator.rs @@ -9,7 +9,7 @@ pub struct RankGenerator { impl RankGenerator { pub fn new(len: usize) -> Self { // This will provide equal spacing between ranks, including at the beginning and end. - #[allow(clippy::cast_possible_wrap, clippy::integer_division)] + #[expect(clippy::cast_possible_wrap, clippy::integer_division)] let offset = i64::MAX / (len + 1) as i64; Self { offset, @@ -22,7 +22,7 @@ impl RankGenerator { impl Iterator for RankGenerator { type Item = Rank; - #[allow(clippy::cast_possible_wrap)] + #[expect(clippy::cast_possible_wrap)] fn next(&mut self) -> Option { if self.count >= self.len { return None; @@ -42,7 +42,7 @@ mod test { use super::RankGenerator; #[test] - #[allow(clippy::decimal_literal_representation)] + #[expect(clippy::decimal_literal_representation)] fn test_rank_generator() { let mut generator = RankGenerator::new(5); assert_eq!(generator.next(), Some(Rank(1_537_228_672_809_129_301))); diff --git a/lib/bencher_rank/src/lib.rs b/lib/bencher_rank/src/lib.rs index f5b1dcdd4..947b0773a 100644 --- a/lib/bencher_rank/src/lib.rs +++ b/lib/bencher_rank/src/lib.rs @@ -3,7 +3,7 @@ mod generator; pub use generator::RankGenerator; -#[allow(clippy::integer_division)] +#[expect(clippy::integer_division)] const MID_RANK: i64 = i64::MAX / 2; #[derive( @@ -32,7 +32,7 @@ impl Rank { R: Ranked, { // The window size is 2. - #[allow(clippy::indexing_slicing)] + #[expect(clippy::indexing_slicing)] ranks.windows(2).all(|w| { assert!(w.len() == 2, "window size is not 2"); w[0].rank() <= w[1].rank() @@ -52,7 +52,7 @@ impl Rank { 0 => { let first = ranks.first()?.rank().0; // This is okay because we make sure that the new rank is less than the first rank. - #[allow(clippy::integer_division)] + #[expect(clippy::integer_division)] let new_first = first / 2; if new_first < first { return Some(Rank(new_first)); @@ -61,7 +61,7 @@ impl Rank { _ if index >= ranks.len() => { let last = ranks.last()?.rank().0; // This is okay because we make sure that the new rank is greater than the last rank. - #[allow(clippy::integer_division)] + #[expect(clippy::integer_division)] let new_last = last + ((i64::MAX - last) / 2); if new_last > last { return Some(Rank(new_last)); @@ -71,7 +71,7 @@ impl Rank { let prev_rank = ranks.get(index - 1)?.rank().0; let next_rank = ranks.get(index)?.rank().0; // This is okay because we make sure that the new rank is between the previous and next rank. - #[allow(clippy::integer_division)] + #[expect(clippy::integer_division)] let new_rank = prev_rank + ((next_rank - prev_rank) / 2); if new_rank > prev_rank && new_rank < next_rank { return Some(Rank(new_rank)); @@ -113,7 +113,7 @@ mod tests { } #[test] - #[allow(clippy::decimal_literal_representation)] + #[expect(clippy::decimal_literal_representation)] fn test_rank_calculate() { let ranks = vec![ TestRank::new(0), diff --git a/lib/bencher_rbac/bencher.polar b/lib/bencher_rbac/bencher.polar index a87b0b2ae..dbbc2a9c9 100644 --- a/lib/bencher_rbac/bencher.polar +++ b/lib/bencher_rbac/bencher.polar @@ -1,4 +1,4 @@ -allow(actor, action, resource) if +expect(actor, action, resource) if has_permission(actor, action, resource); actor User {} diff --git a/lib/bencher_rbac/src/lib.rs b/lib/bencher_rbac/src/lib.rs index 6f2163ef9..ead8d5ec7 100644 --- a/lib/bencher_rbac/src/lib.rs +++ b/lib/bencher_rbac/src/lib.rs @@ -1,4 +1,4 @@ -use oso::{ClassBuilder, Oso, PolarClass}; +use oso::{ClassBuilder, Oso, PolarClass as _}; pub mod organization; pub mod project; @@ -38,7 +38,7 @@ pub fn init_rbac() -> oso::Result { } #[cfg(test)] -#[allow(clippy::expect_used, clippy::unwrap_used)] +#[expect(clippy::expect_used, clippy::unwrap_used)] mod test { use std::collections::HashMap; use std::sync::LazyLock; @@ -56,7 +56,7 @@ mod test { static OSO: LazyLock = LazyLock::new(|| init_rbac().expect(OSO_ERROR)); #[test] - #[allow(clippy::too_many_lines)] + #[expect(clippy::too_many_lines)] fn test_rbac() { let oso = &*OSO; diff --git a/lib/bencher_schema/src/context/messenger/body/button.rs b/lib/bencher_schema/src/context/messenger/body/button.rs index 78f01f854..495d91e9c 100644 --- a/lib/bencher_schema/src/context/messenger/body/button.rs +++ b/lib/bencher_schema/src/context/messenger/body/button.rs @@ -38,7 +38,7 @@ impl FmtBody for ButtonBody { } // https://github.com/leemunroe/responsive-html-email-template - #[allow(clippy::too_many_lines)] + #[expect(clippy::too_many_lines)] fn html(&self, log: &Logger) -> String { let Self { title, diff --git a/lib/bencher_schema/src/context/messenger/body/new_user.rs b/lib/bencher_schema/src/context/messenger/body/new_user.rs index 9dd0434e8..17823e9c9 100644 --- a/lib/bencher_schema/src/context/messenger/body/new_user.rs +++ b/lib/bencher_schema/src/context/messenger/body/new_user.rs @@ -27,14 +27,14 @@ impl FmtBody for NewUserBody { method, } = self; format!( - r#"Ahoy {admin}, + "Ahoy {admin}, A new user {invited_or_joined} your Bencher instance ({console_url}) via {method}! Name: {name} Email: {email} 🐰 Bencher - "#, + ", invited_or_joined = invited_or_joined(*invited) ) } diff --git a/lib/bencher_schema/src/context/messenger/email.rs b/lib/bencher_schema/src/context/messenger/email.rs index 69b47dd92..5f3a3f515 100644 --- a/lib/bencher_schema/src/context/messenger/email.rs +++ b/lib/bencher_schema/src/context/messenger/email.rs @@ -6,7 +6,7 @@ use mail_send::{mail_builder::MessageBuilder, SmtpClientBuilder}; use slog::{error, trace, Logger}; use tokio::sync::Mutex; -use super::body::FmtBody; +use super::body::FmtBody as _; use super::Message; pub const DEFAULT_SMTP_PORT: u16 = 587; diff --git a/lib/bencher_schema/src/context/rbac.rs b/lib/bencher_schema/src/context/rbac.rs index 659a3d5ff..4466d1d8b 100644 --- a/lib/bencher_schema/src/context/rbac.rs +++ b/lib/bencher_schema/src/context/rbac.rs @@ -1,4 +1,4 @@ -use bencher_json::Sanitize; +use bencher_json::Sanitize as _; use bencher_rbac::{Organization, Project}; use oso::{Oso, ToPolar}; diff --git a/lib/bencher_schema/src/context/stats.rs b/lib/bencher_schema/src/context/stats.rs index e6910a5db..6a3062af2 100644 --- a/lib/bencher_schema/src/context/stats.rs +++ b/lib/bencher_schema/src/context/stats.rs @@ -4,7 +4,7 @@ use bencher_json::system::config::JsonStats; use chrono::NaiveTime; // Run at 03:07:22 UTC by default (offset 11,242 seconds) -#[allow(clippy::expect_used)] +#[expect(clippy::expect_used)] static DEFAULT_STATS_OFFSET: LazyLock = LazyLock::new(|| NaiveTime::from_hms_opt(3, 7, 22).expect("Invalid default stats offset")); // Default stats to enabled diff --git a/lib/bencher_schema/src/error.rs b/lib/bencher_schema/src/error.rs index 57a2a5257..56c51ec4e 100644 --- a/lib/bencher_schema/src/error.rs +++ b/lib/bencher_schema/src/error.rs @@ -221,7 +221,7 @@ macro_rules! resource_not_found_err { // Get one ($resource:ident, $value:expr) => { |e| { - #[allow(unused_qualifications)] + #[expect(unused_qualifications)] $crate::error::resource_not_found_error( $crate::error::BencherResource::$resource, &$value, @@ -237,7 +237,7 @@ pub use resource_not_found_err; macro_rules! resource_conflict_err { ($resource:ident, $value:expr) => { |e| { - #[allow(unused_qualifications)] + #[expect(unused_qualifications)] $crate::error::resource_conflict_error( $crate::error::BencherResource::$resource, &$value, @@ -295,7 +295,7 @@ fn cors_headers(mut http_error: HttpError) -> HttpError { } const GITHUB_ISSUE_URL_STR: &str = "https://github.com/bencherdev/bencher/issues/new"; -#[allow(clippy::expect_used)] +#[expect(clippy::expect_used)] pub static GITHUB_ISSUE_URL: LazyLock = LazyLock::new(|| GITHUB_ISSUE_URL_STR.parse().expect(GITHUB_ISSUE_URL_STR)); diff --git a/lib/bencher_schema/src/lib.rs b/lib/bencher_schema/src/lib.rs index eb9001b37..37d5711d9 100644 --- a/lib/bencher_schema/src/lib.rs +++ b/lib/bencher_schema/src/lib.rs @@ -1,15 +1,15 @@ -#![allow(clippy::result_large_err)] +#![expect(clippy::result_large_err)] -use diesel::connection::SimpleConnection; -use diesel_migrations::{embed_migrations, EmbeddedMigrations, MigrationHarness}; +use diesel::connection::SimpleConnection as _; +use diesel_migrations::{embed_migrations, EmbeddedMigrations, MigrationHarness as _}; pub mod context; pub mod error; pub mod macros; pub mod model; -#[allow(unused_qualifications)] +#[expect(unused_qualifications)] pub mod schema; -#[allow(unused_qualifications)] +#[expect(unused_qualifications)] pub mod view; pub use context::ApiContext; diff --git a/lib/bencher_schema/src/macros/fn_get.rs b/lib/bencher_schema/src/macros/fn_get.rs index f790a087f..8a471aa24 100644 --- a/lib/bencher_schema/src/macros/fn_get.rs +++ b/lib/bencher_schema/src/macros/fn_get.rs @@ -1,11 +1,11 @@ macro_rules! fn_get { ($table:ident, $id:ident) => { - #[allow(unused_qualifications)] + #[expect(unused_qualifications)] pub fn get( conn: &mut $crate::context::DbConnection, id: $id, ) -> Result { - use diesel::{ExpressionMethods, QueryDsl, RunQueryDsl}; + use diesel::{ExpressionMethods as _, QueryDsl as _, RunQueryDsl as _}; $crate::schema::$table::table .filter($crate::schema::$table::id.eq(id)) .first(conn) @@ -24,12 +24,12 @@ pub(crate) use fn_get; macro_rules! fn_get_id { ($table:ident, $id:ident, $uuid:ident) => { - #[allow(unused_qualifications)] + #[expect(unused_qualifications)] pub fn get_id( conn: &mut $crate::context::DbConnection, uuid: $uuid, ) -> Result<$id, dropshot::HttpError> { - use diesel::{ExpressionMethods, QueryDsl, RunQueryDsl}; + use diesel::{ExpressionMethods as _, QueryDsl as _, RunQueryDsl as _}; $crate::schema::$table::table .filter($crate::schema::$table::uuid.eq(uuid)) .select($crate::schema::$table::id) @@ -49,12 +49,12 @@ pub(crate) use fn_get_id; macro_rules! fn_get_uuid { ($table:ident, $id:ident, $uuid:ident) => { - #[allow(unused_qualifications)] + #[expect(unused_qualifications)] pub fn get_uuid( conn: &mut $crate::context::DbConnection, id: $id, ) -> Result<$uuid, dropshot::HttpError> { - use diesel::{ExpressionMethods, QueryDsl, RunQueryDsl}; + use diesel::{ExpressionMethods as _, QueryDsl as _, RunQueryDsl as _}; $crate::schema::$table::table .filter($crate::schema::$table::id.eq(id)) .select($crate::schema::$table::uuid) @@ -74,13 +74,13 @@ pub(crate) use fn_get_uuid; macro_rules! fn_from_uuid { ($parent:ident, $parent_type:ty, $table:ident, $uuid:ident, $resource:ident) => { - #[allow(unused_qualifications)] + #[expect(unused_qualifications)] pub fn from_uuid( conn: &mut DbConnection, parent: $parent_type, uuid: $uuid, ) -> Result { - use diesel::{ExpressionMethods, QueryDsl, RunQueryDsl}; + use diesel::{ExpressionMethods as _, QueryDsl as _, RunQueryDsl as _}; $crate::schema::$table::table .filter($crate::schema::$table::$parent.eq(parent)) .filter($crate::schema::$table::uuid.eq(uuid)) diff --git a/lib/bencher_schema/src/macros/name_id.rs b/lib/bencher_schema/src/macros/name_id.rs index be28f124b..23fd863b3 100644 --- a/lib/bencher_schema/src/macros/name_id.rs +++ b/lib/bencher_schema/src/macros/name_id.rs @@ -1,6 +1,6 @@ macro_rules! fn_eq_name_id { ($name:ident, $table:ident) => { - #[allow(unused_qualifications)] + #[expect(unused_qualifications)] pub fn eq_name_id( name_id: &bencher_json::NameId, ) -> Result< @@ -41,7 +41,7 @@ pub(crate) use fn_eq_name_id; macro_rules! fn_from_name_id { ($table:ident, $resource:ident) => { - #[allow(unused_qualifications)] + #[expect(unused_qualifications)] pub fn from_name_id( conn: &mut crate::context::DbConnection, project_id: crate::model::project::ProjectId, diff --git a/lib/bencher_schema/src/macros/resource_id.rs b/lib/bencher_schema/src/macros/resource_id.rs index 3d166021d..1f8ecc511 100644 --- a/lib/bencher_schema/src/macros/resource_id.rs +++ b/lib/bencher_schema/src/macros/resource_id.rs @@ -1,6 +1,6 @@ macro_rules! fn_eq_resource_id { ($table:ident) => { - #[allow(unused_qualifications)] + #[expect(unused_qualifications)] pub fn eq_resource_id( resource_id: &bencher_json::ResourceId, ) -> Result< @@ -37,7 +37,7 @@ pub(crate) use fn_eq_resource_id; macro_rules! fn_from_resource_id { ($parent:ident, $parent_type:ty, $table:ident, $resource:ident) => { - #[allow(unused_qualifications)] + #[expect(unused_qualifications)] pub fn from_resource_id( conn: &mut $crate::context::DbConnection, parent: $parent_type, @@ -54,7 +54,7 @@ macro_rules! fn_from_resource_id { } }; ($table:ident, $resource:ident) => { - #[allow(unused_qualifications)] + #[expect(unused_qualifications)] pub fn from_resource_id( conn: &mut $crate::context::DbConnection, resource_id: &bencher_json::ResourceId, diff --git a/lib/bencher_schema/src/model/organization/mod.rs b/lib/bencher_schema/src/model/organization/mod.rs index 377154891..7368c68a3 100644 --- a/lib/bencher_schema/src/model/organization/mod.rs +++ b/lib/bencher_schema/src/model/organization/mod.rs @@ -1,4 +1,4 @@ -use std::string::ToString; +use std::string::ToString as _; use bencher_json::{ organization::{ @@ -9,7 +9,7 @@ use bencher_json::{ ResourceName, Slug, }; use bencher_rbac::{organization::Permission, Organization}; -use diesel::{ExpressionMethods, QueryDsl, Queryable, RunQueryDsl}; +use diesel::{ExpressionMethods as _, QueryDsl as _, Queryable, RunQueryDsl as _}; use dropshot::HttpError; use organization_role::{InsertOrganizationRole, QueryOrganizationRole}; diff --git a/lib/bencher_schema/src/model/organization/organization_role.rs b/lib/bencher_schema/src/model/organization/organization_role.rs index f90c432a1..57c80e870 100644 --- a/lib/bencher_schema/src/model/organization/organization_role.rs +++ b/lib/bencher_schema/src/model/organization/organization_role.rs @@ -3,7 +3,7 @@ use bencher_json::{ DateTime, Jwt, }; use bencher_token::TokenKey; -use diesel::{ExpressionMethods, QueryDsl, RunQueryDsl}; +use diesel::{ExpressionMethods as _, QueryDsl as _, RunQueryDsl as _}; use dropshot::HttpError; use super::{OrganizationId, QueryOrganization}; diff --git a/lib/bencher_schema/src/model/organization/plan.rs b/lib/bencher_schema/src/model/organization/plan.rs index 3a3a91063..072122db3 100644 --- a/lib/bencher_schema/src/model/organization/plan.rs +++ b/lib/bencher_schema/src/model/organization/plan.rs @@ -6,7 +6,7 @@ use bencher_json::{ OrganizationUuid, PlanLevel, }; use bencher_license::Licensor; -use diesel::{BelongingToDsl, ExpressionMethods, QueryDsl, RunQueryDsl}; +use diesel::{BelongingToDsl as _, ExpressionMethods as _, QueryDsl as _, RunQueryDsl as _}; use dropshot::HttpError; use crate::{ @@ -211,7 +211,7 @@ impl InsertPlan { } } -#[allow(variant_size_differences)] +#[expect(variant_size_differences)] pub enum PlanKind { Metered(MeteredPlanId), Licensed(LicenseUsage), diff --git a/lib/bencher_schema/src/model/project/benchmark.rs b/lib/bencher_schema/src/model/project/benchmark.rs index 142324bb2..67a720902 100644 --- a/lib/bencher_schema/src/model/project/benchmark.rs +++ b/lib/bencher_schema/src/model/project/benchmark.rs @@ -2,7 +2,7 @@ use bencher_json::{ project::benchmark::{JsonNewBenchmark, JsonUpdateBenchmark}, BenchmarkName, BenchmarkUuid, DateTime, JsonBenchmark, Slug, }; -use diesel::{ExpressionMethods, QueryDsl, RunQueryDsl}; +use diesel::{ExpressionMethods as _, QueryDsl as _, RunQueryDsl as _}; use dropshot::HttpError; use super::{ProjectId, QueryProject}; diff --git a/lib/bencher_schema/src/model/project/branch/head.rs b/lib/bencher_schema/src/model/project/branch/head.rs index d9e5dd9d1..6ed08b4a5 100644 --- a/lib/bencher_schema/src/model/project/branch/head.rs +++ b/lib/bencher_schema/src/model/project/branch/head.rs @@ -3,8 +3,8 @@ use bencher_json::{ BranchUuid, DateTime, GitHash, HeadUuid, JsonHead, JsonStartPoint, }; use diesel::{ - ExpressionMethods, JoinOnDsl, NullableExpressionMethods, QueryDsl, RunQueryDsl, - SelectableHelper, + ExpressionMethods as _, JoinOnDsl as _, NullableExpressionMethods as _, QueryDsl as _, RunQueryDsl as _, + SelectableHelper as _, }; use dropshot::HttpError; diff --git a/lib/bencher_schema/src/model/project/branch/head_version.rs b/lib/bencher_schema/src/model/project/branch/head_version.rs index af4957587..38eaedba4 100644 --- a/lib/bencher_schema/src/model/project/branch/head_version.rs +++ b/lib/bencher_schema/src/model/project/branch/head_version.rs @@ -1,5 +1,5 @@ use bencher_json::{BranchUuid, GitHash, HeadUuid, JsonStartPoint}; -use diesel::{ExpressionMethods, JoinOnDsl, QueryDsl, RunQueryDsl, SelectableHelper}; +use diesel::{ExpressionMethods as _, JoinOnDsl as _, QueryDsl as _, RunQueryDsl as _, SelectableHelper as _}; use dropshot::HttpError; use crate::{ diff --git a/lib/bencher_schema/src/model/project/branch/mod.rs b/lib/bencher_schema/src/model/project/branch/mod.rs index 0abddd5e4..14abf46e4 100644 --- a/lib/bencher_schema/src/model/project/branch/mod.rs +++ b/lib/bencher_schema/src/model/project/branch/mod.rs @@ -2,7 +2,7 @@ use bencher_json::{ project::branch::{JsonUpdateBranch, JsonUpdateStartPoint}, BranchName, BranchUuid, DateTime, JsonBranch, JsonNewBranch, NameId, NameIdKind, Slug, }; -use diesel::{ExpressionMethods, JoinOnDsl, QueryDsl, RunQueryDsl, SelectableHelper}; +use diesel::{ExpressionMethods as _, JoinOnDsl as _, QueryDsl as _, RunQueryDsl as _, SelectableHelper as _}; use dropshot::HttpError; use slog::Logger; use version::{QueryVersion, VersionId}; diff --git a/lib/bencher_schema/src/model/project/branch/version.rs b/lib/bencher_schema/src/model/project/branch/version.rs index 5696dd8a0..dd31b2893 100644 --- a/lib/bencher_schema/src/model/project/branch/version.rs +++ b/lib/bencher_schema/src/model/project/branch/version.rs @@ -2,7 +2,7 @@ use bencher_json::{ project::head::{JsonVersion, VersionNumber}, GitHash, VersionUuid, }; -use diesel::{ExpressionMethods, QueryDsl, RunQueryDsl}; +use diesel::{ExpressionMethods as _, QueryDsl as _, RunQueryDsl as _}; use dropshot::HttpError; use crate::{ @@ -106,7 +106,7 @@ impl InsertVersion { uuid: version_uuid, project_id, number, - hash: hash.map(Into::into), + hash, }; diesel::insert_into(schema::version::table) diff --git a/lib/bencher_schema/src/model/project/measure.rs b/lib/bencher_schema/src/model/project/measure.rs index 47799cc04..9e7885b4c 100644 --- a/lib/bencher_schema/src/model/project/measure.rs +++ b/lib/bencher_schema/src/model/project/measure.rs @@ -5,7 +5,7 @@ use bencher_json::{ }, DateTime, JsonMeasure, JsonNewMeasure, MeasureNameId, NameIdKind, ResourceName, Slug, }; -use diesel::{ExpressionMethods, QueryDsl, RunQueryDsl}; +use diesel::{ExpressionMethods as _, QueryDsl as _, RunQueryDsl as _}; use dropshot::HttpError; use crate::{ diff --git a/lib/bencher_schema/src/model/project/metric.rs b/lib/bencher_schema/src/model/project/metric.rs index 15248a1e0..c3c70fe7c 100644 --- a/lib/bencher_schema/src/model/project/metric.rs +++ b/lib/bencher_schema/src/model/project/metric.rs @@ -1,5 +1,5 @@ use bencher_json::{JsonMetric, JsonNewMetric, MetricUuid}; -use diesel::{ExpressionMethods, QueryDsl, RunQueryDsl}; +use diesel::{ExpressionMethods as _, QueryDsl as _, RunQueryDsl as _}; use dropshot::HttpError; #[cfg(feature = "plus")] diff --git a/lib/bencher_schema/src/model/project/mod.rs b/lib/bencher_schema/src/model/project/mod.rs index e67f8c1e4..35b5c1071 100644 --- a/lib/bencher_schema/src/model/project/mod.rs +++ b/lib/bencher_schema/src/model/project/mod.rs @@ -1,4 +1,4 @@ -use std::{string::ToString, sync::LazyLock}; +use std::{string::ToString as _, sync::LazyLock}; use bencher_json::{ project::{JsonProjectPatch, JsonProjectPatchNull, JsonUpdateProject, ProjectRole, Visibility}, @@ -7,7 +7,8 @@ use bencher_json::{ }; use bencher_rbac::{project::Permission, Organization, Project}; use diesel::{ - BoolExpressionMethods, ExpressionMethods, QueryDsl, RunQueryDsl, TextExpressionMethods, + BoolExpressionMethods as _, ExpressionMethods as _, QueryDsl as _, RunQueryDsl as _, + TextExpressionMethods as _, }; use dropshot::HttpError; use project_role::InsertProjectRole; @@ -46,7 +47,7 @@ pub mod threshold; crate::macros::typed_id::typed_id!(ProjectId); -#[allow(clippy::expect_used)] +#[expect(clippy::expect_used)] static UNIQUE_SUFFIX: LazyLock = LazyLock::new(|| { Regex::new(r"\((\d+)\)$").expect("Failed to create regex for unique project suffix") }); @@ -222,7 +223,7 @@ impl QueryProject { // https://www.sqlite.org/lang_expr.html#the_like_glob_regexp_match_and_extract_operators let escaped_name = name_str.replace('%', r"\%").replace('_', r"\_"); // Create a regex pattern to match the original project name or any subsequent projects with the same name - let pattern = format!(r"{escaped_name} (%)"); + let pattern = format!("{escaped_name} (%)"); slog::debug!(log, "LIKE pattern: {pattern}"); let Ok(highest_name) = schema::project::table diff --git a/lib/bencher_schema/src/model/project/plot/benchmark.rs b/lib/bencher_schema/src/model/project/plot/benchmark.rs index e7d6d93ca..a3d2492c6 100644 --- a/lib/bencher_schema/src/model/project/plot/benchmark.rs +++ b/lib/bencher_schema/src/model/project/plot/benchmark.rs @@ -1,6 +1,6 @@ use bencher_json::BenchmarkUuid; use bencher_rank::{Rank, RankGenerator}; -use diesel::{BelongingToDsl, ExpressionMethods, QueryDsl, RunQueryDsl}; +use diesel::{BelongingToDsl as _, ExpressionMethods as _, QueryDsl as _, RunQueryDsl as _}; use dropshot::HttpError; use crate::{ diff --git a/lib/bencher_schema/src/model/project/plot/branch.rs b/lib/bencher_schema/src/model/project/plot/branch.rs index c6b54ebc8..8a23d6726 100644 --- a/lib/bencher_schema/src/model/project/plot/branch.rs +++ b/lib/bencher_schema/src/model/project/plot/branch.rs @@ -1,6 +1,6 @@ use bencher_json::BranchUuid; use bencher_rank::{Rank, RankGenerator}; -use diesel::{BelongingToDsl, ExpressionMethods, QueryDsl, RunQueryDsl}; +use diesel::{BelongingToDsl as _, ExpressionMethods as _, QueryDsl as _, RunQueryDsl as _}; use dropshot::HttpError; use crate::{ diff --git a/lib/bencher_schema/src/model/project/plot/measure.rs b/lib/bencher_schema/src/model/project/plot/measure.rs index 1de1c0c34..7757d2373 100644 --- a/lib/bencher_schema/src/model/project/plot/measure.rs +++ b/lib/bencher_schema/src/model/project/plot/measure.rs @@ -1,6 +1,6 @@ use bencher_json::MeasureUuid; use bencher_rank::{Rank, RankGenerator}; -use diesel::{BelongingToDsl, ExpressionMethods, QueryDsl, RunQueryDsl}; +use diesel::{BelongingToDsl as _, ExpressionMethods as _, QueryDsl as _, RunQueryDsl as _}; use dropshot::HttpError; use crate::{ diff --git a/lib/bencher_schema/src/model/project/plot/mod.rs b/lib/bencher_schema/src/model/project/plot/mod.rs index e003e2eb2..627e16faa 100644 --- a/lib/bencher_schema/src/model/project/plot/mod.rs +++ b/lib/bencher_schema/src/model/project/plot/mod.rs @@ -3,7 +3,7 @@ use bencher_json::{ DateTime, Index, JsonNewPlot, JsonPlot, PlotUuid, ResourceName, Window, }; use bencher_rank::{Rank, RankGenerator, Ranked}; -use diesel::{BelongingToDsl, ExpressionMethods, QueryDsl, RunQueryDsl}; +use diesel::{BelongingToDsl as _, ExpressionMethods as _, QueryDsl as _, RunQueryDsl as _}; use dropshot::HttpError; use super::{ProjectId, QueryProject}; @@ -34,7 +34,7 @@ crate::macros::typed_id::typed_id!(PlotId); )] #[diesel(table_name = plot_table)] #[diesel(belongs_to(QueryProject, foreign_key = project_id))] -#[allow(clippy::struct_excessive_bools)] +#[expect(clippy::struct_excessive_bools)] pub struct QueryPlot { pub id: PlotId, pub uuid: PlotUuid, @@ -207,7 +207,7 @@ impl Ranked for QueryPlot { #[derive(Debug, diesel::Insertable)] #[diesel(table_name = plot_table)] -#[allow(clippy::struct_excessive_bools)] +#[expect(clippy::struct_excessive_bools)] pub struct InsertPlot { pub uuid: PlotUuid, pub project_id: ProjectId, diff --git a/lib/bencher_schema/src/model/project/plot/testbed.rs b/lib/bencher_schema/src/model/project/plot/testbed.rs index bf86dcb1a..18197a0d7 100644 --- a/lib/bencher_schema/src/model/project/plot/testbed.rs +++ b/lib/bencher_schema/src/model/project/plot/testbed.rs @@ -1,6 +1,6 @@ use bencher_json::TestbedUuid; use bencher_rank::{Rank, RankGenerator}; -use diesel::{BelongingToDsl, ExpressionMethods, QueryDsl, RunQueryDsl}; +use diesel::{BelongingToDsl as _, ExpressionMethods as _, QueryDsl as _, RunQueryDsl as _}; use dropshot::HttpError; use crate::{ diff --git a/lib/bencher_schema/src/model/project/report/mod.rs b/lib/bencher_schema/src/model/project/report/mod.rs index c1b0d7bdd..d149f690c 100644 --- a/lib/bencher_schema/src/model/project/report/mod.rs +++ b/lib/bencher_schema/src/model/project/report/mod.rs @@ -6,7 +6,7 @@ use bencher_json::{ DateTime, JsonNewReport, JsonReport, ReportUuid, }; use diesel::{ - ExpressionMethods, NullableExpressionMethods, QueryDsl, RunQueryDsl, SelectableHelper, + ExpressionMethods as _, NullableExpressionMethods as _, QueryDsl as _, RunQueryDsl as _, SelectableHelper as _, }; use dropshot::HttpError; use results::ReportResults; diff --git a/lib/bencher_schema/src/model/project/report/results/detector/data.rs b/lib/bencher_schema/src/model/project/report/results/detector/data.rs index 5d4e09642..304f4c222 100644 --- a/lib/bencher_schema/src/model/project/report/results/detector/data.rs +++ b/lib/bencher_schema/src/model/project/report/results/detector/data.rs @@ -1,6 +1,6 @@ use bencher_boundary::MetricsData; use chrono::offset::Utc; -use diesel::{ExpressionMethods, JoinOnDsl, QueryDsl, RunQueryDsl}; +use diesel::{ExpressionMethods as _, JoinOnDsl as _, QueryDsl as _, RunQueryDsl as _}; use dropshot::HttpError; use slog::{warn, Logger}; diff --git a/lib/bencher_schema/src/model/project/report/results/detector/mod.rs b/lib/bencher_schema/src/model/project/report/results/detector/mod.rs index 2ec789dca..e3f8df225 100644 --- a/lib/bencher_schema/src/model/project/report/results/detector/mod.rs +++ b/lib/bencher_schema/src/model/project/report/results/detector/mod.rs @@ -1,6 +1,6 @@ use bencher_boundary::MetricsBoundary; use bencher_json::BoundaryUuid; -use diesel::RunQueryDsl; +use diesel::RunQueryDsl as _; use dropshot::HttpError; use slog::Logger; diff --git a/lib/bencher_schema/src/model/project/report/results/detector/threshold.rs b/lib/bencher_schema/src/model/project/report/results/detector/threshold.rs index c52a5bab6..9c7fc717c 100644 --- a/lib/bencher_schema/src/model/project/report/results/detector/threshold.rs +++ b/lib/bencher_schema/src/model/project/report/results/detector/threshold.rs @@ -1,7 +1,7 @@ use bencher_json::{Boundary, ModelTest, SampleSize, Window}; use diesel::{ - ExpressionMethods, JoinOnDsl, NullableExpressionMethods, QueryDsl, RunQueryDsl, - SelectableHelper, + ExpressionMethods as _, JoinOnDsl as _, NullableExpressionMethods as _, QueryDsl as _, RunQueryDsl as _, + SelectableHelper as _, }; use crate::{ diff --git a/lib/bencher_schema/src/model/project/report/results/mod.rs b/lib/bencher_schema/src/model/project/report/results/mod.rs index 10d326e2d..c6e088c82 100644 --- a/lib/bencher_schema/src/model/project/report/results/mod.rs +++ b/lib/bencher_schema/src/model/project/report/results/mod.rs @@ -8,7 +8,7 @@ use bencher_json::{ project::report::{Adapter, Iteration, JsonReportSettings}, BenchmarkName, MeasureNameId, }; -use diesel::RunQueryDsl; +use diesel::RunQueryDsl as _; use dropshot::HttpError; use slog::Logger; @@ -106,7 +106,7 @@ impl ReportResults { ) .await?; } - }; + } Ok(()) } diff --git a/lib/bencher_schema/src/model/project/testbed.rs b/lib/bencher_schema/src/model/project/testbed.rs index 4a7b248d7..eb0fff473 100644 --- a/lib/bencher_schema/src/model/project/testbed.rs +++ b/lib/bencher_schema/src/model/project/testbed.rs @@ -2,7 +2,7 @@ use bencher_json::{ project::testbed::JsonUpdateTestbed, DateTime, JsonNewTestbed, JsonTestbed, NameId, NameIdKind, ResourceName, Slug, TestbedUuid, }; -use diesel::{ExpressionMethods, QueryDsl, RunQueryDsl}; +use diesel::{ExpressionMethods as _, QueryDsl as _, RunQueryDsl as _}; use dropshot::HttpError; use super::{ProjectId, QueryProject}; diff --git a/lib/bencher_schema/src/model/project/threshold/alert.rs b/lib/bencher_schema/src/model/project/threshold/alert.rs index 144b704ae..7c2b5099a 100644 --- a/lib/bencher_schema/src/model/project/threshold/alert.rs +++ b/lib/bencher_schema/src/model/project/threshold/alert.rs @@ -6,7 +6,7 @@ use bencher_json::{ }, AlertUuid, BoundaryUuid, DateTime, ReportUuid, }; -use diesel::{ExpressionMethods, QueryDsl, RunQueryDsl, SelectableHelper}; +use diesel::{ExpressionMethods as _, QueryDsl as _, RunQueryDsl as _, SelectableHelper as _}; use dropshot::HttpError; use super::{ @@ -145,7 +145,7 @@ impl QueryAlert { .await } - #[allow(clippy::too_many_arguments)] + #[expect(clippy::too_many_arguments)] pub async fn into_json_for_report( self, context: &ApiContext, diff --git a/lib/bencher_schema/src/model/project/threshold/boundary.rs b/lib/bencher_schema/src/model/project/threshold/boundary.rs index 496c12cae..9456dce00 100644 --- a/lib/bencher_schema/src/model/project/threshold/boundary.rs +++ b/lib/bencher_schema/src/model/project/threshold/boundary.rs @@ -1,5 +1,5 @@ use bencher_json::{project::boundary::JsonBoundary, BoundaryUuid}; -use diesel::{ExpressionMethods, QueryDsl, RunQueryDsl}; +use diesel::{ExpressionMethods as _, QueryDsl as _, RunQueryDsl as _}; use dropshot::HttpError; use crate::{ diff --git a/lib/bencher_schema/src/model/project/threshold/mod.rs b/lib/bencher_schema/src/model/project/threshold/mod.rs index 356db97d8..11a101dbc 100644 --- a/lib/bencher_schema/src/model/project/threshold/mod.rs +++ b/lib/bencher_schema/src/model/project/threshold/mod.rs @@ -7,7 +7,7 @@ use bencher_json::{ }, DateTime, Model, ModelUuid, ThresholdUuid, }; -use diesel::{BelongingToDsl, ExpressionMethods, QueryDsl, RunQueryDsl}; +use diesel::{BelongingToDsl as _, ExpressionMethods as _, QueryDsl as _, RunQueryDsl as _}; use dropshot::HttpError; use model::UpdateModel; use slog::Logger; @@ -525,7 +525,7 @@ impl InsertThreshold { let no_models = json_thresholds .models .as_ref() - .map_or(true, HashMap::is_empty); + .is_none_or(HashMap::is_empty); let reset_thresholds = json_thresholds.reset.unwrap_or_default(); if no_models && !reset_thresholds { slog::debug!(log, "No threshold models or reset in report"); diff --git a/lib/bencher_schema/src/model/project/threshold/model.rs b/lib/bencher_schema/src/model/project/threshold/model.rs index eadb90320..43aeb6a2e 100644 --- a/lib/bencher_schema/src/model/project/threshold/model.rs +++ b/lib/bencher_schema/src/model/project/threshold/model.rs @@ -1,7 +1,7 @@ use bencher_json::{ Boundary, DateTime, JsonModel, Model, ModelTest, ModelUuid, SampleSize, Window, }; -use diesel::{ExpressionMethods, JoinOnDsl, QueryDsl, RunQueryDsl, SelectableHelper}; +use diesel::{ExpressionMethods as _, JoinOnDsl as _, QueryDsl as _, RunQueryDsl as _, SelectableHelper as _}; use dropshot::HttpError; use crate::{ diff --git a/lib/bencher_schema/src/model/server/mod.rs b/lib/bencher_schema/src/model/server/mod.rs index 18acef199..23a610cda 100644 --- a/lib/bencher_schema/src/model/server/mod.rs +++ b/lib/bencher_schema/src/model/server/mod.rs @@ -6,7 +6,7 @@ use std::{cmp, sync::Arc}; use bencher_json::{DateTime, JsonServer, JsonServerStats, PlanLevel, ServerUuid, BENCHER_API_URL}; use bencher_license::Licensor; use chrono::{Duration, Utc}; -use diesel::RunQueryDsl; +use diesel::RunQueryDsl as _; use dropshot::HttpError; use slog::Logger; @@ -28,7 +28,7 @@ const SERVER_ID: ServerId = ServerId(1); const LICENSE_GRACE_PERIOD: usize = 7; -#[allow(clippy::panic)] +#[expect(clippy::panic)] pub static BENCHER_STATS_API_URL: LazyLock = LazyLock::new(|| { BENCHER_API_URL .clone() @@ -74,7 +74,7 @@ impl QueryServer { tokio::spawn(async move { let StatsSettings { offset, enabled } = stats; let mut violations = 0; - #[allow(clippy::infinite_loop)] + #[expect(clippy::infinite_loop)] loop { let now = Utc::now().naive_utc().time(); let sleep_time = match now.cmp(&offset) { diff --git a/lib/bencher_schema/src/model/server/stats.rs b/lib/bencher_schema/src/model/server/stats.rs index a2ddef733..a517b381f 100644 --- a/lib/bencher_schema/src/model/server/stats.rs +++ b/lib/bencher_schema/src/model/server/stats.rs @@ -2,7 +2,9 @@ use bencher_json::{ system::server::{JsonCohort, JsonCohortAvg, JsonTopCohort, JsonTopProject, JsonTopProjects}, DateTime, JsonServerStats, }; -use diesel::{dsl::count, ExpressionMethods, QueryDsl, RunQueryDsl, SelectableHelper}; +use diesel::{ + dsl::count, ExpressionMethods as _, QueryDsl as _, RunQueryDsl as _, SelectableHelper as _, +}; use dropshot::HttpError; use crate::{ @@ -18,7 +20,7 @@ const THIS_WEEK: i64 = 7 * 24 * 60 * 60; const THIS_MONTH: i64 = THIS_WEEK * 4; const TOP_PROJECTS: usize = 10; -#[allow( +#[expect( clippy::cast_possible_truncation, clippy::cast_sign_loss, clippy::too_many_lines @@ -258,7 +260,7 @@ pub fn get_stats( }) } -#[allow( +#[expect( clippy::cast_precision_loss, clippy::indexing_slicing, clippy::integer_division @@ -280,7 +282,7 @@ fn median(array: &mut [i64]) -> f64 { } } -#[allow(clippy::cast_precision_loss, clippy::cast_sign_loss)] +#[expect(clippy::cast_precision_loss, clippy::cast_sign_loss)] fn top_projects(mut project_metrics: Vec<(QueryProject, i64)>, total: i64) -> JsonTopProjects { project_metrics.sort_unstable_by(|a, b| a.1.cmp(&b.1)); project_metrics.reverse(); diff --git a/lib/bencher_schema/src/model/user/admin.rs b/lib/bencher_schema/src/model/user/admin.rs index 5d0383f35..a3758e731 100644 --- a/lib/bencher_schema/src/model/user/admin.rs +++ b/lib/bencher_schema/src/model/user/admin.rs @@ -1,4 +1,4 @@ -use bencher_json::Sanitize; +use bencher_json::Sanitize as _; use dropshot::HttpError; use crate::{context::ApiContext, error::forbidden_error}; diff --git a/lib/bencher_schema/src/model/user/auth.rs b/lib/bencher_schema/src/model/user/auth.rs index 68d4ec551..9fa2d7c78 100644 --- a/lib/bencher_schema/src/model/user/auth.rs +++ b/lib/bencher_schema/src/model/user/auth.rs @@ -9,7 +9,7 @@ use bencher_rbac::{ user::{OrganizationRoles, ProjectRoles}, Organization, Project, Server, User as RbacUser, }; -use diesel::{ExpressionMethods, QueryDsl, RunQueryDsl}; +use diesel::{ExpressionMethods as _, QueryDsl as _, RunQueryDsl as _}; use dropshot::{ ApiEndpointBodyContentType, ExtensionMode, ExtractorMetadata, HttpError, RequestContext, ServerContext, SharedExtractor, diff --git a/lib/bencher_schema/src/model/user/mod.rs b/lib/bencher_schema/src/model/user/mod.rs index bef5db127..2cdca8e8f 100644 --- a/lib/bencher_schema/src/model/user/mod.rs +++ b/lib/bencher_schema/src/model/user/mod.rs @@ -3,7 +3,7 @@ use bencher_json::{ JsonUpdateUser, JsonUser, Jwt, Sanitize, Slug, UserName, UserUuid, }; use bencher_token::TokenKey; -use diesel::{dsl::count, ExpressionMethods, QueryDsl, RunQueryDsl}; +use diesel::{dsl::count, ExpressionMethods as _, QueryDsl as _, RunQueryDsl as _}; use dropshot::HttpError; use slog::Logger; use url::Url; @@ -29,7 +29,7 @@ crate::macros::typed_id::typed_id!(UserId); macro_rules! same_user { ($auth_user:ident, $rbac:expr, $user_uuid:expr) => { if !($auth_user.is_admin(&$rbac) || $auth_user.uuid() == $user_uuid) { - #[allow(unused_qualifications)] + #[expect(unused_qualifications)] return Err($crate::error::forbidden_error(format!("User is not admin and the authenticated user ({auth_user}) does not match the requested user ({requested_user})", auth_user = $auth_user.uuid(), requested_user = $user_uuid))); } }; diff --git a/lib/bencher_schema/src/model/user/token.rs b/lib/bencher_schema/src/model/user/token.rs index 322c8aa02..4f3967be3 100644 --- a/lib/bencher_schema/src/model/user/token.rs +++ b/lib/bencher_schema/src/model/user/token.rs @@ -3,7 +3,7 @@ use bencher_json::{ TokenUuid, }; use bencher_token::TokenKey; -use diesel::{ExpressionMethods, QueryDsl, RunQueryDsl}; +use diesel::{ExpressionMethods as _, QueryDsl as _, RunQueryDsl as _}; use dropshot::HttpError; use crate::{ diff --git a/lib/bencher_token/src/key.rs b/lib/bencher_token/src/key.rs index 539ea9eab..1172d8a20 100644 --- a/lib/bencher_token/src/key.rs +++ b/lib/bencher_token/src/key.rs @@ -1,4 +1,4 @@ -use std::str::FromStr; +use std::str::FromStr as _; use std::sync::LazyLock; use bencher_json::{organization::member::OrganizationRole, Email, Jwt, OrganizationUuid, Secret}; diff --git a/lib/bencher_token/src/lib.rs b/lib/bencher_token/src/lib.rs index 928a39f46..281b3c205 100644 --- a/lib/bencher_token/src/lib.rs +++ b/lib/bencher_token/src/lib.rs @@ -16,7 +16,7 @@ pub use error::TokenError; pub use key::TokenKey; #[cfg(debug_assertions)] -#[allow(clippy::expect_used)] +#[expect(clippy::expect_used)] pub static DEFAULT_SECRET_KEY: LazyLock = LazyLock::new(|| { "DO_NOT_USE_THIS_IN_PRODUCTION" .parse() diff --git a/lib/bencher_valid/src/benchmark_name.rs b/lib/bencher_valid/src/benchmark_name.rs index 849ede1c2..b5508b533 100644 --- a/lib/bencher_valid/src/benchmark_name.rs +++ b/lib/bencher_valid/src/benchmark_name.rs @@ -118,7 +118,7 @@ pub fn is_valid_benchmark_name(benchmark_name: &str) -> bool { #[cfg(test)] mod test { - use std::str::FromStr; + use std::str::FromStr as _; use crate::BenchmarkName; diff --git a/lib/bencher_valid/src/date_time.rs b/lib/bencher_valid/src/date_time.rs index 34fa5b12d..b3e4df9f8 100644 --- a/lib/bencher_valid/src/date_time.rs +++ b/lib/bencher_valid/src/date_time.rs @@ -1,6 +1,6 @@ use std::{fmt, str::FromStr}; -use chrono::{TimeZone, Utc}; +use chrono::{TimeZone as _, Utc}; use derive_more::Display; #[cfg(feature = "schema")] use schemars::JsonSchema; diff --git a/lib/bencher_valid/src/email.rs b/lib/bencher_valid/src/email.rs index 5dd520b5b..1a28888f9 100644 --- a/lib/bencher_valid/src/email.rs +++ b/lib/bencher_valid/src/email.rs @@ -86,7 +86,7 @@ pub fn is_valid_email(email: &str) -> bool { #[cfg(test)] mod test { - use std::str::FromStr; + use std::str::FromStr as _; use super::{is_valid_email, Email}; use pretty_assertions::assert_eq; diff --git a/lib/bencher_valid/src/index.rs b/lib/bencher_valid/src/index.rs index 1ebda352d..69648eaeb 100644 --- a/lib/bencher_valid/src/index.rs +++ b/lib/bencher_valid/src/index.rs @@ -93,7 +93,7 @@ mod test { use super::{is_valid_index, Index}; #[test] - #[allow(clippy::excessive_precision)] + #[expect(clippy::excessive_precision)] fn test_boundary() { assert_eq!(true, is_valid_index(Index::MIN.into())); assert_eq!(true, is_valid_index(1)); diff --git a/lib/bencher_valid/src/jwt.rs b/lib/bencher_valid/src/jwt.rs index 5ac357d8c..ae2c265ee 100644 --- a/lib/bencher_valid/src/jwt.rs +++ b/lib/bencher_valid/src/jwt.rs @@ -2,7 +2,7 @@ use std::sync::LazyLock; use base64::{ engine::{DecodePaddingMode, GeneralPurpose, GeneralPurposeConfig}, - Engine, + Engine as _, }; use derive_more::Display; #[cfg(feature = "schema")] @@ -21,7 +21,7 @@ use crate::ValidError; // Valid until 2159-12-06T18:53:44Z pub const TEST_BENCHER_API_TOKEN_STR: &str = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJhdWQiOiJhcGlfa2V5IiwiZXhwIjo1OTkzNjM2MDI0LCJpYXQiOjE2OTg2Njg3MjksImlzcyI6Imh0dHA6Ly9sb2NhbGhvc3Q6MzAwMC8iLCJzdWIiOiJtdXJpZWwuYmFnZ2VAbm93aGVyZS5jb20iLCJvcmciOm51bGx9.t3t23mlgKYZmUt7-PbRWLqXlCTt6Ydh8TRE8KiSGQi4"; -#[allow(clippy::expect_used)] +#[expect(clippy::expect_used)] pub static TEST_BENCHER_API_TOKEN: LazyLock = LazyLock::new(|| { TEST_BENCHER_API_TOKEN_STR .parse() diff --git a/lib/bencher_valid/src/lib.rs b/lib/bencher_valid/src/lib.rs index ad6de1e43..612d54957 100644 --- a/lib/bencher_valid/src/lib.rs +++ b/lib/bencher_valid/src/lib.rs @@ -1,6 +1,6 @@ -#![allow(unused_crate_dependencies)] +#![expect(unused_crate_dependencies)] -use std::str::FromStr; +use std::str::FromStr as _; #[cfg(feature = "wasm")] use wasm_bindgen::prelude::*; @@ -75,7 +75,7 @@ fn is_valid_len(input: &str) -> bool { } #[cfg_attr(feature = "wasm", wasm_bindgen)] -#[cfg_attr(not(feature = "wasm"), allow(dead_code))] +#[cfg_attr(not(feature = "wasm"), expect(dead_code))] pub fn is_valid_uuid(uuid: &str) -> bool { uuid::Uuid::from_str(uuid).is_ok() } diff --git a/lib/bencher_valid/src/model/boundary.rs b/lib/bencher_valid/src/model/boundary.rs index c42a62fba..a61acbaaa 100644 --- a/lib/bencher_valid/src/model/boundary.rs +++ b/lib/bencher_valid/src/model/boundary.rs @@ -66,7 +66,7 @@ impl Visitor<'_> for BoundaryVisitor { where E: de::Error, { - #[allow(clippy::cast_precision_loss)] + #[expect(clippy::cast_precision_loss)] (v as f64).try_into().map_err(E::custom) } @@ -96,7 +96,7 @@ impl Boundary { pub const THREE_NINES: Self = Self(OrderedFloat(0.999)); pub const FOUR_NINES: Self = Self(OrderedFloat(0.9999)); pub const FIVE_NINES: Self = Self(OrderedFloat(0.99999)); - #[allow(clippy::unreadable_literal)] + #[expect(clippy::unreadable_literal)] pub const SIXTEEN_NINES: Self = Self(OrderedFloat(0.9999999999999999)); pub const MAX_STATISTICAL: Self = Self::SIXTEEN_NINES; @@ -283,7 +283,7 @@ mod test { use super::{is_valid_boundary, Boundary}; #[test] - #[allow(clippy::excessive_precision)] + #[expect(clippy::excessive_precision)] fn test_boundary() { assert_eq!(true, is_valid_boundary(0.0)); assert_eq!(true, is_valid_boundary(-1.0)); diff --git a/lib/bencher_valid/src/model/sample_size.rs b/lib/bencher_valid/src/model/sample_size.rs index 93710a761..56c9ec462 100644 --- a/lib/bencher_valid/src/model/sample_size.rs +++ b/lib/bencher_valid/src/model/sample_size.rs @@ -140,7 +140,7 @@ mod test { use super::{is_valid_sample_size, SampleSize}; #[test] - #[allow(clippy::excessive_precision)] + #[expect(clippy::excessive_precision)] fn test_boundary() { assert_eq!(true, is_valid_sample_size(SampleSize::MIN.into())); assert_eq!(true, is_valid_sample_size(2)); diff --git a/lib/bencher_valid/src/model/window.rs b/lib/bencher_valid/src/model/window.rs index 8942a3e2f..39fe50f70 100644 --- a/lib/bencher_valid/src/model/window.rs +++ b/lib/bencher_valid/src/model/window.rs @@ -136,7 +136,7 @@ mod test { use super::{is_valid_window, Window}; #[test] - #[allow(clippy::excessive_precision)] + #[expect(clippy::excessive_precision)] fn test_boundary() { assert_eq!(true, is_valid_window(Window::MIN.into())); assert_eq!(true, is_valid_window(Window::THIRTY.into())); diff --git a/lib/bencher_valid/src/plus/cvc.rs b/lib/bencher_valid/src/plus/cvc.rs index 5d06a0f06..0d1d5b73c 100644 --- a/lib/bencher_valid/src/plus/cvc.rs +++ b/lib/bencher_valid/src/plus/cvc.rs @@ -17,7 +17,7 @@ use serde::{ use crate::{error::REGEX_ERROR, secret::SANITIZED_SECRET, ValidError}; -#[allow(clippy::expect_used)] +#[expect(clippy::expect_used)] static CVC_REGEX: LazyLock = LazyLock::new(|| Regex::new("^[[:digit:]]{3,4}$").expect(REGEX_ERROR)); diff --git a/lib/bencher_valid/src/plus/entitlements.rs b/lib/bencher_valid/src/plus/entitlements.rs index 5dc213ae9..7459d203f 100644 --- a/lib/bencher_valid/src/plus/entitlements.rs +++ b/lib/bencher_valid/src/plus/entitlements.rs @@ -103,7 +103,7 @@ mod test { use super::{is_valid_entitlements, Entitlements}; #[test] - #[allow(clippy::excessive_precision)] + #[expect(clippy::excessive_precision)] fn test_boundary() { assert_eq!(true, is_valid_entitlements(Entitlements::default().into())); assert_eq!(true, is_valid_entitlements(Entitlements::MIN.into())); diff --git a/lib/bencher_valid/src/plus/last_four.rs b/lib/bencher_valid/src/plus/last_four.rs index 94934fdab..fa976f35c 100644 --- a/lib/bencher_valid/src/plus/last_four.rs +++ b/lib/bencher_valid/src/plus/last_four.rs @@ -18,7 +18,7 @@ use serde::{ use crate::{error::REGEX_ERROR, ValidError}; -#[allow(clippy::expect_used)] +#[expect(clippy::expect_used)] static LAST_FOUR_REGEX: LazyLock = LazyLock::new(|| Regex::new("^[[:digit:]]{4}$").expect(REGEX_ERROR)); diff --git a/lib/bencher_valid/src/plus/month.rs b/lib/bencher_valid/src/plus/month.rs index cea63c4cd..be6e1ddb7 100644 --- a/lib/bencher_valid/src/plus/month.rs +++ b/lib/bencher_valid/src/plus/month.rs @@ -41,7 +41,7 @@ impl FromStr for ExpirationMonth { type Err = ValidError; fn from_str(expiration_month: &str) -> Result { - #[allow(clippy::map_err_ignore)] + #[expect(clippy::map_err_ignore)] expiration_month .parse::() .map_err(|_| ValidError::ExpirationMonthStr(expiration_month.into()))? diff --git a/lib/bencher_valid/src/plus/number.rs b/lib/bencher_valid/src/plus/number.rs index f8203ab6a..4acffa576 100644 --- a/lib/bencher_valid/src/plus/number.rs +++ b/lib/bencher_valid/src/plus/number.rs @@ -17,7 +17,7 @@ use serde::{ use crate::{error::REGEX_ERROR, secret::SANITIZED_SECRET, ValidError}; -#[allow(clippy::expect_used)] +#[expect(clippy::expect_used)] static NUMBER_REGEX: LazyLock = LazyLock::new(|| Regex::new("^[[:digit:]]{12,19}$").expect(REGEX_ERROR)); diff --git a/lib/bencher_valid/src/plus/year.rs b/lib/bencher_valid/src/plus/year.rs index 9ff2c4f43..a7c4b687f 100644 --- a/lib/bencher_valid/src/plus/year.rs +++ b/lib/bencher_valid/src/plus/year.rs @@ -1,4 +1,4 @@ -use chrono::Datelike; +use chrono::Datelike as _; use chrono::Utc; use derive_more::Display; #[cfg(feature = "schema")] @@ -44,7 +44,7 @@ impl FromStr for ExpirationYear { type Err = ValidError; fn from_str(expiration_year: &str) -> Result { - #[allow(clippy::map_err_ignore)] + #[expect(clippy::map_err_ignore)] expiration_year .parse::() .map_err(|_| ValidError::ExpirationYearStr(expiration_year.into()))? diff --git a/lib/bencher_valid/src/slug.rs b/lib/bencher_valid/src/slug.rs index 1d77c77da..1badf3bb7 100644 --- a/lib/bencher_valid/src/slug.rs +++ b/lib/bencher_valid/src/slug.rs @@ -79,7 +79,7 @@ pub fn is_valid_slug(slug: &str) -> bool { is_valid_len(slug) && slug == slug::slugify(slug) } -#[allow(dead_code)] +#[expect(dead_code)] #[cfg_attr(feature = "wasm", wasm_bindgen)] pub fn new_slug(slug: &str) -> String { Slug::new(slug).0 @@ -117,7 +117,7 @@ impl Slug { #[cfg(feature = "server")] pub fn rand_suffix() -> String { use chrono::Utc; - use rand::Rng; + use rand::Rng as _; const BASE: u64 = 36; const CHARSET: &[u8] = BASE_36.as_bytes(); @@ -128,7 +128,7 @@ impl Slug { while timestamp > 0 { let remainder = timestamp % BASE; - #[allow(clippy::cast_possible_truncation)] + #[expect(clippy::cast_possible_truncation)] if let Some(c) = std::char::from_digit(remainder as u32, BASE as u32) { base36.push(c); } diff --git a/lib/bencher_valid/src/units.rs b/lib/bencher_valid/src/units.rs index 2d45e9cc8..b5c0cdf67 100644 --- a/lib/bencher_valid/src/units.rs +++ b/lib/bencher_valid/src/units.rs @@ -20,7 +20,7 @@ impl Units { Self { scale, units } } - #[allow(clippy::cast_precision_loss)] + #[expect(clippy::cast_precision_loss)] pub fn scale_factor(&self) -> OrderedFloat { OrderedFloat::from(self.scale.factor() as f64) } @@ -51,7 +51,7 @@ enum Scale { } impl Scale { - #[allow(clippy::cast_precision_loss)] + #[expect(clippy::cast_precision_loss)] fn new(min: f64, units: &str) -> Self { match units { NANOSECONDS => match min { @@ -305,19 +305,19 @@ impl ScaleOneE { } } -#[allow(dead_code)] +#[expect(dead_code)] #[cfg_attr(feature = "wasm", wasm_bindgen)] pub fn scale_factor(min: f64, units: &str) -> u64 { Scale::new(min, units).factor() } -#[allow(dead_code)] +#[expect(dead_code)] #[cfg_attr(feature = "wasm", wasm_bindgen)] pub fn scale_units(min: f64, units: &str) -> String { Scale::new(min, units).units(units) } -#[allow(dead_code)] +#[expect(dead_code)] #[cfg_attr(feature = "wasm", wasm_bindgen)] pub fn scale_units_symbol(min: f64, units: &str) -> String { Scale::new(min, units).units_symbol(units) diff --git a/lib/bencher_valid/src/user_name.rs b/lib/bencher_valid/src/user_name.rs index d876a90fe..fbd1949a9 100644 --- a/lib/bencher_valid/src/user_name.rs +++ b/lib/bencher_valid/src/user_name.rs @@ -18,7 +18,7 @@ use serde::{ use crate::{is_valid_len, ValidError, REGEX_ERROR}; -#[allow(clippy::expect_used)] +#[expect(clippy::expect_used)] static NAME_REGEX: LazyLock = LazyLock::new(|| Regex::new(r"^[0-9A-Za-z ,\.\-']{1,64}$").expect(REGEX_ERROR)); diff --git a/lib/bencher_valid/tests/web.rs b/lib/bencher_valid/tests/web.rs index 7e3d8107d..23acae00a 100644 --- a/lib/bencher_valid/tests/web.rs +++ b/lib/bencher_valid/tests/web.rs @@ -1,4 +1,4 @@ -#![allow(unused_crate_dependencies)] +#![expect(unused_crate_dependencies)] #![cfg(target_arch = "wasm32")] //! Test suite for the Web and headless browsers. diff --git a/plus/bencher_billing/src/biller.rs b/plus/bencher_billing/src/biller.rs index e2b0ab2b6..8373c6692 100644 --- a/plus/bencher_billing/src/biller.rs +++ b/plus/bencher_billing/src/biller.rs @@ -690,7 +690,7 @@ mod test { }, Entitlements, MeteredPlanId, OrganizationUuid, PlanLevel, PlanStatus, UserUuid, }; - use chrono::{Datelike, Utc}; + use chrono::{Datelike as _, Utc}; use literally::hmap; use pretty_assertions::assert_eq; use stripe::{CustomerId, PaymentMethodId}; diff --git a/plus/bencher_billing/src/products.rs b/plus/bencher_billing/src/products.rs index 0b3d940f6..0e7708449 100644 --- a/plus/bencher_billing/src/products.rs +++ b/plus/bencher_billing/src/products.rs @@ -22,7 +22,7 @@ impl Products { } pub struct Product { - #[allow(dead_code, clippy::struct_field_names)] + #[expect(dead_code, clippy::struct_field_names)] pub product: StripeProduct, pub metered: HashMap, pub licensed: HashMap, diff --git a/plus/bencher_google_index/src/lib.rs b/plus/bencher_google_index/src/lib.rs index 82349310f..feba7601a 100644 --- a/plus/bencher_google_index/src/lib.rs +++ b/plus/bencher_google_index/src/lib.rs @@ -4,7 +4,7 @@ use serde::Serialize; use tame_oauth::{ gcp::{ service_account::ServiceAccountProviderInner, ServiceAccountInfo, ServiceAccountProvider, - TokenOrRequest, TokenProvider, + TokenOrRequest, TokenProvider as _, }, token_cache::CachedTokenProvider, Token, diff --git a/plus/bencher_license/src/error.rs b/plus/bencher_license/src/error.rs index ae5e57a4b..7eb431b1a 100644 --- a/plus/bencher_license/src/error.rs +++ b/plus/bencher_license/src/error.rs @@ -1,6 +1,6 @@ use thiserror::Error; -#[allow(clippy::absolute_paths)] +#[expect(clippy::absolute_paths)] #[derive(Debug, Error)] pub enum LicenseError { #[error("Failed to read private pem: {0}")] diff --git a/plus/bencher_license/src/licensor.rs b/plus/bencher_license/src/licensor.rs index 5e06356f3..ebf672e4a 100644 --- a/plus/bencher_license/src/licensor.rs +++ b/plus/bencher_license/src/licensor.rs @@ -1,4 +1,4 @@ -use std::str::FromStr; +use std::str::FromStr as _; use std::sync::LazyLock; use bencher_json::organization::plan::JsonLicense; diff --git a/rust-toolchain.toml b/rust-toolchain.toml index f8257ccbf..1db6edd45 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,4 +1,4 @@ # https://rust-lang.github.io/rustup/overrides.html#the-toolchain-file [toolchain] -channel = "1.82.0" +channel = "1.86.0" profile = "default" diff --git a/services/api/src/lib.rs b/services/api/src/lib.rs index faeb0c651..e1005ba8d 100644 --- a/services/api/src/lib.rs +++ b/services/api/src/lib.rs @@ -1,4 +1,4 @@ -#![allow(clippy::result_large_err)] +#![expect(clippy::result_large_err)] // Needed for binary use bencher_config as _; diff --git a/services/api/src/main.rs b/services/api/src/main.rs index f35620d00..068168a9c 100644 --- a/services/api/src/main.rs +++ b/services/api/src/main.rs @@ -1,4 +1,4 @@ -#![allow(unused_crate_dependencies)] +#![expect(unused_crate_dependencies)] #[cfg(feature = "sentry")] use std::path::PathBuf; @@ -16,7 +16,7 @@ use tokio::process::Command; use tokio::{sync, task::JoinHandle}; use tokio_rustls::rustls::crypto::{ring, CryptoProvider}; -#[allow(clippy::absolute_paths)] +#[expect(clippy::absolute_paths)] #[derive(Debug, thiserror::Error)] pub enum ApiError { #[error("Failed to install default AWS credentials provider: {0:?}")] @@ -154,7 +154,7 @@ fn init_sentry(config: &Config) -> Option { } #[cfg(feature = "plus")] -#[allow(clippy::absolute_paths)] +#[expect(clippy::absolute_paths)] #[derive(Debug, thiserror::Error)] pub enum LitestreamError { #[error("Failed to absolutize the database path: {0}")] diff --git a/services/cli/src/bencher/backend.rs b/services/cli/src/bencher/backend.rs index 02beb4dfa..72a16080f 100644 --- a/services/cli/src/bencher/backend.rs +++ b/services/cli/src/bencher/backend.rs @@ -134,7 +134,7 @@ impl Backend { pub async fn send(&self, sender: F) -> Result where F: Fn(bencher_client::Client) -> R, - R: std::future::Future< + R: Future< Output = Result< progenitor_client::ResponseValue, bencher_client::Error, @@ -160,7 +160,7 @@ impl Backend { pub async fn send_with(&self, sender: F) -> Result where F: Fn(bencher_client::Client) -> R, - R: std::future::Future< + R: Future< Output = Result< progenitor_client::ResponseValue, bencher_client::Error, diff --git a/services/cli/src/bencher/mod.rs b/services/cli/src/bencher/mod.rs index 7c121b380..2439ef264 100644 --- a/services/cli/src/bencher/mod.rs +++ b/services/cli/src/bencher/mod.rs @@ -1,4 +1,4 @@ -use clap::Parser; +use clap::Parser as _; use crate::{parser::CliBencher, CliError}; diff --git a/services/cli/src/bencher/sub/compose/logs.rs b/services/cli/src/bencher/sub/compose/logs.rs index 38e30a275..a6252e3bf 100644 --- a/services/cli/src/bencher/sub/compose/logs.rs +++ b/services/cli/src/bencher/sub/compose/logs.rs @@ -7,7 +7,7 @@ use bollard::{ container::{LogOutput, LogsOptions}, Docker, }; -use futures_util::stream::StreamExt; +use futures_util::stream::StreamExt as _; use crate::{cli_eprintln, cli_println}; diff --git a/services/cli/src/bencher/sub/compose/up.rs b/services/cli/src/bencher/sub/compose/up.rs index 8cfa9675a..a751d2bc7 100644 --- a/services/cli/src/bencher/sub/compose/up.rs +++ b/services/cli/src/bencher/sub/compose/up.rs @@ -5,7 +5,7 @@ use bollard::{ service::{HostConfig, PortBinding}, Docker, }; -use futures_util::TryStreamExt; +use futures_util::TryStreamExt as _; use super::DockerError; use crate::{ @@ -161,7 +161,7 @@ async fn pull_image( if let BollardError::DockerStreamError { error } = &err { cli_eprintln!("{error}"); cli_eprintln!("Are you on Windows? Are you running in Linux container mode?"); - cli_eprintln!(r#"Try running: & 'C:\Program Files\Docker\Docker\DockerCli.exe' -SwitchLinuxEngine"#); + cli_eprintln!(r"Try running: & 'C:\Program Files\Docker\Docker\DockerCli.exe' -SwitchLinuxEngine"); } DockerError::CreateImage { image, diff --git a/services/cli/src/bencher/sub/mock.rs b/services/cli/src/bencher/sub/mock.rs index 56df566d2..c84a00518 100644 --- a/services/cli/src/bencher/sub/mock.rs +++ b/services/cli/src/bencher/sub/mock.rs @@ -3,8 +3,8 @@ use std::collections::HashMap; use bencher_adapter::{results::adapter_metrics::AdapterMetrics, AdapterResults}; use bencher_json::{JsonNewMetric, NameId}; use rand::{ - distr::{Distribution, Uniform}, - Rng, + distr::{Distribution as _, Uniform}, + Rng as _, }; use crate::{cli_println, parser::mock::CliMock, CliError}; @@ -22,7 +22,7 @@ pub struct Mock { pub flaky: bool, } -#[allow(clippy::absolute_paths)] +#[expect(clippy::absolute_paths)] #[derive(thiserror::Error, Debug)] pub enum MockError { #[error("Failed to generate uniform distribution: {0}")] @@ -79,7 +79,7 @@ impl Mock { } } - #[allow(clippy::cast_precision_loss, clippy::similar_names)] + #[expect(clippy::cast_precision_loss, clippy::similar_names)] fn generate_results(&self) -> Result { let count = self.count.unwrap_or(DEFAULT_COUNT); let pow = self.pow.unwrap_or(1); diff --git a/services/cli/src/bencher/sub/organization/mod.rs b/services/cli/src/bencher/sub/organization/mod.rs index bfe529297..8a771f7c3 100644 --- a/services/cli/src/bencher/sub/organization/mod.rs +++ b/services/cli/src/bencher/sub/organization/mod.rs @@ -1,4 +1,4 @@ pub mod member; -#[allow(clippy::module_inception)] +#[expect(clippy::module_inception)] pub mod organization; pub mod plan; diff --git a/services/cli/src/bencher/sub/organization/organization/update.rs b/services/cli/src/bencher/sub/organization/organization/update.rs index d13952222..51ed0f4fd 100644 --- a/services/cli/src/bencher/sub/organization/organization/update.rs +++ b/services/cli/src/bencher/sub/organization/organization/update.rs @@ -15,7 +15,7 @@ pub struct Update { pub name: Option, pub slug: Option, #[cfg(feature = "plus")] - #[cfg_attr(feature = "plus", allow(clippy::option_option))] + #[cfg_attr(feature = "plus", expect(clippy::option_option))] pub license: Option>, pub backend: AuthBackend, } diff --git a/services/cli/src/bencher/sub/organization/plan/create.rs b/services/cli/src/bencher/sub/organization/plan/create.rs index 04addcc00..bbf6e25a5 100644 --- a/services/cli/src/bencher/sub/organization/plan/create.rs +++ b/services/cli/src/bencher/sub/organization/plan/create.rs @@ -63,7 +63,7 @@ impl From for JsonNewPlan { remote, .. } = create; - #[allow(clippy::inconsistent_struct_constructor)] + #[expect(clippy::inconsistent_struct_constructor)] Self { checkout, level, diff --git a/services/cli/src/bencher/sub/project/archive/dimension.rs b/services/cli/src/bencher/sub/project/archive/dimension.rs index 0326546c1..53f2183a3 100644 --- a/services/cli/src/bencher/sub/project/archive/dimension.rs +++ b/services/cli/src/bencher/sub/project/archive/dimension.rs @@ -25,7 +25,7 @@ pub enum Dimension { impl From for Dimension { fn from(dimension: CliArchiveDimension) -> Self { - #[allow(clippy::panic)] + #[expect(clippy::panic)] if let Some(branch) = dimension.branch { Self::Branch(branch) } else if let Some(testbed) = dimension.testbed { diff --git a/services/cli/src/bencher/sub/project/mod.rs b/services/cli/src/bencher/sub/project/mod.rs index ddffeb8a1..fcfb2720b 100644 --- a/services/cli/src/bencher/sub/project/mod.rs +++ b/services/cli/src/bencher/sub/project/mod.rs @@ -6,7 +6,7 @@ pub mod measure; pub mod metric; pub mod perf; pub mod plot; -#[allow(clippy::module_inception)] +#[expect(clippy::module_inception)] pub mod project; pub mod report; pub mod testbed; diff --git a/services/cli/src/bencher/sub/project/perf/mod.rs b/services/cli/src/bencher/sub/project/perf/mod.rs index 759b27bc4..eaaee18d8 100644 --- a/services/cli/src/bencher/sub/project/perf/mod.rs +++ b/services/cli/src/bencher/sub/project/perf/mod.rs @@ -17,7 +17,7 @@ mod table_style; use table_style::TableStyle; #[derive(Debug, Clone)] -#[allow(clippy::option_option)] +#[expect(clippy::option_option)] pub struct Perf { project: ResourceId, branches: Vec, diff --git a/services/cli/src/bencher/sub/project/plot/create.rs b/services/cli/src/bencher/sub/project/plot/create.rs index 1354abd11..de1b03f3c 100644 --- a/services/cli/src/bencher/sub/project/plot/create.rs +++ b/services/cli/src/bencher/sub/project/plot/create.rs @@ -11,7 +11,7 @@ use crate::{ }; #[derive(Debug, Clone)] -#[allow(clippy::struct_excessive_bools)] +#[expect(clippy::struct_excessive_bools)] pub struct Create { pub project: ResourceId, pub index: Option, @@ -95,7 +95,7 @@ impl From for JsonNewPlot { upper_value, lower_boundary, upper_boundary, - #[allow(clippy::absolute_paths)] + #[expect(clippy::absolute_paths)] x_axis: match x_axis { XAxis::DateTime => bencher_client::types::XAxis::DateTime, XAxis::Version => bencher_client::types::XAxis::Version, diff --git a/services/cli/src/bencher/sub/project/plot/update.rs b/services/cli/src/bencher/sub/project/plot/update.rs index ca7dbb001..9753dd160 100644 --- a/services/cli/src/bencher/sub/project/plot/update.rs +++ b/services/cli/src/bencher/sub/project/plot/update.rs @@ -8,7 +8,7 @@ use crate::{ }; #[derive(Debug, Clone)] -#[allow(clippy::option_option)] +#[expect(clippy::option_option)] pub struct Update { pub project: ResourceId, pub plot: PlotUuid, diff --git a/services/cli/src/bencher/sub/project/project/update.rs b/services/cli/src/bencher/sub/project/project/update.rs index a60c7b51b..dd7878cb4 100644 --- a/services/cli/src/bencher/sub/project/project/update.rs +++ b/services/cli/src/bencher/sub/project/project/update.rs @@ -10,7 +10,7 @@ use crate::{ }; #[derive(Debug, Clone)] -#[allow(clippy::option_option)] +#[expect(clippy::option_option)] pub struct Update { pub project: ResourceId, pub name: Option, diff --git a/services/cli/src/bencher/sub/project/threshold/model.rs b/services/cli/src/bencher/sub/project/threshold/model.rs index 67d448953..8e6ff67d2 100644 --- a/services/cli/src/bencher/sub/project/threshold/model.rs +++ b/services/cli/src/bencher/sub/project/threshold/model.rs @@ -85,7 +85,7 @@ impl From for bencher_client::types::Model { lower_boundary, upper_boundary, } = model; - #[allow(clippy::inconsistent_struct_constructor)] + #[expect(clippy::inconsistent_struct_constructor)] bencher_client::types::Model { test, min_sample_size, diff --git a/services/cli/src/bencher/sub/project/threshold/update.rs b/services/cli/src/bencher/sub/project/threshold/update.rs index ecc8f899d..5f13aa66b 100644 --- a/services/cli/src/bencher/sub/project/threshold/update.rs +++ b/services/cli/src/bencher/sub/project/threshold/update.rs @@ -35,7 +35,7 @@ impl TryFrom for Update { }, backend, } = update; - #[allow(clippy::if_same_then_else)] + #[expect(clippy::if_same_then_else)] let model = if let Some(test) = test { let cli_model = CliModel { test, @@ -73,7 +73,7 @@ impl From for JsonUpdateThreshold { lower_boundary, upper_boundary, } = model; - #[allow(clippy::inconsistent_struct_constructor)] + #[expect(clippy::inconsistent_struct_constructor)] Self { subtype_0: Some(JsonUpdateModel { test, diff --git a/services/cli/src/bencher/sub/run/branch.rs b/services/cli/src/bencher/sub/run/branch.rs index f229dcc47..450327c33 100644 --- a/services/cli/src/bencher/sub/run/branch.rs +++ b/services/cli/src/bencher/sub/run/branch.rs @@ -2,7 +2,7 @@ use bencher_json::{GitHash, NameId}; use crate::{bencher::sub::project::branch::start_point::StartPoint, parser::run::CliRunBranch}; -#[allow(clippy::struct_field_names)] +#[expect(clippy::struct_field_names)] #[derive(Debug, Clone)] pub struct Branch { branch: Option, @@ -45,7 +45,7 @@ impl TryFrom for Branch { } } -#[allow(clippy::needless_pass_by_value)] +#[expect(clippy::needless_pass_by_value)] fn map_start_point( start_point: Vec, start_point_hash: Option, diff --git a/services/cli/src/bencher/sub/run/ci/github_actions.rs b/services/cli/src/bencher/sub/run/ci/github_actions.rs index 90fabab42..cda72de0d 100644 --- a/services/cli/src/bencher/sub/run/ci/github_actions.rs +++ b/services/cli/src/bencher/sub/run/ci/github_actions.rs @@ -20,10 +20,10 @@ const PULL_REQUEST_TARGET: &str = "pull_request_target"; const FULL_NAME: &str = "full_name"; // https://docs.github.com/en/rest/checks/runs?apiVersion=2022-11-28#create-a-check-run -#[allow(clippy::decimal_literal_representation)] +#[expect(clippy::decimal_literal_representation)] const CHECK_MAX_LENGTH: usize = 65_536; -#[allow(clippy::struct_excessive_bools)] +#[expect(clippy::struct_excessive_bools)] #[derive(Debug)] pub struct GitHubActions { pub token: String, diff --git a/services/cli/src/bencher/sub/run/ci/mod.rs b/services/cli/src/bencher/sub/run/ci/mod.rs index 82bbd66a7..1486119e1 100644 --- a/services/cli/src/bencher/sub/run/ci/mod.rs +++ b/services/cli/src/bencher/sub/run/ci/mod.rs @@ -1,4 +1,4 @@ -#![allow(clippy::result_large_err)] +#![expect(clippy::result_large_err)] use bencher_comment::ReportComment; diff --git a/services/cli/src/bencher/sub/run/error.rs b/services/cli/src/bencher/sub/run/error.rs index 75f6a1529..85d87f673 100644 --- a/services/cli/src/bencher/sub/run/error.rs +++ b/services/cli/src/bencher/sub/run/error.rs @@ -1,4 +1,4 @@ -#![allow(clippy::absolute_paths)] +#![expect(clippy::absolute_paths)] use super::runner::{command::Command, Runner}; diff --git a/services/cli/src/bencher/sub/run/mod.rs b/services/cli/src/bencher/sub/run/mod.rs index ff3302c01..95288d342 100644 --- a/services/cli/src/bencher/sub/run/mod.rs +++ b/services/cli/src/bencher/sub/run/mod.rs @@ -30,7 +30,7 @@ use crate::bencher::SubCmd; use super::project::report::Thresholds; #[derive(Debug)] -#[allow(clippy::struct_excessive_bools)] +#[expect(clippy::struct_excessive_bools)] pub struct Run { project: Option, branch: Branch, @@ -48,7 +48,7 @@ pub struct Run { log: bool, ci: Option, runner: Runner, - #[allow(clippy::struct_field_names)] + #[expect(clippy::struct_field_names)] dry_run: bool, backend: PubBackend, } @@ -76,9 +76,9 @@ impl TryFrom for Run { backend, } = run; Ok(Self { - project: project.map(Into::into), + project, branch: branch.try_into().map_err(RunError::Branch)?, - testbed: testbed.map(Into::into), + testbed, adapter: adapter.into(), sub_adapter: (&cmd).into(), average: average.map(Into::into), diff --git a/services/cli/src/bencher/sub/run/runner/build_time.rs b/services/cli/src/bencher/sub/run/runner/build_time.rs index a0638077e..12cd8311c 100644 --- a/services/cli/src/bencher/sub/run/runner/build_time.rs +++ b/services/cli/src/bencher/sub/run/runner/build_time.rs @@ -1,6 +1,6 @@ use bencher_json::{ project::{ - measure::built_in::{self, BuiltInMeasure}, + measure::built_in::{self, BuiltInMeasure as _}, metric::MetricResults, }, JsonNewMetric, @@ -12,7 +12,7 @@ use crate::RunError; pub struct BuildTime; impl BuildTime { - #[allow(clippy::unused_self)] + #[expect(clippy::unused_self)] pub fn command(self, name: String, duration: f64) -> BuildCommand { BuildCommand { name, duration } } diff --git a/services/cli/src/bencher/sub/run/runner/command.rs b/services/cli/src/bencher/sub/run/runner/command.rs index f0bbfd228..082e0a080 100644 --- a/services/cli/src/bencher/sub/run/runner/command.rs +++ b/services/cli/src/bencher/sub/run/runner/command.rs @@ -1,7 +1,7 @@ use std::{fmt, process::Stdio}; use chrono::Utc; -use tokio::io::{AsyncBufReadExt, BufReader}; +use tokio::io::{AsyncBufReadExt as _, BufReader}; use super::build_time::{BuildCommand, BuildTime}; use super::file_path::FilePath; @@ -153,7 +153,7 @@ impl Command { .timestamp_nanos_opt() .and_then(|end_time| end_time.checked_sub(start_time.timestamp_nanos_opt()?)) .and_then(|d| { - #[allow(clippy::cast_precision_loss)] + #[expect(clippy::cast_precision_loss)] format!("{:.2}", (d as f64) / 1_000_000_000.0) .parse::() .ok() diff --git a/services/cli/src/bencher/sub/run/runner/file_size.rs b/services/cli/src/bencher/sub/run/runner/file_size.rs index ae7b8c1df..8834feff1 100644 --- a/services/cli/src/bencher/sub/run/runner/file_size.rs +++ b/services/cli/src/bencher/sub/run/runner/file_size.rs @@ -2,7 +2,7 @@ use std::fmt; use bencher_json::{ project::{ - measure::built_in::{self, BuiltInMeasure}, + measure::built_in::{self, BuiltInMeasure as _}, metric::MetricResults, }, JsonNewMetric, @@ -52,7 +52,7 @@ impl FileSize { .unwrap_or(file_path.as_str()) .parse() .map_err(RunError::OutputFileName)?; - #[allow(clippy::cast_precision_loss)] + #[expect(clippy::cast_precision_loss)] let value = (std::fs::metadata(file_path) .map(|m| m.len()) .map_err(RunError::OutputFileSize)? as f64) diff --git a/services/cli/src/bencher/sub/run/runner/mod.rs b/services/cli/src/bencher/sub/run/runner/mod.rs index 56af27d6f..bc2e7282b 100644 --- a/services/cli/src/bencher/sub/run/runner/mod.rs +++ b/services/cli/src/bencher/sub/run/runner/mod.rs @@ -1,4 +1,4 @@ -#![allow(clippy::result_large_err)] +#![expect(clippy::result_large_err)] use std::fmt; diff --git a/services/cli/src/bencher/sub/run/runner/pipe.rs b/services/cli/src/bencher/sub/run/runner/pipe.rs index 78dfffed5..9e25d48bb 100644 --- a/services/cli/src/bencher/sub/run/runner/pipe.rs +++ b/services/cli/src/bencher/sub/run/runner/pipe.rs @@ -1,4 +1,4 @@ -use std::{fmt, io::BufRead}; +use std::{fmt, io::BufRead as _}; use super::Output; diff --git a/services/cli/src/bencher/sub/user/mod.rs b/services/cli/src/bencher/sub/user/mod.rs index 748acfa75..c13435f2e 100644 --- a/services/cli/src/bencher/sub/user/mod.rs +++ b/services/cli/src/bencher/sub/user/mod.rs @@ -1,3 +1,3 @@ pub mod token; -#[allow(clippy::module_inception)] +#[expect(clippy::module_inception)] pub mod user; diff --git a/services/cli/src/error.rs b/services/cli/src/error.rs index a06283932..e35392dfe 100644 --- a/services/cli/src/error.rs +++ b/services/cli/src/error.rs @@ -1,4 +1,4 @@ -#![allow(clippy::absolute_paths)] +#![expect(clippy::absolute_paths)] #[derive(thiserror::Error, Debug)] pub enum CliError { diff --git a/services/cli/src/lib.rs b/services/cli/src/lib.rs index 9c047383c..cdf46c06a 100644 --- a/services/cli/src/lib.rs +++ b/services/cli/src/lib.rs @@ -2,7 +2,7 @@ mod bencher; mod error; mod parser; -use bencher::{sub::SubCmd, Bencher}; +use bencher::{sub::SubCmd as _, Bencher}; pub use bencher::{ sub::{MockError, RunError, ThresholdError}, BackendError, @@ -24,11 +24,11 @@ pub async fn exec() -> Result<(), CliError> { macro_rules! cli_println { // () => (print!("\n")); ($fmt:expr) => ({ - use std::io::Write; + use std::io::Write as _; let _w = writeln!(std::io::stdout(), $fmt); }); ($fmt:expr, $($arg:tt)*) => ({ - use std::io::Write; + use std::io::Write as _; let _w = writeln!(std::io::stdout(), $fmt, $($arg)*); }); } @@ -53,11 +53,11 @@ pub(crate) use cli_println_quietable; macro_rules! cli_eprintln { // () => (eprint!("\n")); ($fmt:expr) => ({ - use std::io::Write; + use std::io::Write as _; let _w = writeln!(std::io::stderr(), $fmt); }); ($fmt:expr, $($arg:tt)*) => ({ - use std::io::Write; + use std::io::Write as _; let _w = writeln!(std::io::stderr(), $fmt, $($arg)*); }) } diff --git a/services/cli/src/main.rs b/services/cli/src/main.rs index f3bd498cc..3eee3b47c 100644 --- a/services/cli/src/main.rs +++ b/services/cli/src/main.rs @@ -1,15 +1,15 @@ -#![allow(unused_crate_dependencies)] +#![expect(unused_crate_dependencies)] use std::{io::ErrorKind, process::ExitCode}; use bencher_cli::{CliError, RunError}; use tokio_rustls::rustls::crypto::ring; -#[allow(clippy::print_stderr)] +#[expect(clippy::print_stderr)] #[tokio::main(flavor = "current_thread")] async fn main() -> ExitCode { let crypto_provider = ring::default_provider(); - #[allow(clippy::use_debug)] + #[expect(clippy::use_debug)] if let Err(err) = crypto_provider.install_default() { eprintln!("Failed to install default AWS credentials provider: {err:?}"); return ExitCode::FAILURE; diff --git a/services/cli/src/parser/mod.rs b/services/cli/src/parser/mod.rs index 620c2928b..a3df4f492 100644 --- a/services/cli/src/parser/mod.rs +++ b/services/cli/src/parser/mod.rs @@ -114,7 +114,7 @@ pub enum CliSub { Auth(CliAuth), } -#[allow(clippy::doc_markdown)] +#[expect(clippy::doc_markdown)] #[derive(Args, Debug)] pub struct CliBackend { /// Backend host URL @@ -213,7 +213,7 @@ impl From for Option { (false, false) => None, (false, true) => Some(false), (true, false) => Some(true), - #[allow(clippy::unreachable)] + #[expect(clippy::unreachable)] (true, true) => unreachable!("Cannot set both `archive` and `unarchive`"), } } diff --git a/services/cli/src/parser/project/branch.rs b/services/cli/src/parser/project/branch.rs index c5af4cc39..173119adb 100644 --- a/services/cli/src/parser/project/branch.rs +++ b/services/cli/src/parser/project/branch.rs @@ -73,7 +73,7 @@ pub struct CliBranchCreate { pub backend: CliBackend, } -#[allow(clippy::doc_markdown, clippy::struct_field_names)] +#[expect(clippy::doc_markdown, clippy::struct_field_names)] #[derive(Args, Debug)] pub struct CliStartPointCreate { /// Branch name, slug, or UUID to use as the new branch start point @@ -141,7 +141,7 @@ pub struct CliBranchUpdate { pub backend: CliBackend, } -#[allow(clippy::struct_field_names)] +#[expect(clippy::struct_field_names)] #[derive(Args, Debug)] pub struct CliStartPointUpdate { /// Use the specified branch name, slug, or UUID as the start point for `branch`. diff --git a/services/cli/src/parser/project/mod.rs b/services/cli/src/parser/project/mod.rs index 2b4eeac99..1c4157acc 100644 --- a/services/cli/src/parser/project/mod.rs +++ b/services/cli/src/parser/project/mod.rs @@ -120,7 +120,7 @@ pub struct CliProjectUpdate { #[clap(long)] pub slug: Option, - #[allow(clippy::option_option)] + #[expect(clippy::option_option)] /// Project URL /// To remove the current project URL without replacing it, use an underscore (`_`). #[clap(long)] diff --git a/services/cli/src/parser/project/perf.rs b/services/cli/src/parser/project/perf.rs index 47dc541a5..25a55c58b 100644 --- a/services/cli/src/parser/project/perf.rs +++ b/services/cli/src/parser/project/perf.rs @@ -6,7 +6,7 @@ use clap::{Parser, ValueEnum}; use crate::parser::{CliBackend, ElidedOption}; #[derive(Parser, Debug)] -#[allow(clippy::option_option)] +#[expect(clippy::option_option)] pub struct CliPerf { /// Project slug or UUID pub project: ResourceId, diff --git a/services/cli/src/parser/project/plot.rs b/services/cli/src/parser/project/plot.rs index 31086c0f1..540449671 100644 --- a/services/cli/src/parser/project/plot.rs +++ b/services/cli/src/parser/project/plot.rs @@ -55,7 +55,7 @@ pub enum CliPlotsSort { } #[derive(Parser, Debug)] -#[allow(clippy::struct_excessive_bools)] +#[expect(clippy::struct_excessive_bools)] pub struct CliPlotCreate { /// Project slug or UUID pub project: ResourceId, diff --git a/services/cli/src/parser/run.rs b/services/cli/src/parser/run.rs index 57c06dca0..d70d2b62d 100644 --- a/services/cli/src/parser/run.rs +++ b/services/cli/src/parser/run.rs @@ -9,7 +9,7 @@ use super::project::report::{ }; #[derive(Parser, Debug)] -#[allow(clippy::option_option, clippy::struct_excessive_bools)] +#[expect(clippy::option_option, clippy::struct_excessive_bools)] pub struct CliRun { /// Project slug or UUID #[clap(long, env = "BENCHER_PROJECT")] @@ -74,7 +74,7 @@ pub struct CliRun { } #[derive(Args, Debug)] -#[allow(clippy::option_option)] +#[expect(clippy::option_option)] pub struct CliRunBranch { /// Branch name, slug, or UUID. /// If a name or slug is provided, the branch will be created if it does not exist. @@ -192,7 +192,7 @@ pub enum CliRunFormat { Html, } -#[allow(clippy::struct_excessive_bools)] +#[expect(clippy::struct_excessive_bools)] #[derive(Args, Debug)] #[clap(group( ArgGroup::new("ci_cd") diff --git a/services/cli/src/parser/system/auth.rs b/services/cli/src/parser/system/auth.rs index 09cb8d929..107277314 100644 --- a/services/cli/src/parser/system/auth.rs +++ b/services/cli/src/parser/system/auth.rs @@ -17,7 +17,7 @@ pub enum CliAuth { Accept(CliAuthAccept), } -#[allow(clippy::doc_markdown)] +#[expect(clippy::doc_markdown)] #[derive(Parser, Debug)] pub struct CliAuthSignup { /// User email diff --git a/tasks/bin_version/src/main.rs b/tasks/bin_version/src/main.rs index 65a712b43..f79621b45 100644 --- a/tasks/bin_version/src/main.rs +++ b/tasks/bin_version/src/main.rs @@ -1,6 +1,6 @@ const API_VERSION: &str = env!("CARGO_PKG_VERSION"); -#[allow(clippy::print_stdout)] +#[expect(clippy::print_stdout)] fn main() { println!("{API_VERSION}"); } diff --git a/tasks/gen_installer/src/main.rs b/tasks/gen_installer/src/main.rs index 2e2e8d2a0..da30c4b76 100644 --- a/tasks/gen_installer/src/main.rs +++ b/tasks/gen_installer/src/main.rs @@ -1,4 +1,4 @@ -#![allow(clippy::print_stdout)] +#![expect(clippy::print_stdout)] mod parser; mod task; diff --git a/tasks/gen_installer/src/task/mod.rs b/tasks/gen_installer/src/task/mod.rs index dbe90cb96..5e7e88e0f 100644 --- a/tasks/gen_installer/src/task/mod.rs +++ b/tasks/gen_installer/src/task/mod.rs @@ -1,4 +1,4 @@ -use clap::Parser; +use clap::Parser as _; use crate::parser::TaskTemplate; diff --git a/tasks/gen_installer/src/task/template.rs b/tasks/gen_installer/src/task/template.rs index ad008b305..20b230d69 100644 --- a/tasks/gen_installer/src/task/template.rs +++ b/tasks/gen_installer/src/task/template.rs @@ -1,6 +1,6 @@ use std::fs; #[cfg(unix)] -use std::{fs::Permissions, os::unix::fs::PermissionsExt}; +use std::{fs::Permissions, os::unix::fs::PermissionsExt as _}; use minijinja::Environment; use serde::Serialize; @@ -54,7 +54,7 @@ impl TryFrom for Template { } impl Template { - #[allow(clippy::use_debug)] + #[expect(clippy::use_debug)] pub fn exec(&self) -> anyhow::Result<()> { for &template_kind in &self.templates { let template = self.env.get_template(template_kind.as_ref())?; @@ -168,7 +168,7 @@ pub struct TemplateArtifact { type TargetTriple = String; -#[allow(dead_code)] +#[expect(dead_code)] #[derive(Debug, Clone, Copy, PartialEq, Eq)] pub enum ZipStyle { /// `.zip` @@ -179,7 +179,7 @@ pub enum ZipStyle { TempDir, } -#[allow(dead_code)] +#[expect(dead_code)] #[derive(Debug, Copy, Clone, PartialEq, Eq)] pub enum CompressionImpl { /// `.gz` diff --git a/tasks/gen_notes/src/main.rs b/tasks/gen_notes/src/main.rs index 56a4d4644..ac167e0d1 100644 --- a/tasks/gen_notes/src/main.rs +++ b/tasks/gen_notes/src/main.rs @@ -1,4 +1,4 @@ -#![allow(clippy::print_stdout)] +#![expect(clippy::print_stdout)] mod parser; mod task; diff --git a/tasks/gen_notes/src/task/mod.rs b/tasks/gen_notes/src/task/mod.rs index b2c3dbda8..3be3af588 100644 --- a/tasks/gen_notes/src/task/mod.rs +++ b/tasks/gen_notes/src/task/mod.rs @@ -1,4 +1,4 @@ -use clap::Parser; +use clap::Parser as _; use crate::parser::TaskReleaseNotes; diff --git a/tasks/gen_notes/src/task/release_notes.rs b/tasks/gen_notes/src/task/release_notes.rs index 0a4b81d85..a4d869632 100644 --- a/tasks/gen_notes/src/task/release_notes.rs +++ b/tasks/gen_notes/src/task/release_notes.rs @@ -1,6 +1,6 @@ use std::{ fs::File, - io::{BufRead, BufReader, BufWriter, Write}, + io::{BufRead as _, BufReader, BufWriter, Write as _}, }; use camino::Utf8PathBuf; diff --git a/tasks/gen_pkg/src/main.rs b/tasks/gen_pkg/src/main.rs index 2e2e8d2a0..da30c4b76 100644 --- a/tasks/gen_pkg/src/main.rs +++ b/tasks/gen_pkg/src/main.rs @@ -1,4 +1,4 @@ -#![allow(clippy::print_stdout)] +#![expect(clippy::print_stdout)] mod parser; mod task; diff --git a/tasks/gen_pkg/src/task/mod.rs b/tasks/gen_pkg/src/task/mod.rs index 47ce437d2..a113cc796 100644 --- a/tasks/gen_pkg/src/task/mod.rs +++ b/tasks/gen_pkg/src/task/mod.rs @@ -1,4 +1,4 @@ -use clap::Parser; +use clap::Parser as _; use crate::parser::{TaskSub, TaskTask}; @@ -11,7 +11,7 @@ pub struct Task { sub: Sub, } -#[allow(variant_size_differences)] +#[expect(variant_size_differences)] #[derive(Debug)] pub enum Sub { Man(Man), diff --git a/tasks/gen_pkg/src/task/package/deb.rs b/tasks/gen_pkg/src/task/package/deb.rs index 0e7a6a6d8..58f277bfc 100644 --- a/tasks/gen_pkg/src/task/package/deb.rs +++ b/tasks/gen_pkg/src/task/package/deb.rs @@ -1,6 +1,6 @@ use std::process::Command; #[cfg(unix)] -use std::{fs::Permissions, os::unix::fs::PermissionsExt}; +use std::{fs::Permissions, os::unix::fs::PermissionsExt as _}; use camino::Utf8PathBuf; @@ -27,7 +27,7 @@ impl TryFrom for Deb { impl Deb { pub fn exec(&self) -> anyhow::Result<()> { - #[allow(clippy::expect_used)] + #[expect(clippy::expect_used)] let deb_path = self.dir.join( self.bin .file_name() diff --git a/tasks/gen_pkg/src/task/package/man.rs b/tasks/gen_pkg/src/task/package/man.rs index ca27aac99..a03d177b3 100644 --- a/tasks/gen_pkg/src/task/package/man.rs +++ b/tasks/gen_pkg/src/task/package/man.rs @@ -1,6 +1,6 @@ use bencher_cli::CliBencher; use camino::Utf8PathBuf; -use clap::CommandFactory; +use clap::CommandFactory as _; use crate::parser::TaskMan; diff --git a/tasks/gen_types/src/main.rs b/tasks/gen_types/src/main.rs index 2e2e8d2a0..da30c4b76 100644 --- a/tasks/gen_types/src/main.rs +++ b/tasks/gen_types/src/main.rs @@ -1,4 +1,4 @@ -#![allow(clippy::print_stdout)] +#![expect(clippy::print_stdout)] mod parser; mod task; diff --git a/tasks/gen_types/src/task/mod.rs b/tasks/gen_types/src/task/mod.rs index 3d687b404..cff5a3406 100644 --- a/tasks/gen_types/src/task/mod.rs +++ b/tasks/gen_types/src/task/mod.rs @@ -1,4 +1,4 @@ -use clap::Parser; +use clap::Parser as _; use crate::parser::{TaskSub, TaskTask}; @@ -15,7 +15,7 @@ pub struct Task { sub: Sub, } -#[allow(variant_size_differences)] +#[expect(variant_size_differences)] #[derive(Debug)] pub enum Sub { Types(Types), diff --git a/tasks/gen_types/src/task/spec.rs b/tasks/gen_types/src/task/spec.rs index a7118c3bf..8ece038a6 100644 --- a/tasks/gen_types/src/task/spec.rs +++ b/tasks/gen_types/src/task/spec.rs @@ -1,7 +1,7 @@ use std::fs; use bencher_api::api::Api; -use bencher_endpoint::Registrar; +use bencher_endpoint::Registrar as _; use dropshot::{ApiDescription, EndpointTagPolicy, TagConfig, TagDetails}; use crate::{parser::TaskSpec, API_VERSION}; @@ -20,7 +20,7 @@ impl TryFrom for Spec { } impl Spec { - #[allow(clippy::unused_self)] + #[expect(clippy::unused_self)] pub fn exec(&self) -> anyhow::Result<()> { let _log = bencher_logger::bootstrap_logger(); diff --git a/tasks/gen_types/src/task/ts.rs b/tasks/gen_types/src/task/ts.rs index 5bf871996..61c16c4ee 100644 --- a/tasks/gen_types/src/task/ts.rs +++ b/tasks/gen_types/src/task/ts.rs @@ -14,7 +14,7 @@ impl TryFrom for Ts { } impl Ts { - #[allow(clippy::unused_self)] + #[expect(clippy::unused_self)] pub fn exec(&self) -> anyhow::Result<()> { let status = Command::new("npm") .args(["run", "typeshare"]) diff --git a/tasks/gen_types/src/task/types.rs b/tasks/gen_types/src/task/types.rs index 666958d80..33b78351d 100644 --- a/tasks/gen_types/src/task/types.rs +++ b/tasks/gen_types/src/task/types.rs @@ -20,7 +20,7 @@ impl TryFrom for Types { } impl Types { - #[allow(clippy::unused_self)] + #[expect(clippy::unused_self)] pub fn exec(&self) -> anyhow::Result<()> { self.spec.exec()?; self.ts.exec()?; diff --git a/tasks/test_api/src/main.rs b/tasks/test_api/src/main.rs index 9edaf1c9f..5adaee72c 100644 --- a/tasks/test_api/src/main.rs +++ b/tasks/test_api/src/main.rs @@ -1,4 +1,4 @@ -#![allow( +#![expect( clippy::expect_used, clippy::print_stderr, clippy::print_stdout, diff --git a/tasks/test_api/src/parser/test.rs b/tasks/test_api/src/parser/test.rs index 6792ad963..253b975a6 100644 --- a/tasks/test_api/src/parser/test.rs +++ b/tasks/test_api/src/parser/test.rs @@ -26,7 +26,7 @@ pub struct TaskExamples { /// Template kind #[derive(ValueEnum, Debug, Clone, Copy)] #[clap(rename_all = "snake_case")] -#[allow(clippy::enum_variant_names)] +#[expect(clippy::enum_variant_names)] pub enum TaskExample { /// Rust libtest bench RustBench, @@ -49,7 +49,7 @@ pub struct TaskSmokeTest { /// Template kind #[derive(ValueEnum, Debug, Clone, Copy, Default)] #[clap(rename_all = "snake_case")] -#[allow(clippy::doc_markdown)] +#[expect(clippy::doc_markdown)] pub enum TaskTestEnvironment { #[default] /// https://localhost:61016 diff --git a/tasks/test_api/src/task/mod.rs b/tasks/test_api/src/task/mod.rs index e61f550f2..aec6b2368 100644 --- a/tasks/test_api/src/task/mod.rs +++ b/tasks/test_api/src/task/mod.rs @@ -1,4 +1,4 @@ -use clap::Parser; +use clap::Parser as _; use crate::parser::{TaskSub, TaskTask}; @@ -11,7 +11,7 @@ pub struct Task { sub: Sub, } -#[allow(variant_size_differences, clippy::large_enum_variant)] +#[expect(variant_size_differences, clippy::large_enum_variant)] #[derive(Debug)] pub enum Sub { SeedTest(SeedTest), diff --git a/tasks/test_api/src/task/test/examples.rs b/tasks/test_api/src/task/test/examples.rs index d498b1a1c..4d9d980a8 100644 --- a/tasks/test_api/src/task/test/examples.rs +++ b/tasks/test_api/src/task/test/examples.rs @@ -12,7 +12,7 @@ pub struct Examples { } #[derive(Debug, Clone, Copy)] -#[allow(clippy::enum_variant_names)] +#[expect(clippy::enum_variant_names)] pub enum Example { RustBench, RustCriterion, diff --git a/tasks/test_api/src/task/test/seed_test.rs b/tasks/test_api/src/task/test/seed_test.rs index 408647bd4..a43390954 100644 --- a/tasks/test_api/src/task/test/seed_test.rs +++ b/tasks/test_api/src/task/test/seed_test.rs @@ -1,6 +1,6 @@ use std::process::Command; -use assert_cmd::{assert::OutputAssertExt, cargo::CommandCargoExt}; +use assert_cmd::{assert::OutputAssertExt as _, cargo::CommandCargoExt as _}; use bencher_json::{Jwt, Url, LOCALHOST_BENCHER_API_URL}; use pretty_assertions::assert_eq; @@ -45,7 +45,7 @@ impl TryFrom for SeedTest { } impl SeedTest { - #[allow(clippy::too_many_lines)] + #[expect(clippy::too_many_lines)] pub fn exec(&self) -> anyhow::Result<()> { let host = self.url.as_ref(); let token = self.token.as_ref(); @@ -1275,7 +1275,7 @@ impl SeedTest { TOKEN_ARG, token, PROJECT_SLUG, - #[allow(clippy::indexing_slicing)] + #[expect(clippy::indexing_slicing)] alerts.0[0].uuid.to_string().as_str(), ]) .current_dir(CLI_DIR); diff --git a/tasks/test_netlify/src/main.rs b/tasks/test_netlify/src/main.rs index 87bf82699..51952c738 100644 --- a/tasks/test_netlify/src/main.rs +++ b/tasks/test_netlify/src/main.rs @@ -1,4 +1,4 @@ -#![allow(clippy::print_stdout)] +#![expect(clippy::print_stdout)] mod parser; mod task; diff --git a/tasks/test_netlify/src/parser/mod.rs b/tasks/test_netlify/src/parser/mod.rs index 2fc02436c..fc58481bd 100644 --- a/tasks/test_netlify/src/parser/mod.rs +++ b/tasks/test_netlify/src/parser/mod.rs @@ -6,7 +6,7 @@ pub struct TaskTask { pub sub: TaskSub, } -#[allow(variant_size_differences, clippy::large_enum_variant)] +#[expect(variant_size_differences, clippy::large_enum_variant)] #[derive(Subcommand, Debug)] pub enum TaskSub { Dev(TaskTestNetlify), diff --git a/tasks/test_netlify/src/task/mod.rs b/tasks/test_netlify/src/task/mod.rs index c38f8ff6b..24ef61094 100644 --- a/tasks/test_netlify/src/task/mod.rs +++ b/tasks/test_netlify/src/task/mod.rs @@ -1,4 +1,4 @@ -use clap::Parser; +use clap::Parser as _; use crate::parser::{TaskSub, TaskTask}; @@ -11,7 +11,7 @@ pub struct Task { sub: Sub, } -#[allow(variant_size_differences)] +#[expect(variant_size_differences)] #[derive(Debug)] pub enum Sub { Dev(TestNetlify), diff --git a/xtask/src/main.rs b/xtask/src/main.rs index 17a8bf903..6e29197c5 100644 --- a/xtask/src/main.rs +++ b/xtask/src/main.rs @@ -1,4 +1,4 @@ -#![allow( +#![expect( clippy::expect_used, clippy::print_stdout, clippy::print_stderr, @@ -14,7 +14,7 @@ use task::Task; #[tokio::main(flavor = "current_thread")] async fn main() -> anyhow::Result<()> { - #[allow(let_underscore_drop, reason = "Optional dotenv file")] + #[expect(let_underscore_drop, reason = "Optional dotenv file")] let _ = dotenvy::from_path("xtask/.env"); exec().await } diff --git a/xtask/src/task/mod.rs b/xtask/src/task/mod.rs index e3bae918f..33e8c5dfa 100644 --- a/xtask/src/task/mod.rs +++ b/xtask/src/task/mod.rs @@ -1,4 +1,4 @@ -use clap::Parser; +use clap::Parser as _; use crate::parser::{TaskSub, TaskTask}; @@ -15,7 +15,7 @@ pub struct Task { sub: Sub, } -#[allow(variant_size_differences, clippy::large_enum_variant)] +#[expect(variant_size_differences, clippy::large_enum_variant)] #[derive(Debug)] pub enum Sub { #[cfg(feature = "plus")] diff --git a/xtask/src/task/plus/index/engine.rs b/xtask/src/task/plus/index/engine.rs index 37aeef07e..41b3dee92 100644 --- a/xtask/src/task/plus/index/engine.rs +++ b/xtask/src/task/plus/index/engine.rs @@ -1,4 +1,4 @@ -use std::str::FromStr; +use std::str::FromStr as _; use bencher_bing_index::BingIndex; use bencher_google_index::GoogleIndex; diff --git a/xtask/src/task/plus/prompt.rs b/xtask/src/task/plus/prompt.rs index 3bec8be36..d06cc3dfe 100644 --- a/xtask/src/task/plus/prompt.rs +++ b/xtask/src/task/plus/prompt.rs @@ -1,4 +1,4 @@ -use std::io::Write; +use std::io::Write as _; use async_openai::{ types::{ @@ -31,7 +31,7 @@ impl TryFrom for Prompt { } impl Prompt { - #[allow(clippy::unused_async)] + #[expect(clippy::unused_async)] pub async fn exec(&self) -> anyhow::Result<()> { let start_time = Utc::now(); let system_input = "You are a professional technical writer for software documentation. Write your documentation in Markdown using American English."; diff --git a/xtask/src/task/plus/translate.rs b/xtask/src/task/plus/translate.rs index adefe289f..dea35d523 100644 --- a/xtask/src/task/plus/translate.rs +++ b/xtask/src/task/plus/translate.rs @@ -1,4 +1,4 @@ -use std::{fmt, io::Write}; +use std::{fmt, io::Write as _}; use async_openai::{ types::{ @@ -90,7 +90,7 @@ impl TaskLanguage { } impl Translate { - #[allow(clippy::unused_async)] + #[expect(clippy::unused_async)] pub async fn exec(&self) -> anyhow::Result<()> { for input_path in &self.input_path { let languages = self.lang.clone().unwrap_or_else(TaskLanguage::all);