Now using expect instead of allow where an error is expected.

This commit is contained in:
Filipe Rodrigues 2023-01-01 22:56:37 +00:00
parent 5435385e16
commit b4cd102146
6 changed files with 11 additions and 11 deletions

View File

@ -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<D>(deserializer: D) -> Result<Self, D::Error>
where
D: serde::Deserializer<'de>,

View File

@ -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<String>) -> Result<Option<SystemTime>,
}
/// 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(

View File

@ -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))
})?;

View File

@ -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<PathBuf, AppError> {
}
/// 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<T: BuildableTargetInner + std::fmt::Display>(
builder: &Builder,
target: &rules::Target<T>,

View File

@ -35,7 +35,7 @@ pub async fn fs_try_exists(path: impl AsRef<Path> + Send) -> Result<bool, std::i
}
/// Measures the duration of a fallible future
#[allow(clippy::future_not_send)] // It is send if `F: Send`
#[expect(clippy::future_not_send)] // It is send if `F: Send` (TODO: Check if this is true)
pub async fn try_measure_async<F: Future<Output = Result<T, E>>, T, E>(fut: F) -> Result<(Duration, T), E> {
#[pin_project]
struct Wrapper<F> {

View File

@ -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) =>