From b4cd1021466ef1b889025b82f063febe58fd37e2 Mon Sep 17 00:00:00 2001 From: Filipe Rodrigues Date: Sun, 1 Jan 2023 22:56:37 +0000 Subject: [PATCH] Now using `expect` instead of `allow` where an error is expected. --- src/ast.rs | 2 +- src/build.rs | 8 ++++---- src/expand.rs | 4 ++-- src/main.rs | 4 ++-- src/util.rs | 2 +- src/watcher.rs | 2 +- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/ast.rs b/src/ast.rs index a35bf69..940ae60 100644 --- a/src/ast.rs +++ b/src/ast.rs @@ -165,7 +165,7 @@ pub enum AliasOp { } impl<'a, 'de: 'a> serde::Deserialize<'de> for Expr<'a> { - #[allow(clippy::indexing_slicing, clippy::string_slice)] // We verify the indexes are correct + #[expect(clippy::indexing_slicing, clippy::string_slice)] // We verify the indexes are correct fn deserialize(deserializer: D) -> Result where D: serde::Deserializer<'de>, diff --git a/src/build.rs b/src/build.rs index 4e3a335..0a057b3 100644 --- a/src/build.rs +++ b/src/build.rs @@ -316,7 +316,7 @@ impl Builder { // lock here. None => { mem::drop(build_guard); - #[allow(clippy::shadow_unrelated)] // They are the same even if redeclared + #[expect(clippy::shadow_unrelated)] // They are the same even if redeclared let mut build_guard = build_lock.lock_build().await; match build_guard.res(&target) { @@ -699,7 +699,7 @@ impl Builder { // Note: We want to continue running until we're out of tasks, even // if the main thread has quit - #[allow(let_underscore_drop)] + #[expect(let_underscore_drop)] let _ = exec.res_tx.send(res); }) .buffer_unordered(max_jobs) @@ -709,7 +709,7 @@ impl Builder { /// Finds a rule for `file` // TODO: Not make this `O(N)` for the number of rules. - #[allow(clippy::type_complexity)] // TODO: Add some type aliases / struct + #[expect(clippy::type_complexity)] // TODO: Add some type aliases / struct pub fn find_rule_for_file( &self, file: &str, @@ -786,7 +786,7 @@ async fn rule_last_build_time(rule: &Rule) -> Result, } /// Returns the file modified time -#[allow(clippy::needless_pass_by_value)] // We use it in `.map`, which makes it convenient to receive by value +#[expect(clippy::needless_pass_by_value)] // We use it in `.map`, which makes it convenient to receive by value fn file_modified_time(metadata: std::fs::Metadata) -> SystemTime { let file_time = FileTime::from_last_modification_time(&metadata); let unix_offset = Duration::new( diff --git a/src/expand.rs b/src/expand.rs index 4051332..55b31ec 100644 --- a/src/expand.rs +++ b/src/expand.rs @@ -14,7 +14,7 @@ use { #[derive(Debug)] pub struct Expander; -#[allow(clippy::unused_self)] // Currently expander doesn't do anything +#[expect(clippy::unused_self)] // Currently expander doesn't do anything impl Expander { /// Creates a new expander pub const fn new() -> Self { @@ -62,7 +62,7 @@ impl Expander { let value = self.expand_expr_string(&alias_expr, visitor)?; // Then apply all - #[allow(clippy::shadow_unrelated)] // They are the same value + #[expect(clippy::shadow_unrelated)] // They are the same value let value = alias.ops.iter().try_fold(value, |value, &op| { self.expand_alias_op(op, value).map_err(AppError::alias_op(op)) })?; diff --git a/src/main.rs b/src/main.rs index b65d55d..0bb476e 100644 --- a/src/main.rs +++ b/src/main.rs @@ -11,7 +11,7 @@ main_separator_str, async_fn_in_trait )] -#![allow(incomplete_features)] // The ones we use are mature enough +#![expect(incomplete_features)] // The ones we use are mature enough // Lints #![forbid(unsafe_code)] #![warn( @@ -218,7 +218,7 @@ async fn find_zbuild() -> Result { } /// Builds a target. -#[allow(clippy::future_not_send)] // Auto-traits are propagated +#[expect(clippy::future_not_send)] // Auto-traits are propagated (TODO: Maybe? Check if this is true) async fn build_target( builder: &Builder, target: &rules::Target, diff --git a/src/util.rs b/src/util.rs index d36fe10..bfef2e3 100644 --- a/src/util.rs +++ b/src/util.rs @@ -35,7 +35,7 @@ pub async fn fs_try_exists(path: impl AsRef + Send) -> Result>, T, E>(fut: F) -> Result<(Duration, T), E> { #[pin_project] struct Wrapper { diff --git a/src/watcher.rs b/src/watcher.rs index e82b7e1..45287b9 100644 --- a/src/watcher.rs +++ b/src/watcher.rs @@ -51,7 +51,7 @@ impl Watcher { Ok(fs_events) => for fs_event in fs_events { tracing::trace!(?fs_event, "Watcher fs event"); - #[allow(let_underscore_drop)] // We don't care if it succeeded or not + #[expect(let_underscore_drop)] // We don't care if it succeeded or not let _ = fs_event_tx.blocking_send(fs_event); }, Err(errs) =>